diff --git a/lib/Cake/Controller/Component.php b/lib/Cake/Controller/Component.php index 5736f5b33..b2fd49014 100644 --- a/lib/Cake/Controller/Component.php +++ b/lib/Cake/Controller/Component.php @@ -120,8 +120,8 @@ class Component extends Object { } /** - * Called after the Controller::beforeRender(), after the view class is loaded, and before the - * Controller::render() + * Called before the Controller::beforeRender(), and before + * the view class is loaded, and before Controller::render() * * @param Controller $controller Controller with components to beforeRender * @return void diff --git a/lib/Cake/Model/CakeSchema.php b/lib/Cake/Model/CakeSchema.php index 7bbf09679..1f8322fd1 100644 --- a/lib/Cake/Model/CakeSchema.php +++ b/lib/Cake/Model/CakeSchema.php @@ -484,7 +484,7 @@ class CakeSchema extends Object { if (!empty($old[$table][$field])) { $diff = $this->_arrayDiffAssoc($value, $old[$table][$field]); if (!empty($diff) && $field !== 'indexes' && $field !== 'tableParameters') { - $tables[$table]['change'][$field] = array_merge($old[$table][$field], $diff); + $tables[$table]['change'][$field] = $value; } } diff --git a/lib/Cake/Model/Datasource/Database/Mysql.php b/lib/Cake/Model/Datasource/Database/Mysql.php index cc3f5860c..5686798a7 100644 --- a/lib/Cake/Model/Datasource/Database/Mysql.php +++ b/lib/Cake/Model/Datasource/Database/Mysql.php @@ -297,7 +297,8 @@ class Mysql extends DboSource { * @throws CakeException */ public function describe($model) { - $cache = parent::describe($model); + $key = $this->fullTableName($model, false); + $cache = parent::describe($key); if ($cache != null) { return $cache; } @@ -331,7 +332,7 @@ class Mysql extends DboSource { } } } - $this->_cacheDescription($this->fullTableName($model, false), $fields); + $this->_cacheDescription($key, $fields); $cols->closeCursor(); return $fields; } diff --git a/lib/Cake/Model/Datasource/Database/Postgres.php b/lib/Cake/Model/Datasource/Database/Postgres.php index 0bc35d5c1..3aa1976b0 100644 --- a/lib/Cake/Model/Datasource/Database/Postgres.php +++ b/lib/Cake/Model/Datasource/Database/Postgres.php @@ -186,8 +186,8 @@ class Postgres extends DboSource { * @return array Fields in table. Keys are name and type */ public function describe($model) { - $fields = parent::describe($model); $table = $this->fullTableName($model, false, false); + $fields = parent::describe($table); $this->_sequenceMap[$table] = array(); $cols = null; diff --git a/lib/Cake/Model/Datasource/Database/Sqlite.php b/lib/Cake/Model/Datasource/Database/Sqlite.php index 3d2be70be..e60f128a8 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlite.php +++ b/lib/Cake/Model/Datasource/Database/Sqlite.php @@ -160,11 +160,11 @@ class Sqlite extends DboSource { * @return array Fields in table. Keys are name and type */ public function describe($model) { - $cache = parent::describe($model); + $table = $this->fullTableName($model, false, false); + $cache = parent::describe($table); if ($cache != null) { return $cache; } - $table = $this->fullTableName($model, false, false); $fields = array(); $result = $this->_execute('PRAGMA table_info(' . $table . ')'); diff --git a/lib/Cake/Model/Datasource/Database/Sqlserver.php b/lib/Cake/Model/Datasource/Database/Sqlserver.php index 392a30ea6..1081d1609 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlserver.php +++ b/lib/Cake/Model/Datasource/Database/Sqlserver.php @@ -201,7 +201,8 @@ class Sqlserver extends DboSource { * @throws CakeException */ public function describe($model) { - $cache = parent::describe($model); + $table = $this->fullTableName($model, false); + $cache = parent::describe($table); if ($cache != null) { return $cache; } diff --git a/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php b/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php index b88a33ad1..d11e83208 100644 --- a/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php @@ -168,6 +168,7 @@ class DbAclTwoTest extends DbAcl { $this->Permission->Aro = $this->Aro; $this->Permission->Aco = $this->Aco; } + } /** @@ -176,6 +177,7 @@ class DbAclTwoTest extends DbAcl { * @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 5fd20c70a..bfdf8ce67 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 @@ class IniAclTest extends CakeTestCase { * @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 2e6c63243..747767657 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 @@ class PhpAclTest extends CakeTestCase { $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 @@ class PhpAclTest extends CakeTestCase { $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 @@ class PhpAclTest extends CakeTestCase { $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 @@ class PhpAclTest extends CakeTestCase { $this->Acl->Aro->aliases = array( 'Role/1' => 'Role/admin', - 'Role/24' => 'Role/accounting', + 'Role/24' => 'Role/accounting', ); $user = array( @@ -127,12 +124,11 @@ class PhpAclTest extends CakeTestCase { $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 @@ class PhpAclTest extends CakeTestCase { $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 @@ class PhpAclTest extends CakeTestCase { $this->assertFalse($this->Acl->check('role/accounting', 'controllers/articles/publish')); } - /** * lhs of defined rules are case insensitive */ @@ -195,7 +190,6 @@ class PhpAclTest extends CakeTestCase { $this->assertTrue($this->Acl->check('Role/data_acquirer', 'controllers/FORMS/NEW')); } - /** * allow should work in-memory */ @@ -216,7 +210,6 @@ class PhpAclTest extends CakeTestCase { $this->assertFalse($this->Acl->check('Role/reports', 'foo/bar')); } - /** * deny should work in-memory */ @@ -231,11 +224,10 @@ class PhpAclTest extends CakeTestCase { $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 @@ class PhpAclTest extends CakeTestCase { $this->assertFalse($this->Acl->check('stan', 'controllers/reports/delete')); } - /** * test that an invalid configuration throws exception */ @@ -269,7 +260,6 @@ class PhpAclTest extends CakeTestCase { $this->PhpAcl->build($config); } - public function testInvalidConfigWithAcosMissing() { $this->setExpectedException( 'AclException', @@ -291,7 +281,7 @@ class PhpAclTest extends CakeTestCase { $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 @@ class PhpAclTest extends CakeTestCase { '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 cfdcf6623..c43d1ee68 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 78611d098..c295f5315 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('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 BasicAuthentication diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/CrudAuthorizeTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/CrudAuthorizeTest.php index 25625bb65..52953d1dc 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 @@ class CrudAuthorizeTest extends CakeTestCase { $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 3523185b6..856c6e749 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('AppModel', 'Model'); 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 5463c4e44..ca07623a0 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('AppModel', 'Model'); 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 695d45aac..9e7c7c59a 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('AclComponent', 'Controller/Component'); 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 @@ class TestAuthComponent extends AuthComponent { } /** -* 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 @@ class AuthTestController extends Controller { * @return void */ public function logout() { - } /** @@ -195,7 +194,6 @@ class AuthTestController extends Controller { * @return void */ public function isAuthorized() { - } } @@ -269,14 +267,15 @@ class AjaxAuthController extends Controller { $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 @@ class AuthComponentTest extends CakeTestCase { */ 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 @@ class AuthComponentTest extends CakeTestCase { $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 80d7ee59f..1796454ab 100644 --- a/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php @@ -49,6 +49,7 @@ class CookieComponentTestController extends Controller { $this->Cookie->secure = false; $this->Cookie->key = 'somerandomhaskey'; } + } /** @@ -191,7 +192,7 @@ class CookieComponentTest extends CakeTestCase { $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 @@ class CookieComponentTest extends CakeTestCase { $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 @@ class CookieComponentTest extends CakeTestCase { $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 @@ class CookieComponentTest extends CakeTestCase { $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 6c9c05dd4..3a22eb67c 100644 --- a/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php @@ -160,7 +160,7 @@ class EmailComponentTest extends CakeTestCase { 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 @@ HTMLBLOC; "\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 @@ HTMLBLOC; */ 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 @@ HTMLBLOC; */ 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 @@ HTMLBLOC; */ 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 @@ HTMLBLOC; * * @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 @@ HTMLBLOC; 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 @@ HTMLBLOC; $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 d598a7c31..5b0acfb91 100644 --- a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php @@ -30,6 +30,7 @@ App::uses('CakeResponse', 'Network'); * @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 @@ class PaginatorControllerPost extends CakeTestModel { */ 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 @@ class ControllerPaginateModel extends CakeTestModel { public function paginateCount($conditions, $recursive, $extra) { $this->extraCount = $extra; } + } /** @@ -942,7 +938,7 @@ class PaginatorComponentTest extends CakeTestCase { $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 e0c6b10cf..0907c6e8c 100644 --- a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php @@ -67,6 +67,7 @@ class RequestHandlerTestController extends Controller { } $this->destination(); } + } @@ -229,7 +230,7 @@ class RequestHandlerComponentTest extends CakeTestCase { $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 @@ class RequestHandlerComponentTest extends CakeTestCase { $this->assertEquals($this->Controller->ext, '.ctp'); } - /** * testAutoAjaxLayout method * @@ -522,7 +522,7 @@ class RequestHandlerComponentTest extends CakeTestCase { $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 @@ class RequestHandlerComponentTest extends CakeTestCase { */ 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 @@ class RequestHandlerComponentTest extends CakeTestCase { */ 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 @@ class RequestHandlerComponentTest extends CakeTestCase { 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 @@ class RequestHandlerComponentTest extends CakeTestCase { 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 @@ class RequestHandlerComponentTest extends CakeTestCase { $_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 @@ class RequestHandlerComponentTest extends CakeTestCase { **/ 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 ad4f4a936..7f2763c8b 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('SecurityComponent', 'Controller/Component'); 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 @@ class SecurityTestController extends Controller { public function header($status) { $this->testHeaders[] = $status; } + } /** @@ -677,7 +679,6 @@ class SecurityComponentTest extends CakeTestCase { $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 @@ class SecurityComponentTest extends CakeTestCase { * @return void */ public function testValidateNestedNumericSets() { - $this->Controller->Security->startup($this->Controller); $key = $this->Controller->request->params['_Token']['key']; $unlocked = ''; @@ -1181,7 +1181,6 @@ class SecurityComponentTest extends CakeTestCase { $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 @@ class SecurityComponentTest extends CakeTestCase { $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 3450212f8..06c144898 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 @@ class SessionComponentTest extends CakeTestCase { $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 6c776c8aa..1b0e41fa0 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 cf8d0b08c..0837ae049 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 @@ class OrangeComponent extends Component { 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 4345c40ad..6f682e6db 100644 --- a/lib/Cake/Test/Case/Controller/ControllerTest.php +++ b/lib/Cake/Test/Case/Controller/ControllerTest.php @@ -25,6 +25,7 @@ App::uses('CookieComponent', 'Controller/Component'); * @package Cake.Test.Case.Controller */ class ControllerTestAppController extends Controller { + /** * helpers property * @@ -102,12 +103,13 @@ class ControllerPost extends CakeTestModel { */ 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 @@ class TestController extends ControllerTestAppController { * @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 @@ class TestController extends ControllerTestAppController { } protected function protected_m() { - } private function private_m() { - } public function _hidden() { - } public function admin_add() { - } + } /** @@ -311,6 +309,7 @@ class TestController extends ControllerTestAppController { * @package Cake.Test.Case.Controller */ class TestComponent extends Object { + /** * beforeRedirect method * @@ -353,14 +352,15 @@ class TestComponent extends Object { $controller->viewClass = $this->viewclass; } } + } class Test2Component extends TestComponent { - public function beforeRender(Controller $controller) { return false; } + } /** @@ -555,11 +555,11 @@ class ControllerTest extends CakeTestCase {