diff --git a/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php b/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php index 167d457898c..41c832536f4 100644 --- a/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php @@ -163,6 +163,7 @@ public function __construct() { $this->Aco = new AcoTwoTest(); $this->Aro->Permission = new PermissionTwoTest(); } + } /** @@ -171,6 +172,7 @@ public function __construct() { * @package Cake.Test.Case.Controller.Component.Acl */ class DbAclTest extends CakeTestCase { + /** * fixtures property * diff --git a/lib/Cake/Test/Case/Controller/Component/Acl/IniAclTest.php b/lib/Cake/Test/Case/Controller/Component/Acl/IniAclTest.php index 5fd20c70aef..bfdf8ce67b3 100644 --- a/lib/Cake/Test/Case/Controller/Component/Acl/IniAclTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Acl/IniAclTest.php @@ -31,7 +31,7 @@ class IniAclTest extends CakeTestCase { * @return void */ public function testCheck() { - $iniFile = CAKE . 'Test' . DS . 'test_app' . DS . 'Config'. DS . 'acl.ini.php'; + $iniFile = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS . 'acl.ini.php'; $Ini = new IniAcl(); $Ini->config = $Ini->readConfigFile($iniFile); @@ -54,7 +54,7 @@ public function testCheck() { * @return void */ public function testCheckArray() { - $iniFile = CAKE . 'Test' . DS . 'test_app' . DS . 'Config'. DS . 'acl.ini.php'; + $iniFile = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS . 'acl.ini.php'; $Ini = new IniAcl(); $Ini->config = $Ini->readConfigFile($iniFile); diff --git a/lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php b/lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php index 2e6c63243ec..747767657e7 100644 --- a/lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php @@ -34,12 +34,11 @@ public function setUp() { $this->PhpAcl = new PhpAcl(); $this->Acl = new AclComponent($Collection, array( 'adapter' => array( - 'config' => CAKE . 'Test' . DS . 'test_app' . DS . 'Config'. DS . 'acl.php', + 'config' => CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS . 'acl.php', ), )); } - public function testRoleInheritance() { $roles = $this->Acl->Aro->roles('User/peter'); $this->assertEquals(array('Role/accounting'), $roles[0]); @@ -52,14 +51,12 @@ public function testRoleInheritance() { $this->assertEquals(array('User/hardy'), $roles[3]); } - public function testAddRole() { $this->assertEquals(array(array(PhpAro::DEFAULT_ROLE)), $this->Acl->Aro->roles('foobar')); $this->Acl->Aro->addRole(array('User/foobar' => 'Role/accounting')); $this->assertEquals(array(array('Role/accounting'), array('User/foobar')), $this->Acl->Aro->roles('foobar')); } - public function testAroResolve() { $map = $this->Acl->Aro->map; $this->Acl->Aro->map = array( @@ -73,7 +70,7 @@ public function testAroResolve() { $this->assertEquals('User/hardy', $this->Acl->Aro->resolve(array('FooModel' => array('nickname' => 'hardy')))); $this->assertEquals('Role/admin', $this->Acl->Aro->resolve(array('FooModel' => array('role' => 'admin')))); $this->assertEquals('Role/admin', $this->Acl->Aro->resolve('Role/admin')); - + $this->assertEquals('Role/admin', $this->Acl->Aro->resolve('admin')); $this->assertEquals('Role/admin', $this->Acl->Aro->resolve('FooModel/admin')); $this->assertEquals('Role/accounting', $this->Acl->Aro->resolve('accounting')); @@ -93,7 +90,7 @@ public function testAroAliases() { $this->Acl->Aro->aliases = array( 'Role/1' => 'Role/admin', - 'Role/24' => 'Role/accounting', + 'Role/24' => 'Role/accounting', ); $user = array( @@ -127,12 +124,11 @@ public function testAroAliases() { $this->assertFalse($this->Acl->check($user, '/controllers/users/dashboard')); $this->assertFalse($this->Acl->check($user, '/controllers/invoices/send')); - // wee add an more specific entry for user foo to also inherit from Role/accounting + // wee add an more specific entry for user foo to also inherit from Role/accounting $this->Acl->Aro->addRole(array('User/foo' => 'Role/IT, Role/accounting')); $this->assertTrue($this->Acl->check($user, '/controllers/invoices/send')); } - /** * test check method * @@ -146,7 +142,7 @@ public function testCheck() { $this->assertTrue($this->Acl->check('jan', 'foo/bar')); $this->assertTrue($this->Acl->check('user/jan', 'foo/bar')); $this->assertTrue($this->Acl->check('Role/admin', 'controllers/bar')); - $this->assertTrue($this->Acl->check(array('User' => array('username' =>'jan')), '/controllers/bar/bll')); + $this->assertTrue($this->Acl->check(array('User' => array('username' => 'jan')), '/controllers/bar/bll')); $this->assertTrue($this->Acl->check('Role/database_manager', 'controllers/db/create')); $this->assertTrue($this->Acl->check('User/db_manager_2', 'controllers/db/create')); $this->assertFalse($this->Acl->check('db_manager_2', '/controllers/users/Dashboard')); @@ -184,7 +180,6 @@ public function testCheck() { $this->assertFalse($this->Acl->check('role/accounting', 'controllers/articles/publish')); } - /** * lhs of defined rules are case insensitive */ @@ -195,7 +190,6 @@ public function testCheckIsCaseInsensitive() { $this->assertTrue($this->Acl->check('Role/data_acquirer', 'controllers/FORMS/NEW')); } - /** * allow should work in-memory */ @@ -216,7 +210,6 @@ public function testAllow() { $this->assertFalse($this->Acl->check('Role/reports', 'foo/bar')); } - /** * deny should work in-memory */ @@ -231,11 +224,10 @@ public function testDeny() { $this->assertTrue($this->Acl->check('stan', 'controllers/baz/manager_foooooo')); } - /** * test that a deny rule wins over an equally specific allow rule */ - public function testDenyRuleIsStrongerThanAllowRule() { + public function testDenyRuleIsStrongerThanAllowRule() { $this->assertFalse($this->Acl->check('peter', 'baz/bam')); $this->Acl->allow('peter', 'baz/bam'); $this->assertTrue($this->Acl->check('peter', 'baz/bam')); @@ -256,7 +248,6 @@ public function testDenyRuleIsStrongerThanAllowRule() { $this->assertFalse($this->Acl->check('stan', 'controllers/reports/delete')); } - /** * test that an invalid configuration throws exception */ @@ -269,7 +260,6 @@ public function testInvalidConfigWithAroMissing() { $this->PhpAcl->build($config); } - public function testInvalidConfigWithAcosMissing() { $this->setExpectedException( 'AclException', @@ -291,7 +281,7 @@ public function testAcoResolve() { $this->assertEquals(array('foo', 'bar'), $this->Acl->Aco->resolve('foo/bar')); $this->assertEquals(array('foo', 'bar', 'baz'), $this->Acl->Aco->resolve('foo/bar/baz')); $this->assertEquals(array('foo', '*-bar', '?-baz'), $this->Acl->Aco->resolve('foo/*-bar/?-baz')); - + $this->assertEquals(array('foo', 'bar', '[a-f0-9]{24}', '*_bla', 'bla'), $this->Acl->Aco->resolve('foo/bar/[a-f0-9]{24}/*_bla/bla')); // multiple slashes will be squashed to a single, trimmed and then exploded @@ -318,14 +308,13 @@ public function testAroDeclarationContainsCycles() { 'allow' => array( '*' => 'Role/a', ), - ), + ), ); $this->expectError('PHPUnit_Framework_Error', 'cycle detected' /* ... */); $this->PhpAcl->build($config); } - /** * test that with policy allow, only denies count */ diff --git a/lib/Cake/Test/Case/Controller/Component/AclComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AclComponentTest.php index cfdcf662368..c43d1ee689b 100644 --- a/lib/Cake/Test/Case/Controller/Component/AclComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AclComponentTest.php @@ -25,6 +25,7 @@ class_exists('AclComponent'); * @package Cake.Test.Case.Controller.Component */ class AclComponentTest extends CakeTestCase { + /** * setUp method * diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/BasicAuthenticateTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/BasicAuthenticateTest.php index 78611d0980d..c295f53151f 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/BasicAuthenticateTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/BasicAuthenticateTest.php @@ -24,7 +24,7 @@ App::uses('CakeResponse', 'Network'); -require_once CAKE . 'Test' . DS . 'Case' . DS . 'Model' . DS . 'models.php'; +require_once CAKE . 'Test' . DS . 'Case' . DS . 'Model' . DS . 'models.php'; /** * Test case for BasicAuthentication diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/CrudAuthorizeTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/CrudAuthorizeTest.php index 25625bb6538..52953d1dcf7 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/CrudAuthorizeTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/CrudAuthorizeTest.php @@ -114,7 +114,6 @@ public function testAuthorizeCheckFailure() { $this->assertFalse($this->auth->authorize($user['User'], $request)); } - /** * test getting actionMap * diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/DigestAuthenticateTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/DigestAuthenticateTest.php index 3523185b6ba..856c6e74932 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/DigestAuthenticateTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/DigestAuthenticateTest.php @@ -22,7 +22,7 @@ App::uses('CakeRequest', 'Network'); App::uses('CakeResponse', 'Network'); -require_once CAKE . 'Test' . DS . 'Case' . DS . 'Model' . DS . 'models.php'; +require_once CAKE . 'Test' . DS . 'Case' . DS . 'Model' . DS . 'models.php'; /** * Test case for DigestAuthentication diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php index 5463c4e4480..ca07623a0cc 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php @@ -23,7 +23,7 @@ App::uses('CakeRequest', 'Network'); App::uses('CakeResponse', 'Network'); -require_once CAKE . 'Test' . DS . 'Case' . DS . 'Model' . DS . 'models.php'; +require_once CAKE . 'Test' . DS . 'Case' . DS . 'Model' . DS . 'models.php'; /** * Test case for FormAuthentication diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index 695d45aacc0..9e7c7c59a14 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -23,11 +23,11 @@ App::uses('FormAuthenticate', 'Controller/Component/Auth'); /** -* TestAuthComponent class -* -* @package Cake.Test.Case.Controller.Component -* @package Cake.Test.Case.Controller.Component -*/ + * TestAuthComponent class + * + * @package Cake.Test.Case.Controller.Component + * @package Cake.Test.Case.Controller.Component + */ class TestAuthComponent extends AuthComponent { /** @@ -53,11 +53,11 @@ public static function clearUser() { } /** -* AuthUser class -* -* @package Cake.Test.Case.Controller.Component -* @package Cake.Test.Case.Controller.Component -*/ + * AuthUser class + * + * @package Cake.Test.Case.Controller.Component + * @package Cake.Test.Case.Controller.Component + */ class AuthUser extends CakeTestModel { /** @@ -77,11 +77,11 @@ class AuthUser extends CakeTestModel { } /** -* AuthTestController class -* -* @package Cake.Test.Case.Controller.Component -* @package Cake.Test.Case.Controller.Component -*/ + * AuthTestController class + * + * @package Cake.Test.Case.Controller.Component + * @package Cake.Test.Case.Controller.Component + */ class AuthTestController extends Controller { /** @@ -155,7 +155,6 @@ public function admin_add() { * @return void */ public function logout() { - } /** @@ -195,7 +194,6 @@ public function redirect($url, $status = null, $exit = true) { * @return void */ public function isAuthorized() { - } } @@ -269,14 +267,15 @@ public function redirect($url, $status = null, $exit = true) { $this->testUrl = Router::url($url); return false; } + } /** -* AuthComponentTest class -* -* @package Cake.Test.Case.Controller.Component -* @package Cake.Test.Case.Controller.Component -*/ + * AuthComponentTest class + * + * @package Cake.Test.Case.Controller.Component + * @package Cake.Test.Case.Controller.Component + */ class AuthComponentTest extends CakeTestCase { /** @@ -951,7 +950,7 @@ public function testAdminRoute() { */ public function testAjaxLogin() { App::build(array( - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS) + 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) )); $_SERVER['HTTP_X_REQUESTED_WITH'] = "XMLHttpRequest"; @@ -1225,6 +1224,6 @@ public function testPassword() { $result = $this->Auth->password('password'); $expected = Security::hash('password', null, true); $this->assertEquals($expected, $result); - } + } diff --git a/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php b/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php index 80d7ee59f21..1796454abbb 100644 --- a/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php @@ -49,6 +49,7 @@ public function beforeFilter() { $this->Cookie->secure = false; $this->Cookie->key = 'somerandomhaskey'; } + } /** @@ -191,7 +192,7 @@ public function testWriteHttpOnly() { $this->Cookie->secure = false; $this->Cookie->write('Testing', 'value', false); $expected = array( - 'name' => $this->Cookie->name.'[Testing]', + 'name' => $this->Cookie->name . '[Testing]', 'value' => 'value', 'expire' => time() + 10, 'path' => '/', @@ -212,7 +213,7 @@ public function testDeleteHttpOnly() { $this->Cookie->secure = false; $this->Cookie->delete('Testing', false); $expected = array( - 'name' => $this->Cookie->name.'[Testing]', + 'name' => $this->Cookie->name . '[Testing]', 'value' => '', 'expire' => time() - 42000, 'path' => '/', @@ -249,14 +250,14 @@ public function testWriteArrayValues() { $this->Cookie->secure = false; $this->Cookie->write('Testing', array(1, 2, 3), false); $expected = array( - 'name' => $this->Cookie->name.'[Testing]', + 'name' => $this->Cookie->name . '[Testing]', 'value' => '[1,2,3]', 'expire' => time() + 10, 'path' => '/', 'domain' => '', 'secure' => false, 'httpOnly' => false); - $result = $this->Controller->response->cookie($this->Cookie->name.'[Testing]'); + $result = $this->Controller->response->cookie($this->Cookie->name . '[Testing]'); $this->assertEquals($result, $expected); } @@ -516,7 +517,6 @@ public function testNoErrorOnNonArrayData() { $this->assertNull($this->Cookie->read('value')); } - /** * test that deleting a top level keys kills the child elements too. * diff --git a/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php b/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php index 6c9c05dd449..3a22eb67c47 100644 --- a/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php @@ -160,7 +160,7 @@ public function setUp() { self::$sentDate = date(DATE_RFC2822); App::build(array( - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS) + 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) )); } @@ -301,10 +301,10 @@ public function testTemplates() { "\n\n" . '--alt-{boundary}' . "\n" . 'Content-Type: text/html; charset=UTF-8' . "\n" . - 'Content-Transfer-Encoding: 8bit' . "\n\n" . + 'Content-Transfer-Encoding: 8bit' . "\n\n" . $html . - "\n\n" . - '--alt-{boundary}--' . "\n\n\n" . + "\n\n" . + '--alt-{boundary}--' . "\n\n\n" . '--{boundary}--' . "\n"; $expect = '
' . $expect . '
'; @@ -429,7 +429,7 @@ public function testSendDebugWithNoSessions() { */ public function testMessageRetrievalWithoutTemplate() { App::build(array( - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS) + 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) )); $this->Controller->EmailTest->to = 'postmaster@example.com'; @@ -466,7 +466,7 @@ public function testMessageRetrievalWithoutTemplate() { */ public function testMessageRetrievalWithTemplate() { App::build(array( - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS) + 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) )); $this->Controller->set('value', 22091985); @@ -526,7 +526,7 @@ public function testMessageRetrievalWithTemplate() { */ public function testMessageRetrievalWithHelper() { App::build(array( - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS) + 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) )); $timestamp = time(); @@ -624,7 +624,7 @@ public function testContentStripping() { * * @return void */ - public function test_encodeSettingInternalCharset() { + public function testEncodeSettingInternalCharset() { $this->skipIf(!function_exists('mb_internal_encoding'), 'Missing mb_* functions, cannot run test.'); $restore = mb_internal_encoding(); @@ -820,7 +820,7 @@ public function testReset() { public function testPluginCustomViewClass() { App::build(array( 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS) + 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) )); $this->Controller->view = 'TestPlugin.Email'; @@ -835,7 +835,6 @@ public function testPluginCustomViewClass() { $result = DebugCompTransport::$lastEmail; $this->assertRegExp('/Body of message/', $result); - } /** diff --git a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php index 6e1e2537f20..74c70ec0e9b 100644 --- a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php @@ -30,6 +30,7 @@ * @package Cake.Test.Case.Controller.Component */ class PaginatorTestController extends Controller { + /** * name property * @@ -37,13 +38,6 @@ class PaginatorTestController extends Controller { */ public $name = 'PaginatorTest'; -/** - * uses property - * - * @var array - */ - //public $uses = null; - /** * components property * @@ -113,12 +107,13 @@ public function beforeFind($query) { */ public function find($conditions = null, $fields = array(), $order = null, $recursive = null) { if ($conditions == 'popular') { - $conditions = array($this->name . '.' . $this->primaryKey .' > ' => '1'); + $conditions = array($this->name . '.' . $this->primaryKey . ' > ' => '1'); $options = Set::merge($fields, compact('conditions')); return parent::find('all', $options); } return parent::find($conditions, $fields); } + } /** @@ -159,6 +154,7 @@ public function paginate($conditions, $fields, $order, $limit, $page, $recursive public function paginateCount($conditions, $recursive, $extra) { $this->extraCount = $extra; } + } /** @@ -854,7 +850,7 @@ public function testPaginateMaxLimit() { $Controller->request->params['named'] = array('contain' => array('ControllerComment'), 'limit' => '5000'); $result = $Controller->paginate('PaginatorControllerPost'); $this->assertEquals($Controller->params['paging']['PaginatorControllerPost']['options']['limit'], 2000); - } + } /** * test paginate() and virtualField overlapping with real fields. diff --git a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php index e0c6b10cf5e..0907c6e8c5b 100644 --- a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php @@ -67,6 +67,7 @@ public function ajax2_layout() { } $this->destination(); } + } @@ -229,7 +230,7 @@ public function testInitializeNoContentTypeWithMultipleAcceptedTypes() { $this->RequestHandler->initialize($this->Controller); $this->assertNull($this->RequestHandler->ext); } - + /** * Test that ext is not set with confusing android accepts headers. * @@ -292,7 +293,6 @@ public function testAutoResponseType() { $this->assertEquals($this->Controller->ext, '.ctp'); } - /** * testAutoAjaxLayout method * @@ -522,7 +522,7 @@ public function testRequestContentTypes() { $result = $this->RequestHandler->requestedWith(array('json', 'xml')); $this->assertEquals($result, 'json'); - $result =$this->RequestHandler->requestedWith(array('rss', 'atom')); + $result = $this->RequestHandler->requestedWith(array('rss', 'atom')); $this->assertFalse($result); $_SERVER['HTTP_ACCEPT'] = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,*/*'; @@ -711,7 +711,7 @@ public function testClientProperties() { */ public function testAjaxRedirectAsRequestAction() { App::build(array( - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS) + 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) ), App::RESET); $this->Controller->RequestHandler = $this->getMock('RequestHandlerComponent', array('_stop'), array(&$this->Controller->Components)); @@ -740,7 +740,7 @@ public function testAjaxRedirectAsRequestAction() { */ public function testAjaxRedirectAsRequestActionStillRenderingLayout() { App::build(array( - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS) + 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) ), App::RESET); $this->Controller->RequestHandler = $this->getMock('RequestHandlerComponent', array('_stop'), array(&$this->Controller->Components)); @@ -831,7 +831,7 @@ public function testAddInputTypeException() { public function testCheckNotModifiedByEtagStar() { $_SERVER['HTTP_IF_NONE_MATCH'] = '*'; $RequestHandler = $this->getMock('RequestHandlerComponent', array('_stop'), array(&$this->Controller->Components)); - $RequestHandler->response = $this->getMock('CakeResponse', array('notModified')); + $RequestHandler->response = $this->getMock('CakeResponse', array('notModified')); $RequestHandler->response->etag('something'); $RequestHandler->response->expects($this->once())->method('notModified'); $this->assertFalse($RequestHandler->beforeRender($this->Controller)); @@ -845,7 +845,7 @@ public function testCheckNotModifiedByEtagStar() { public function testCheckNotModifiedByEtagExact() { $_SERVER['HTTP_IF_NONE_MATCH'] = 'W/"something", "other"'; $RequestHandler = $this->getMock('RequestHandlerComponent', array('_stop'), array(&$this->Controller->Components)); - $RequestHandler->response = $this->getMock('CakeResponse', array('notModified')); + $RequestHandler->response = $this->getMock('CakeResponse', array('notModified')); $RequestHandler->response->etag('something', true); $RequestHandler->response->expects($this->once())->method('notModified'); $this->assertFalse($RequestHandler->beforeRender($this->Controller)); @@ -860,7 +860,7 @@ public function testCheckNotModifiedByEtagAndTime() { $_SERVER['HTTP_IF_NONE_MATCH'] = 'W/"something", "other"'; $_SERVER['HTTP_IF_MODIFIED_SINCE'] = '2012-01-01 00:00:00'; $RequestHandler = $this->getMock('RequestHandlerComponent', array('_stop'), array(&$this->Controller->Components)); - $RequestHandler->response = $this->getMock('CakeResponse', array('notModified')); + $RequestHandler->response = $this->getMock('CakeResponse', array('notModified')); $RequestHandler->response->etag('something', true); $RequestHandler->response->modified('2012-01-01 00:00:00'); $RequestHandler->response->expects($this->once())->method('notModified'); @@ -874,7 +874,7 @@ public function testCheckNotModifiedByEtagAndTime() { **/ public function testCheckNotModifiedNoInfo() { $RequestHandler = $this->getMock('RequestHandlerComponent', array('_stop'), array(&$this->Controller->Components)); - $RequestHandler->response = $this->getMock('CakeResponse', array('notModified')); + $RequestHandler->response = $this->getMock('CakeResponse', array('notModified')); $RequestHandler->response->expects($this->never())->method('notModified'); $this->assertNull($RequestHandler->beforeRender($this->Controller)); } diff --git a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php index ad4f4a93632..7f2763c8bed 100644 --- a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php @@ -21,10 +21,10 @@ App::uses('Controller', 'Controller'); /** -* TestSecurityComponent -* -* @package Cake.Test.Case.Controller.Component -*/ + * TestSecurityComponent + * + * @package Cake.Test.Case.Controller.Component + */ class TestSecurityComponent extends SecurityComponent { /** @@ -36,13 +36,14 @@ class TestSecurityComponent extends SecurityComponent { public function validatePost(Controller $controller) { return $this->_validatePost($controller); } + } /** -* SecurityTestController -* -* @package Cake.Test.Case.Controller.Component -*/ + * SecurityTestController + * + * @package Cake.Test.Case.Controller.Component + */ class SecurityTestController extends Controller { /** @@ -103,6 +104,7 @@ public function redirect($url, $status = null, $exit = true) { public function header($status) { $this->testHeaders[] = $status; } + } /** @@ -677,7 +679,6 @@ public function testValidatePostCheckbox() { $result = $this->Controller->Security->validatePost($this->Controller); $this->assertTrue($result); - $this->Controller->request->data = array(); $this->Controller->Security->startup($this->Controller); $key = $this->Controller->request->params['_Token']['key']; @@ -912,7 +913,6 @@ public function testValidateHasManyRecordsPass() { * @return void */ public function testValidateNestedNumericSets() { - $this->Controller->Security->startup($this->Controller); $key = $this->Controller->request->params['_Token']['key']; $unlocked = ''; @@ -1181,7 +1181,6 @@ public function testCsrfNonceVacuum() { $tokens = $this->Security->Session->read('_Token.csrfTokens'); $this->assertEquals(2, count($tokens), 'Too many tokens left behind'); $this->assertNotEmpty('valid', $tokens, 'Valid token was removed.'); - } /** @@ -1261,9 +1260,9 @@ public function testCsrfNotUseOnce() { $this->assertEquals(1, count($token), 'Should only be one token.'); $this->Security->startup($this->Controller); - $token2 = $this->Security->Session->read('_Token.csrfTokens'); - $this->assertEquals(1, count($token2), 'Should only be one token.'); - $this->assertEquals($token, $token2, 'Tokens should not be different.'); + $tokenTwo = $this->Security->Session->read('_Token.csrfTokens'); + $this->assertEquals(1, count($tokenTwo), 'Should only be one token.'); + $this->assertEquals($token, $tokenTwo, 'Tokens should not be different.'); $key = $this->Controller->request->params['_Token']['key']; $this->assertEquals(array($key), array_keys($token), '_Token.key and csrfToken do not match request will blackhole.'); diff --git a/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php b/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php index 3450212f871..06c14489875 100644 --- a/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php @@ -34,13 +34,14 @@ class SessionTestController extends Controller { public $uses = array(); /** - * session_id method + * sessionId method * * @return string */ - public function session_id() { + public function sessionId() { return $this->Session->id(); } + } /** @@ -58,13 +59,14 @@ class OrangeSessionTestController extends Controller { public $uses = array(); /** - * session_id method + * sessionId method * * @return string */ - public function session_id() { + public function sessionId() { return $this->Session->id(); } + } /** @@ -141,10 +143,10 @@ public function testSessionIdConsistentAcrossRequestAction() { $Session = new SessionComponent($this->ComponentCollection); $expected = $Session->id(); - $result = $Object->requestAction('/session_test/session_id'); + $result = $Object->requestAction('/session_test/sessionId'); $this->assertEquals($expected, $result); - $result = $Object->requestAction('/orange_session_test/session_id'); + $result = $Object->requestAction('/orange_session_test/sessionId'); $this->assertEquals($expected, $result); } diff --git a/lib/Cake/Test/Case/Controller/ComponentCollectionTest.php b/lib/Cake/Test/Case/Controller/ComponentCollectionTest.php index 6c776c8aaa0..1b0e41fa060 100644 --- a/lib/Cake/Test/Case/Controller/ComponentCollectionTest.php +++ b/lib/Cake/Test/Case/Controller/ComponentCollectionTest.php @@ -28,6 +28,7 @@ class CookieAliasComponent extends CookieComponent { } class ComponentCollectionTest extends CakeTestCase { + /** * setUp * diff --git a/lib/Cake/Test/Case/Controller/ComponentTest.php b/lib/Cake/Test/Case/Controller/ComponentTest.php index cf8d0b08cc9..0837ae04927 100644 --- a/lib/Cake/Test/Case/Controller/ComponentTest.php +++ b/lib/Cake/Test/Case/Controller/ComponentTest.php @@ -95,6 +95,7 @@ class AppleComponent extends Component { public function startup(Controller $controller) { $this->testName = $controller->name; } + } /** @@ -131,6 +132,7 @@ public function initialize(Controller $controller) { public function startup(Controller $controller) { $controller->foo = 'pass'; } + } /** @@ -156,6 +158,7 @@ class BananaComponent extends Component { public function startup(Controller $controller) { $controller->bar = 'fail'; } + } /** diff --git a/lib/Cake/Test/Case/Controller/ControllerTest.php b/lib/Cake/Test/Case/Controller/ControllerTest.php index 4345c40ad55..6f682e6db3e 100644 --- a/lib/Cake/Test/Case/Controller/ControllerTest.php +++ b/lib/Cake/Test/Case/Controller/ControllerTest.php @@ -25,6 +25,7 @@ * @package Cake.Test.Case.Controller */ class ControllerTestAppController extends Controller { + /** * helpers property * @@ -102,12 +103,13 @@ public function beforeFind($query) { */ public function find($type = 'first', $options = array()) { if ($type == 'popular') { - $conditions = array($this->name . '.' . $this->primaryKey .' > ' => '1'); + $conditions = array($this->name . '.' . $this->primaryKey . ' > ' => '1'); $options = Set::merge($options, compact('conditions')); return parent::find('all', $options); } return parent::find($type, $options); } + } /** @@ -262,14 +264,13 @@ class TestController extends ControllerTestAppController { * @param mixed $test2Id * @return void */ - public function index($testId, $test2Id) { + public function index($testId, $testTwoId) { $this->data = array( 'testId' => $testId, - 'test2Id' => $test2Id + 'test2Id' => $testTwoId ); } - /** * view method * @@ -277,10 +278,10 @@ public function index($testId, $test2Id) { * @param mixed $test2Id * @return void */ - public function view($testId, $test2Id) { + public function view($testId, $testTwoId) { $this->data = array( 'testId' => $testId, - 'test2Id' => $test2Id + 'test2Id' => $testTwoId ); } @@ -289,20 +290,17 @@ public function returner() { } protected function protected_m() { - } private function private_m() { - } public function _hidden() { - } public function admin_add() { - } + } /** @@ -311,6 +309,7 @@ public function admin_add() { * @package Cake.Test.Case.Controller */ class TestComponent extends Object { + /** * beforeRedirect method * @@ -353,14 +352,15 @@ public function beforeRender(Controller $controller) { $controller->viewClass = $this->viewclass; } } + } class Test2Component extends TestComponent { - public function beforeRender(Controller $controller) { return false; } + } /** @@ -555,11 +555,11 @@ public function testFlash() { '; $result = str_replace(array("\t", "\r\n", "\n"), "", $result); - $expected = str_replace(array("\t", "\r\n", "\n"), "", $expected); + $expected = str_replace(array("\t", "\r\n", "\n"), "", $expected); $this->assertEquals($expected, $result); App::build(array( - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS) + 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) )); $Controller = new Controller($request); $Controller->response = $this->getMock('CakeResponse', array('_sendHeader')); @@ -609,7 +609,6 @@ public function testControllerSet() { $Controller->set(array(1 => 'one', 2 => 'two')); $expected = array(3 => 'three', 4 => 'four', 1 => 'one', 2 => 'two'); $this->assertEquals($Controller->viewVars, $expected); - } /** @@ -619,7 +618,7 @@ public function testControllerSet() { */ public function testRender() { App::build(array( - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS) + 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) ), App::RESET); ClassRegistry::flush(); $request = new CakeRequest('controller_posts/index'); @@ -671,7 +670,7 @@ public function testRender() { public function testComponentBeforeRenderChangingViewClass() { App::build(array( 'View' => array( - CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS + CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS ) ), true); $Controller = new Controller($this->getMock('CakeRequest'), new CakeResponse()); @@ -700,7 +699,6 @@ public function testComponentCancelRender() { $this->assertInstanceOf('CakeResponse', $result); } - /** * testToBeInheritedGuardmethods method * @@ -911,20 +909,17 @@ public function testMergeVars() { $appVars = get_class_vars('ControllerTestAppController'); $testVars = get_class_vars('AnotherTestController'); - $this->assertTrue(in_array('ControllerPost', $appVars['uses'])); $this->assertFalse($testVars['uses']); $this->assertFalse(property_exists($TestController, 'ControllerPost')); - $TestController = new ControllerCommentsController($request); $TestController->constructClasses(); $appVars = get_class_vars('ControllerTestAppController'); $testVars = get_class_vars('ControllerCommentsController'); - $this->assertTrue(in_array('ControllerPost', $appVars['uses'])); $this->assertEquals(array('ControllerPost'), $testVars['uses']); @@ -1082,7 +1077,6 @@ public function testPostConditions() { $result = $Controller->postConditions($data); $this->assertSame($expected, $result); - $data = array(); $Controller->data = array( 'Model1' => array('field1' => '23'), @@ -1097,13 +1091,11 @@ public function testPostConditions() { $result = $Controller->postConditions($data); $this->assertSame($expected, $result); - $data = array(); $Controller->data = array(); $result = $Controller->postConditions($data); $this->assertNull($result); - $data = array(); $Controller->data = array( 'Model1' => array('field1' => '23'), @@ -1414,5 +1406,4 @@ public function testInvokeActionReturnValue() { $this->assertEquals('I am from the controller.', $result); } - } diff --git a/lib/Cake/Test/Case/Controller/PagesControllerTest.php b/lib/Cake/Test/Case/Controller/PagesControllerTest.php index cb42751f0dd..3a7391a53bf 100644 --- a/lib/Cake/Test/Case/Controller/PagesControllerTest.php +++ b/lib/Cake/Test/Case/Controller/PagesControllerTest.php @@ -34,7 +34,7 @@ class PagesControllerTest extends CakeTestCase { public function testDisplay() { App::build(array( 'View' => array( - CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS + CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS ) )); $Pages = new PagesController(new CakeRequest(null, false), new CakeResponse()); diff --git a/lib/Cake/Test/Case/Controller/ScaffoldTest.php b/lib/Cake/Test/Case/Controller/ScaffoldTest.php index cd2e45dd814..5473115ec83 100644 --- a/lib/Cake/Test/Case/Controller/ScaffoldTest.php +++ b/lib/Cake/Test/Case/Controller/ScaffoldTest.php @@ -76,6 +76,7 @@ public function beforeScaffold($method) { $this->set('scaffoldFields', array('title')); return true; } + } /** @@ -102,6 +103,7 @@ protected function _scaffold(CakeRequest $request) { public function getParams() { return $this->_params; } + } /** @@ -344,4 +346,5 @@ public function testEditScaffoldWithScaffoldFields() { $this->assertNotRegExp('/textarea name="data\[ScaffoldMock\]\[body\]" cols="30" rows="6" id="ScaffoldMockBody"/', $result); } + }