From 8473d6a66093d44e2067865cc9ba3a2a6af76bf5 Mon Sep 17 00:00:00 2001 From: ADmad Date: Wed, 26 Oct 2011 13:00:52 +0530 Subject: [PATCH 01/43] Fixed code formatting --- lib/Cake/Controller/Controller.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index e6069e9ef..1303b7cc6 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -878,7 +878,8 @@ class Controller extends Object { list($plugin, $className) = pluginSplit($model); $this->request->params['models'][$className] = compact('plugin', 'className'); } - } if (!empty($this->modelClass) && ($this->uses === false || $this->uses === array())) { + } + if (!empty($this->modelClass) && ($this->uses === false || $this->uses === array())) { $this->request->params['models'][$this->modelClass] = array('plugin' => $this->plugin, 'className' => $this->modelClass); } From 1244656595618b4a6b0e52d6742e32b5d74ffd23 Mon Sep 17 00:00:00 2001 From: ADmad Date: Mon, 24 Oct 2011 00:33:29 +0530 Subject: [PATCH 02/43] Prevent unneeded afterFind callback triggering on associated models. Fixes #2057 --- lib/Cake/Model/Datasource/DboSource.php | 17 +++- .../Model/Datasource/Database/MysqlTest.php | 5 +- lib/Cake/Test/Case/Model/ModelReadTest.php | 89 +++++++++++++++++++ 3 files changed, 105 insertions(+), 6 deletions(-) diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 470683b64..ad50625ef 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -990,7 +990,7 @@ class DboSource extends DataSource { $queryData = $this->_scrubQueryData($queryData); $null = null; - $array = array(); + $array = array('callbacks' => $queryData['callbacks']); $linkedModels = array(); $bypass = false; @@ -1043,7 +1043,11 @@ class DboSource extends DataSource { return false; } - $filtered = $this->_filterResults($resultSet, $model); + $filtered = array(); + + if ($queryData['callbacks'] === true || $queryData['callbacks'] === 'after') { + $filtered = $this->_filterResults($resultSet, $model); + } if ($model->recursive > -1) { foreach ($_associations as $type) { @@ -1071,7 +1075,9 @@ class DboSource extends DataSource { } } } - $this->_filterResults($resultSet, $model, $filtered); + if ($queryData['callbacks'] === true || $queryData['callbacks'] === 'after') { + $this->_filterResults($resultSet, $model, $filtered); + } } if (!is_null($recursive)) { @@ -1162,7 +1168,9 @@ class DboSource extends DataSource { } } } - $this->_filterResults($fetch, $model); + if ($queryData['callbacks'] === true || $queryData['callbacks'] === 'after') { + $this->_filterResults($fetch, $model); + } return $this->_mergeHasMany($resultSet, $fetch, $association, $model, $linkModel); } elseif ($type === 'hasAndBelongsToMany') { $ins = $fetch = array(); @@ -2093,6 +2101,7 @@ class DboSource extends DataSource { static $base = null; if ($base === null) { $base = array_fill_keys(array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group'), array()); + $base['callbacks'] = null; } return (array)$data + $base; } diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php index 4d2362294..2f0c37060 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php @@ -1002,7 +1002,8 @@ class MysqlTest extends CakeTestCase { 'order' => array(), 'limit' => array(), 'offset' => array(), - 'group' => array() + 'group' => array(), + 'callbacks' => null ); $queryData['joins'][0]['table'] = $this->Dbo->fullTableName($queryData['joins'][0]['table']); $this->assertEqual($queryData, $expected); @@ -2554,7 +2555,7 @@ class MysqlTest extends CakeTestCase { */ public function testDropSchemaNoSchema() { $result = $this->Dbo->dropSchema(null); - } + } /** * testOrderParsing method diff --git a/lib/Cake/Test/Case/Model/ModelReadTest.php b/lib/Cake/Test/Case/Model/ModelReadTest.php index 3d94bc45d..3af3fde7f 100644 --- a/lib/Cake/Test/Case/Model/ModelReadTest.php +++ b/lib/Cake/Test/Case/Model/ModelReadTest.php @@ -4933,6 +4933,95 @@ class ModelReadTest extends BaseModelTest { $this->assertEqual($expected, $result); } +/** + * testAssociationAfterFindCallbacksDisabled method + * + * @return void + */ + public function testAssociationAfterFindCalbacksDisabled() { + $this->loadFixtures('Post', 'Author', 'Comment'); + $TestModel = new Post(); + $result = $TestModel->find('all', array('callbacks' => false)); + $expected = array( + array( + 'Post' => array( + 'id' => '1', + 'author_id' => '1', + 'title' => 'First Post', + 'body' => 'First Post Body', + 'published' => 'Y', + 'created' => '2007-03-18 10:39:23', + 'updated' => '2007-03-18 10:41:31' + ), + 'Author' => array( + 'id' => '1', + 'user' => 'mariano', + 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', + 'created' => '2007-03-17 01:16:23', + 'updated' => '2007-03-17 01:18:31' + )), + array( + 'Post' => array( + 'id' => '2', + 'author_id' => '3', + 'title' => 'Second Post', + 'body' => 'Second Post Body', + 'published' => 'Y', + 'created' => '2007-03-18 10:41:23', + 'updated' => '2007-03-18 10:43:31' + ), + 'Author' => array( + 'id' => '3', + 'user' => 'larry', + 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', + 'created' => '2007-03-17 01:20:23', + 'updated' => '2007-03-17 01:22:31' + )), + array( + 'Post' => array( + 'id' => '3', + 'author_id' => '1', + 'title' => 'Third Post', + 'body' => 'Third Post Body', + 'published' => 'Y', + 'created' => '2007-03-18 10:43:23', + 'updated' => '2007-03-18 10:45:31' + ), + 'Author' => array( + 'id' => '1', + 'user' => 'mariano', + 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', + 'created' => '2007-03-17 01:16:23', + 'updated' => '2007-03-17 01:18:31' + ))); + $this->assertEqual($expected, $result); + unset($TestModel); + + $Author = new Author(); + $Author->Post->bindModel(array( + 'hasMany' => array( + 'Comment' => array( + 'className' => 'ModifiedComment', + 'foreignKey' => 'article_id', + ) + ))); + $result = $Author->find('all', array( + 'conditions' => array('Author.id' => 1), + 'recursive' => 2, + 'callbacks' => false + )); + $expected = array( + 'id' => 1, + 'article_id' => 1, + 'user_id' => 2, + 'comment' => 'First Comment for First Article', + 'published' => 'Y', + 'created' => '2007-03-18 10:45:23', + 'updated' => '2007-03-18 10:47:31' + ); + $this->assertEqual($result[0]['Post'][0]['Comment'][0], $expected); + } + /** * Tests that the database configuration assigned to the model can be changed using * (before|after)Find callbacks From 5246e7dd1da92ae8a2959ff5a0d5349ac47c7f57 Mon Sep 17 00:00:00 2001 From: Daniel Luiz Pakuschewski Date: Wed, 26 Oct 2011 22:07:17 -0200 Subject: [PATCH 03/43] Allow AuthComponent to deny all actions with single deny() or deny('*') --- .../Controller/Component/AuthComponent.php | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index f099cd3ce..a1dae987f 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -461,16 +461,20 @@ class AuthComponent extends Component { */ public function deny($action = null) { $args = func_get_args(); - if (isset($args[0]) && is_array($args[0])) { - $args = $args[0]; - } - foreach ($args as $arg) { - $i = array_search($arg, $this->allowedActions); - if (is_int($i)) { - unset($this->allowedActions[$i]); + if(empty($args) || $args == array('*')){ + $this->allowedActions = array(); + }else{ + if (isset($args[0]) && is_array($args[0])) { + $args = $args[0]; } + foreach ($args as $arg) { + $i = array_search($arg, $this->allowedActions); + if (is_int($i)) { + unset($this->allowedActions[$i]); + } + } + $this->allowedActions = array_values($this->allowedActions); } - $this->allowedActions = array_values($this->allowedActions); } /** From 8738ef3dc2ad04f54d4fbaaba9f10770773a0b0c Mon Sep 17 00:00:00 2001 From: Daniel Luiz Pakuschewski Date: Wed, 26 Oct 2011 22:07:57 -0200 Subject: [PATCH 04/43] Added tests to deny() and deny('*') --- .../Component/AuthComponentTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index c82aeb347..fa718f11c 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -636,6 +636,25 @@ class AuthComponentTest extends CakeTestCase { $this->Controller->request['action'] = 'camelCase'; $this->assertFalse($this->Controller->Auth->startup($this->Controller)); + + $this->Controller->Auth->allow('*'); + $this->Controller->Auth->deny('*'); + + $this->Controller->request['action'] = 'camelCase'; + $this->assertFalse($this->Controller->Auth->startup($this->Controller)); + + $this->Controller->request['action'] = 'add'; + $this->assertFalse($this->Controller->Auth->startup($this->Controller)); + + $this->Controller->Auth->allow('camelCase'); + $this->Controller->Auth->deny(); + + $this->Controller->request['action'] = 'camelCase'; + $this->assertFalse($this->Controller->Auth->startup($this->Controller)); + + $this->Controller->request['action'] = 'login'; + $this->assertFalse($this->Controller->Auth->startup($this->Controller)); + } /** From 010abd9e189cc37cbea2ce3a294aa4304ad6e669 Mon Sep 17 00:00:00 2001 From: m Date: Wed, 26 Oct 2011 14:39:04 +0200 Subject: [PATCH 05/43] Inheritance fix for CakeTestCase Fix overriden methods to be static like other methods in PHPUnit_Framework_Assert. Fixes #2170 Signed-off-by: mark_story --- lib/Cake/TestSuite/CakeTestCase.php | 36 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/Cake/TestSuite/CakeTestCase.php b/lib/Cake/TestSuite/CakeTestCase.php index e986abb08..dfdac30fb 100644 --- a/lib/Cake/TestSuite/CakeTestCase.php +++ b/lib/Cake/TestSuite/CakeTestCase.php @@ -387,8 +387,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { * @param string $message the text to display if the assertion is not correct * @return void */ - protected function assertEqual($result, $expected, $message = '') { - return $this->assertEquals($expected, $result, $message); + protected static function assertEqual($result, $expected, $message = '') { + return self::assertEquals($expected, $result, $message); } /** @@ -399,8 +399,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { * @param string $message the text to display if the assertion is not correct * @return void */ - protected function assertNotEqual($result, $expected, $message = '') { - return $this->assertNotEquals($expected, $result, $message); + protected static function assertNotEqual($result, $expected, $message = '') { + return self::assertNotEquals($expected, $result, $message); } /** @@ -411,8 +411,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { * @param string $message the text to display if the assertion is not correct * @return void */ - protected function assertPattern($pattern, $string, $message = '') { - return $this->assertRegExp($pattern, $string, $message); + protected static function assertPattern($pattern, $string, $message = '') { + return self::assertRegExp($pattern, $string, $message); } /** @@ -423,8 +423,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { * @param string $message the text to display if the assertion is not correct * @return void */ - protected function assertIdentical($actual, $expected, $message = '') { - return $this->assertSame($expected, $actual, $message); + protected static function assertIdentical($actual, $expected, $message = '') { + return self::assertSame($expected, $actual, $message); } /** @@ -435,8 +435,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { * @param string $message the text to display if the assertion is not correct * @return void */ - protected function assertNotIdentical($actual, $expected, $message = '') { - return $this->assertNotSame($expected, $actual, $message); + protected static function assertNotIdentical($actual, $expected, $message = '') { + return self::assertNotSame($expected, $actual, $message); } /** @@ -447,8 +447,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { * @param string $message the text to display if the assertion is not correct * @return void */ - protected function assertNoPattern($pattern, $string, $message = '') { - return $this->assertNotRegExp($pattern, $string, $message); + protected static function assertNoPattern($pattern, $string, $message = '') { + return self::assertNotRegExp($pattern, $string, $message); } protected function assertNoErrors() { @@ -487,8 +487,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { * @param string $message the text to display if the assertion is not correct * @return void */ - protected function assertReference(&$first, &$second, $message = '') { - return $this->assertSame($first, $second, $message); + protected static function assertReference(&$first, &$second, $message = '') { + return self::assertSame($first, $second, $message); } /** @@ -499,8 +499,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { * @param string $message * @return void */ - protected function assertIsA($object, $type, $message = '') { - return $this->assertInstanceOf($type, $object, $message); + protected static function assertIsA($object, $type, $message = '') { + return self::assertInstanceOf($type, $object, $message); } /** @@ -512,10 +512,10 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { * @param string $message the text to display if the assertion is not correct * @return void */ - protected function assertWithinMargin($result, $expected, $margin, $message = '') { + protected static function assertWithinMargin($result, $expected, $margin, $message = '') { $upper = $result + $margin; $lower = $result - $margin; - $this->assertTrue((($expected <= $upper) && ($expected >= $lower)), $message); + return self::assertTrue((($expected <= $upper) && ($expected >= $lower)), $message); } /** From 43df8d34e7e4d2dce803dda3aa3b54c0f5a08808 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 26 Oct 2011 21:17:20 -0400 Subject: [PATCH 06/43] Use String::tokenize() to split up fields. It is slightly more intelligent than explode() Solves basic problems in Sqlite with virtualFields. Fixes #2163 --- lib/Cake/Model/Datasource/Database/Sqlite.php | 3 ++- .../Model/Datasource/Database/SqliteTest.php | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/Database/Sqlite.php b/lib/Cake/Model/Datasource/Database/Sqlite.php index b97a2d849..c06f0ed87 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlite.php +++ b/lib/Cake/Model/Datasource/Database/Sqlite.php @@ -18,6 +18,7 @@ */ App::uses('DboSource', 'Model/Datasource'); +App::uses('String', 'Utility'); /** * DBO implementation for the SQLite3 DBMS. @@ -281,7 +282,7 @@ class Sqlite extends DboSource { $last = strripos($querystring, 'FROM'); if ($last !== false) { $selectpart = substr($querystring, 7, $last - 8); - $selects = explode(',', $selectpart); + $selects = String::tokenize($selectpart, ',', '(', ')'); } } elseif (strpos($querystring, 'PRAGMA table_info') === 0) { $selects = array('cid', 'name', 'type', 'notnull', 'dflt_value', 'pk'); diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php index 979ff3a21..43f9f8ec3 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php @@ -20,6 +20,8 @@ App::uses('Model', 'Model'); App::uses('AppModel', 'Model'); App::uses('Sqlite', 'Model/Datasource/Database'); +require_once dirname(dirname(dirname(__FILE__))) . DS . 'models.php'; + /** * DboSqliteTestDb class * @@ -88,6 +90,7 @@ class SqliteTest extends CakeTestCase { * */ public function setUp() { + parent::setUp(); Configure::write('Cache.disable', true); $this->Dbo = ConnectionManager::getDataSource('test'); if (!$this->Dbo instanceof Sqlite) { @@ -100,6 +103,7 @@ class SqliteTest extends CakeTestCase { * */ public function tearDown() { + parent::tearDown(); Configure::write('Cache.disable', false); } @@ -318,4 +322,20 @@ class SqliteTest extends CakeTestCase { $this->assertEqual($result['id'], $expected); $this->Dbo->query('DROP TABLE ' . $tableName); } + +/** + * Test virtualFields with functions. + * + * @return void + */ + public function testVirtualFieldWithFunction() { + $this->loadFixtures('User'); + $User = ClassRegistry::init('User'); + $User->virtualFields = array('name' => 'SUBSTR(User.user, 5)'); + + $result = $User->find('first', array( + 'conditions' => array('User.user' => 'garrett') + )); + $this->assertEquals('ett', $result['User']['name']); + } } From ee7f41708533d91ea92ff66f2bcd8969040fea5a Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Wed, 26 Oct 2011 21:29:04 -0430 Subject: [PATCH 07/43] Test to disprove #2123, it is possible to load classes in plugin's Lib directory. App::uses() is intended for classes not procedural files. --- lib/Cake/Test/Case/Core/AppTest.php | 16 ++++++++++++++++ .../TestPlugin/Lib/TestPluginOtherLibrary.php | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/TestPluginOtherLibrary.php diff --git a/lib/Cake/Test/Case/Core/AppTest.php b/lib/Cake/Test/Case/Core/AppTest.php index 3520fd461..4c0e9c3ce 100644 --- a/lib/Cake/Test/Case/Core/AppTest.php +++ b/lib/Cake/Test/Case/Core/AppTest.php @@ -794,4 +794,20 @@ class AppTest extends CakeTestCase { $this->assertArrayHasKey('Controller', $result); $this->assertArrayHasKey('Controller/Component', $result); } + +/** + * Proves that it is possible to load plugin libraries in top + * level Lib dir for plugins + * + * @return void + */ + public function testPluginLibClasses() { + App::build(array( + 'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) + ), App::RESET); + CakePlugin::loadAll(); + $this->assertFalse(class_exists('TestPluginOtherLibrary', false)); + App::uses('TestPluginOtherLibrary', 'TestPlugin.Lib'); + $this->assertTrue(class_exists('TestPluginOtherLibrary')); + } } diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/TestPluginOtherLibrary.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/TestPluginOtherLibrary.php new file mode 100644 index 000000000..9df2508a2 --- /dev/null +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/TestPluginOtherLibrary.php @@ -0,0 +1,19 @@ + + * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice + * + * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests + * @package Cake.Test.test_app.Plugin.TestPlugin.Lib + * @since CakePHP(tm) v 2.0.1 + * @license MIT License (http://www.opensource.org/licenses/mit-license.php) + */ +class TestPluginOtherLibrary {} From 24fd87398df41f9c4751cc1f1013862a4b59335d Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 26 Oct 2011 23:46:15 -0400 Subject: [PATCH 08/43] Fix issue with 0.Model.field inputs. These inputs would be incorrectly prefixed with another Model name. --- lib/Cake/Test/Case/View/HelperTest.php | 15 ++++++++++++++- lib/Cake/View/Helper.php | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Test/Case/View/HelperTest.php b/lib/Cake/Test/Case/View/HelperTest.php index 9f1365209..11335da17 100644 --- a/lib/Cake/Test/Case/View/HelperTest.php +++ b/lib/Cake/Test/Case/View/HelperTest.php @@ -255,7 +255,7 @@ class HelperTest extends CakeTestCase { */ public function testSetEntityScoped() { $this->Helper->setEntity('HelperTestPost', true); - $this->assertEquals(array('HelperTestPost'), $this->Helper->entity()); + $this->assertEquals(array('HelperTestPost'), $this->Helper->entity()); $this->Helper->setEntity('id'); $expected = array('HelperTestPost', 'id'); @@ -310,6 +310,19 @@ class HelperTest extends CakeTestCase { $this->assertEquals('HelperTestComment', $this->Helper->model()); } +/** + * Test creating saveMany() compatible entities + * + * @return void + */ + public function testSetEntitySaveMany() { + $this->Helper->setEntity('HelperTestPost', true); + + $this->Helper->setEntity('0.HelperTestPost.id'); + $expected = array('0', 'HelperTestPost', 'id'); + $this->assertEquals($expected, $this->Helper->entity()); + } + /** * Test that setEntity doesn't make CamelCase fields that are not associations an * associated model. diff --git a/lib/Cake/View/Helper.php b/lib/Cake/View/Helper.php index c2219be89..91fafae3b 100644 --- a/lib/Cake/View/Helper.php +++ b/lib/Cake/View/Helper.php @@ -444,9 +444,9 @@ class Helper extends Object { $entity = $this->_modelScope . '.' . $entity; } - // 0.name, 0.created.month style inputs. + // 0.name, 0.created.month style inputs. Excludes inputs with the modelScope in them. if ( - $count >= 2 && is_numeric($parts[0]) && !is_numeric($parts[1]) && $this->_modelScope + $count >= 2 && is_numeric($parts[0]) && !is_numeric($parts[1]) && $this->_modelScope && strpos($entity, $this->_modelScope) === false ) { $entity = $this->_modelScope . '.' . $entity; } From 24bb6663abd297072af893d749bb6951c40de4b5 Mon Sep 17 00:00:00 2001 From: Daniel Luiz Pakuschewski Date: Thu, 27 Oct 2011 10:10:57 -0200 Subject: [PATCH 09/43] Fixed typo --- lib/Cake/View/View.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php index c982f7165..1d9b54a64 100644 --- a/lib/Cake/View/View.php +++ b/lib/Cake/View/View.php @@ -136,7 +136,7 @@ class View extends Object { /** * Sub-directory for this view file. This is often used for extension based routing. - * for example with an `xml` extension, $subDir would be `xml/` + * Eg. With an `xml` extension, $subDir would be `xml/` * * @var string */ @@ -158,7 +158,7 @@ class View extends Object { public $cacheAction = false; /** - * holds current errors for the model validation + * Holds current errors for the model validation. * * @var array */ @@ -172,7 +172,7 @@ class View extends Object { public $hasRendered = false; /** - * List of generated DOM UUIDs + * List of generated DOM UUIDs. * * @var array */ @@ -205,7 +205,7 @@ class View extends Object { public $elementCache = 'default'; /** - * List of variables to collect from the associated controller + * List of variables to collect from the associated controller. * * @var array */ @@ -215,7 +215,7 @@ class View extends Object { ); /** - * Scripts (and/or other tags) for the layout + * Scripts (and/or other tags) for the layout. * * @var array */ @@ -229,7 +229,7 @@ class View extends Object { protected $_paths = array(); /** - * boolean to indicate that helpers have been loaded. + * Indicate that helpers have been loaded. * * @var boolean */ @@ -238,7 +238,7 @@ class View extends Object { /** * Constructor * - * @param Controller $controller A controller object to pull View::__passedArgs from. + * @param Controller $controller A controller object to pull View::_passedArgs from. */ public function __construct($controller) { if (is_object($controller)) { @@ -337,7 +337,7 @@ class View extends Object { * Renders view for given view file and layout. * * Render triggers helper callbacks, which are fired before and after the view are rendered, - * as well as before and after the layout. The helper callbacks are called + * as well as before and after the layout. The helper callbacks are called: * * - `beforeRender` * - `afterRender` From eb6c07f77e343359224a7b02654313aaa4d43b82 Mon Sep 17 00:00:00 2001 From: Daniel Luiz Pakuschewski Date: Thu, 27 Oct 2011 10:16:38 -0200 Subject: [PATCH 10/43] Fixed: _passedArgs now is _passedVars --- lib/Cake/View/View.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php index 1d9b54a64..eb4a6695c 100644 --- a/lib/Cake/View/View.php +++ b/lib/Cake/View/View.php @@ -238,7 +238,7 @@ class View extends Object { /** * Constructor * - * @param Controller $controller A controller object to pull View::_passedArgs from. + * @param Controller $controller A controller object to pull View::_passedVars from. */ public function __construct($controller) { if (is_object($controller)) { From 53be552370878efbf99ecec9b04428eb08f38cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renan=20Gonc=CC=A7alves?= Date: Thu, 27 Oct 2011 16:01:36 +0200 Subject: [PATCH 11/43] Fixing use of options['exclude'] in Debugger::trace(), tests added. --- lib/Cake/Test/Case/Utility/DebuggerTest.php | 17 ++++++++++++++++- lib/Cake/Utility/Debugger.php | 14 +++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/lib/Cake/Test/Case/Utility/DebuggerTest.php b/lib/Cake/Test/Case/Utility/DebuggerTest.php index 922644cc0..9ddbe7692 100644 --- a/lib/Cake/Test/Case/Utility/DebuggerTest.php +++ b/lib/Cake/Test/Case/Utility/DebuggerTest.php @@ -403,7 +403,7 @@ class DebuggerTest extends CakeTestCase { * * @return void */ - function testNoDbCredentials() { + public function testNoDbCredentials() { $config = array( 'driver' => 'mysql', 'persistent' => false, @@ -429,4 +429,19 @@ class DebuggerTest extends CakeTestCase { $this->assertEqual($expected, $output); } + +/** + * test trace exclude + * + * @return void + */ + public function testTraceExclude() { + $result = Debugger::trace(); + $this->assertPattern('/^DebuggerTest::testTraceExclude/', $result); + + $result = Debugger::trace(array( + 'exclude' => array('DebuggerTest::testTraceExclude') + )); + $this->assertNoPattern('/^DebuggerTest::testTraceExclude/', $result); + } } diff --git a/lib/Cake/Utility/Debugger.php b/lib/Cake/Utility/Debugger.php index c6dd573ab..54ae3d5cf 100644 --- a/lib/Cake/Utility/Debugger.php +++ b/lib/Cake/Utility/Debugger.php @@ -285,9 +285,9 @@ class Debugger { 'args' => false, 'start' => 0, 'scope' => null, - 'exclude' => null + 'exclude' => array('call_user_func_array', 'trigger_error') ); - $options += $defaults; + $options = Set::merge($defaults, $options); $backtrace = debug_backtrace(); $count = count($backtrace); @@ -302,13 +302,15 @@ class Debugger { for ($i = $options['start']; $i < $count && $i < $options['depth']; $i++) { $trace = array_merge(array('file' => '[internal]', 'line' => '??'), $backtrace[$i]); + $signature = $reference = '[main]'; if (isset($backtrace[$i + 1])) { $next = array_merge($_trace, $backtrace[$i + 1]); - $reference = $next['function']; + $signature = $reference = $next['function']; if (!empty($next['class'])) { - $reference = $next['class'] . '::' . $reference . '('; + $signature = $next['class'] . '::' . $next['function']; + $reference = $signature . '('; if ($options['args'] && isset($next['args'])) { $args = array(); foreach ($next['args'] as $arg) { @@ -318,10 +320,8 @@ class Debugger { } $reference .= ')'; } - } else { - $reference = '[main]'; } - if (in_array($reference, array('call_user_func_array', 'trigger_error'))) { + if (in_array($signature, $options['exclude'])) { continue; } if ($options['format'] == 'points' && $trace['file'] != '[internal]') { From 8529d76e6f7d0f20ec1bf8c754aa6423e917f62a Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 27 Oct 2011 20:58:03 -0400 Subject: [PATCH 12/43] Removing Xml prolog from default xml layouts. Both DOMDocument and SimpleXML output the prolog when saving xml. Fixes #2171 --- lib/Cake/Console/Templates/skel/View/Layouts/xml/default.ctp | 1 - lib/Cake/View/Layouts/xml/default.ctp | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/Cake/Console/Templates/skel/View/Layouts/xml/default.ctp b/lib/Cake/Console/Templates/skel/View/Layouts/xml/default.ctp index 1025a55f5..27f20316b 100644 --- a/lib/Cake/Console/Templates/skel/View/Layouts/xml/default.ctp +++ b/lib/Cake/Console/Templates/skel/View/Layouts/xml/default.ctp @@ -1,2 +1 @@ -'; ?> diff --git a/lib/Cake/View/Layouts/xml/default.ctp b/lib/Cake/View/Layouts/xml/default.ctp index 1025a55f5..27f20316b 100644 --- a/lib/Cake/View/Layouts/xml/default.ctp +++ b/lib/Cake/View/Layouts/xml/default.ctp @@ -1,2 +1 @@ -'; ?> From adf52235d0e1278b17c325dcdbd0e07f6e8dee0e Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 27 Oct 2011 21:28:42 -0400 Subject: [PATCH 13/43] Make h() not puke when objects are passed in. This can happen in the default Exception rendering, if an object is in the viewVars. --- lib/Cake/Test/Case/BasicsTest.php | 9 +++++++++ lib/Cake/basics.php | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/BasicsTest.php b/lib/Cake/Test/Case/BasicsTest.php index 2f095f4c9..ccb55538d 100644 --- a/lib/Cake/Test/Case/BasicsTest.php +++ b/lib/Cake/Test/Case/BasicsTest.php @@ -19,6 +19,7 @@ require_once CAKE . 'basics.php'; App::uses('Folder', 'Utility'); +App::uses('CakeResponse', 'Network'); /** * BasicsTest class @@ -234,6 +235,14 @@ class BasicsTest extends CakeTestCase { 'n' => ' ' ); $this->assertEqual($expected, $result); + + $obj = new stdClass(); + $result = h($obj); + $this->assertEquals('(object)stdClass', $result); + + $obj = new CakeResponse(array('body' => 'Body content')); + $result = h($obj); + $this->assertEquals('Body content', $result); } /** diff --git a/lib/Cake/basics.php b/lib/Cake/basics.php index 92a322685..833fdc61e 100644 --- a/lib/Cake/basics.php +++ b/lib/Cake/basics.php @@ -148,7 +148,9 @@ if (!function_exists('sortByKey')) { /** * Convenience method for htmlspecialchars. * - * @param string $text Text to wrap through htmlspecialchars + * @param mixed $text Text to wrap through htmlspecialchars. Also works with arrays, and objects. + * Arrays will be mapped and have all their elements escaped. Objects will be string cast if they + * implement a `__toString` method. Otherwise the class name will be used. * @param boolean $double Encode existing html entities * @param string $charset Character set to use when escaping. Defaults to config value in 'App.encoding' or 'UTF-8' * @return string Wrapped text @@ -161,6 +163,12 @@ function h($text, $double = true, $charset = null) { $texts[$k] = h($t, $double, $charset); } return $texts; + } elseif (is_object($text)) { + if (method_exists($text, '__toString')) { + $text = (string) $text; + } else { + $text = '(object)' . get_class($text); + } } static $defaultCharset = false; From 4a453cc384414b5f55cc30609621b4eb2360cc89 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Thu, 27 Oct 2011 22:14:55 -0430 Subject: [PATCH 14/43] Fixes #2175 Adding automatic Content-Length header to hint browser of the end of the response when using persistent connections --- lib/Cake/Network/CakeResponse.php | 18 ++++++- .../Test/Case/Network/CakeResponseTest.php | 47 +++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index ac03bf766..e65b8899c 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -16,6 +16,9 @@ * @since CakePHP(tm) v 2.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ + +App::uses('Multibyte', 'I18n'); + /** * CakeResponse is responsible for managing the response text, status and headers of a HTTP response. * @@ -347,7 +350,11 @@ class CakeResponse { $codeMessage = $this->_statusCodes[$this->_status]; $this->_sendHeader("{$this->_protocol} {$this->_status} {$codeMessage}"); $this->_sendHeader('Content-Type', "{$this->_contentType}; charset={$this->_charset}"); - + $shouldSetLength = empty($this->_headers['Content-Length']) && class_exists('Multibyte'); + $shouldSetLength = $shouldSetLength && !$this->outputCompressed(); + if ($shouldSetLength) { + $this->_headers['Content-Length'] = mb_strlen($this->_body); + } foreach ($this->_headers as $header => $value) { $this->_sendHeader($header, $value); } @@ -643,6 +650,15 @@ class CakeResponse { return $compressionEnabled && ob_start('ob_gzhandler'); } +/** + * Returns whether the resulting output will be compressed by PHP + * + * @return boolean + */ + public function outputCompressed() { + return ini_get("zlib.output_compression") === '1' || in_array('ob_gzhandler', ob_list_handlers()); + } + /** * Sets the correct headers to instruct the browser to dowload the response as a file. * diff --git a/lib/Cake/Test/Case/Network/CakeResponseTest.php b/lib/Cake/Test/Case/Network/CakeResponseTest.php index 2293e2bc5..680081cfd 100644 --- a/lib/Cake/Test/Case/Network/CakeResponseTest.php +++ b/lib/Cake/Test/Case/Network/CakeResponseTest.php @@ -370,4 +370,51 @@ class CakeResponseTest extends CakeTestCase { $result = $response->mapType(array('application/json', 'application/xhtml+xml', 'text/css')); $this->assertEquals($expected, $result); } + +/** +* Tests the send and setting of Content-Length +* +*/ + public function testSendContentLength() { + $response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent')); + $response->body('the response body'); + $response->expects($this->once())->method('_sendContent')->with('the response body'); + $response->expects($this->at(0)) + ->method('_sendHeader')->with('HTTP/1.1 200 OK'); + $response->expects($this->at(1)) + ->method('_sendHeader')->with('Content-Type', 'text/html; charset=UTF-8'); + $response->expects($this->at(2)) + ->method('_sendHeader')->with('Content-Length', strlen('the response body')); + $response->send(); + + $response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent')); + $body = '長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう?'; + $response->body($body); + $response->expects($this->once())->method('_sendContent')->with($body); + $response->expects($this->at(0)) + ->method('_sendHeader')->with('HTTP/1.1 200 OK'); + $response->expects($this->at(1)) + ->method('_sendHeader')->with('Content-Type', 'text/html; charset=UTF-8'); + $response->expects($this->at(2)) + ->method('_sendHeader')->with('Content-Length', mb_strlen($body)); + $response->send(); + + $response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', 'outputCompressed')); + $body = '長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう?'; + $response->body($body); + $response->expects($this->once())->method('outputCompressed')->will($this->returnValue(true)); + $response->expects($this->once())->method('_sendContent')->with($body); + $response->expects($this->exactly(2))->method('_sendHeader'); + $response->send(); + + $response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', 'outputCompressed')); + $body = 'hwy'; + $response->body($body); + $response->header('Content-Length', 1); + $response->expects($this->never())->method('outputCompressed'); + $response->expects($this->once())->method('_sendContent')->with($body); + $response->expects($this->at(2)) + ->method('_sendHeader')->with('Content-Length', 1); + $response->send(); + } } From 98668825062bbdafc14a24fa7ff311549d6a3bd5 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Thu, 27 Oct 2011 23:18:49 -0430 Subject: [PATCH 15/43] Not sending a content-length for redirection status codes that are not supposed to have any content --- lib/Cake/Network/CakeResponse.php | 4 ++-- lib/Cake/Test/Case/Network/CakeResponseTest.php | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index e65b8899c..41cb0f412 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -351,8 +351,8 @@ class CakeResponse { $this->_sendHeader("{$this->_protocol} {$this->_status} {$codeMessage}"); $this->_sendHeader('Content-Type', "{$this->_contentType}; charset={$this->_charset}"); $shouldSetLength = empty($this->_headers['Content-Length']) && class_exists('Multibyte'); - $shouldSetLength = $shouldSetLength && !$this->outputCompressed(); - if ($shouldSetLength) { + $shouldSetLength = $shouldSetLength && !in_array($this->_status, range(301, 307)); + if ($shouldSetLength && !$this->outputCompressed()) { $this->_headers['Content-Length'] = mb_strlen($this->_body); } foreach ($this->_headers as $header => $value) { diff --git a/lib/Cake/Test/Case/Network/CakeResponseTest.php b/lib/Cake/Test/Case/Network/CakeResponseTest.php index 680081cfd..c118fd62e 100644 --- a/lib/Cake/Test/Case/Network/CakeResponseTest.php +++ b/lib/Cake/Test/Case/Network/CakeResponseTest.php @@ -416,5 +416,13 @@ class CakeResponseTest extends CakeTestCase { $response->expects($this->at(2)) ->method('_sendHeader')->with('Content-Length', 1); $response->send(); + + $response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent')); + $body = 'content'; + $response->statusCode(301); + $response->body($body); + $response->expects($this->once())->method('_sendContent')->with($body); + $response->expects($this->exactly(2))->method('_sendHeader'); + $response->send(); } } From 29ca42ed7ae5d0a1dcb257a93fb11b3a8a7c3b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lorenzo=20Rodr=C3=ADguez?= Date: Thu, 27 Oct 2011 22:44:42 -0530 Subject: [PATCH 16/43] Not sending a content-length for redirection status codes that are not supposed to have any content --- lib/Cake/Network/CakeResponse.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index e65b8899c..41cb0f412 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -351,8 +351,8 @@ class CakeResponse { $this->_sendHeader("{$this->_protocol} {$this->_status} {$codeMessage}"); $this->_sendHeader('Content-Type', "{$this->_contentType}; charset={$this->_charset}"); $shouldSetLength = empty($this->_headers['Content-Length']) && class_exists('Multibyte'); - $shouldSetLength = $shouldSetLength && !$this->outputCompressed(); - if ($shouldSetLength) { + $shouldSetLength = $shouldSetLength && !in_array($this->_status, range(301, 307)); + if ($shouldSetLength && !$this->outputCompressed()) { $this->_headers['Content-Length'] = mb_strlen($this->_body); } foreach ($this->_headers as $header => $value) { From 8945dcbf576e96074729fedcd971ce7586e01f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lorenzo=20Rodr=C3=ADguez?= Date: Thu, 27 Oct 2011 22:53:20 -0530 Subject: [PATCH 17/43] Adding test case for previous commit --- lib/Cake/Test/Case/Network/CakeResponseTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Cake/Test/Case/Network/CakeResponseTest.php b/lib/Cake/Test/Case/Network/CakeResponseTest.php index 680081cfd..c118fd62e 100644 --- a/lib/Cake/Test/Case/Network/CakeResponseTest.php +++ b/lib/Cake/Test/Case/Network/CakeResponseTest.php @@ -416,5 +416,13 @@ class CakeResponseTest extends CakeTestCase { $response->expects($this->at(2)) ->method('_sendHeader')->with('Content-Length', 1); $response->send(); + + $response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent')); + $body = 'content'; + $response->statusCode(301); + $response->body($body); + $response->expects($this->once())->method('_sendContent')->with($body); + $response->expects($this->exactly(2))->method('_sendHeader'); + $response->send(); } } From 4742168253cc7b35f723e20013d7d106e7173a45 Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Fri, 28 Oct 2011 01:01:17 -0400 Subject: [PATCH 18/43] Remove whitespace [Gun.io WhitespaceBot] --- lib/Cake/Console/Command/Task/TestTask.php | 2 +- .../Templates/default/classes/test.ctp | 2 +- .../Console/Templates/default/views/index.ctp | 2 +- .../Templates/skel/Config/bootstrap.php | 2 +- .../Console/Templates/skel/Config/routes.php | 2 +- .../Component/Auth/BaseAuthorize.php | 2 +- .../Controller/Component/AuthComponent.php | 2 +- .../Component/RequestHandlerComponent.php | 2 +- lib/Cake/Routing/Router.php | 2 +- .../Test/Case/Cache/Engine/ApcEngineTest.php | 2 +- .../Test/Case/Cache/Engine/FileEngineTest.php | 2 +- .../Case/Cache/Engine/MemcacheEngineTest.php | 4 +- .../Case/Cache/Engine/WincacheEngineTest.php | 2 +- .../Case/Console/Command/AclShellTest.php | 8 +- .../Case/Console/Command/BakeShellTest.php | 4 +- .../Console/Command/CommandListShellTest.php | 2 +- .../Test/Case/Console/Command/ShellTest.php | 4 +- .../Console/Command/Task/DbConfigTaskTest.php | 2 +- .../Console/Command/Task/FixtureTaskTest.php | 4 +- .../Console/Command/Task/PluginTaskTest.php | 12 +- .../Console/Command/Task/ProjectTaskTest.php | 2 +- .../Console/Command/Task/ViewTaskTest.php | 8 +- .../Case/Console/ConsoleErrorHandlerTest.php | 4 +- .../Case/Console/ConsoleOptionParserTest.php | 14 +- .../Component/Auth/ActionsAuthorizeTest.php | 6 +- .../Component/Auth/BasicAuthenticateTest.php | 2 +- .../Auth/ControllerAuthorizeTest.php | 8 +- .../Component/Auth/CrudAuthorizeTest.php | 4 +- .../Component/Auth/DigestAuthenticateTest.php | 2 +- .../Component/Auth/FormAuthenticateTest.php | 2 +- .../Component/CookieComponentTest.php | 2 +- .../Component/PaginatorComponentTest.php | 6 +- .../Component/SecurityComponentTest.php | 22 +-- .../Test/Case/Controller/ControllerTest.php | 12 +- .../Behavior/ContainableBehaviorTest.php | 8 +- lib/Cake/Test/Case/Model/CakeSchemaTest.php | 4 +- .../Datasource/Database/SqlserverTest.php | 8 +- .../Case/Model/Datasource/DboSourceTest.php | 2 +- .../Session/DatabaseSessionTest.php | 4 +- lib/Cake/Test/Case/Model/ModelWriteTest.php | 8 +- .../Test/Case/Network/CakeRequestTest.php | 176 +++++++++--------- lib/Cake/Test/Case/Routing/RouterTest.php | 4 +- .../Case/TestSuite/CakeTestFixtureTest.php | 6 +- .../Case/Utility/ObjectCollectionTest.php | 4 +- lib/Cake/Test/Case/Utility/SecurityTest.php | 2 +- lib/Cake/Test/Case/Utility/StringTest.php | 2 +- .../Test/Case/View/Helper/FormHelperTest.php | 6 +- .../Test/Case/View/Helper/HtmlHelperTest.php | 2 +- .../Test/Case/View/Helper/RssHelperTest.php | 2 +- .../Test/Case/View/Helper/TimeHelperTest.php | 4 +- lib/Cake/Test/Fixture/FixturizedTestCase.php | 2 +- .../Lib/Cache/Engine/TestAppCacheEngine.php | 2 +- .../test_app/Lib/Log/Engine/TestAppLog.php | 2 +- lib/Cake/Test/test_app/Locale/ja_jp/LC_TIME | 8 +- .../Datasource/Session/TestAppLibSession.php | 10 +- .../Console/Command/Task/other_task.php | 2 +- .../Controller/TestPluginController.php | 2 +- .../Cache/Engine/TestPluginCacheEngine.php | 2 +- .../Lib/Log/Engine/TestPluginLog.php | 2 +- .../Datasource/Session/TestPluginSession.php | 10 +- .../View/Helper/TestPluginAppHelper.php | 2 +- .../test_app/View/Posts/helper_overwrite.ctp | 2 +- lib/Cake/TestSuite/CakeTestCase.php | 6 +- lib/Cake/TestSuite/CakeTestRunner.php | 4 +- lib/Cake/TestSuite/ControllerTestCase.php | 10 +- .../TestSuite/Fixture/CakeTestFixture.php | 2 +- .../TestSuite/Reporter/CakeTextReporter.php | 4 +- lib/Cake/Utility/Debugger.php | 12 +- lib/Cake/View/Elements/sql_dump.ctp | 4 +- lib/Cake/View/Helper/FormHelper.php | 2 +- lib/Cake/View/Pages/home.ctp | 2 +- lib/Cake/View/Scaffolds/index.ctp | 4 +- 72 files changed, 248 insertions(+), 248 deletions(-) diff --git a/lib/Cake/Console/Command/Task/TestTask.php b/lib/Cake/Console/Command/Task/TestTask.php index b1c144214..769773643 100644 --- a/lib/Cake/Console/Command/Task/TestTask.php +++ b/lib/Cake/Console/Command/Task/TestTask.php @@ -145,7 +145,7 @@ class TestTask extends BakeTask { $this->Template->set('fixtures', $this->_fixtures); $this->Template->set('plugin', $plugin); $this->Template->set(compact( - 'className', 'methods', 'type', 'fullClassName', 'mock', + 'className', 'methods', 'type', 'fullClassName', 'mock', 'construction', 'realType' )); $out = $this->Template->generate('classes', 'test'); diff --git a/lib/Cake/Console/Templates/default/classes/test.ctp b/lib/Cake/Console/Templates/default/classes/test.ctp index ca394cf20..4677ab649 100644 --- a/lib/Cake/Console/Templates/default/classes/test.ctp +++ b/lib/Cake/Console/Templates/default/classes/test.ctp @@ -24,7 +24,7 @@ App::uses('', ''); /** - * Test + * Test * */ class Test extends { diff --git a/lib/Cake/Console/Templates/default/views/index.ctp b/lib/Cake/Console/Templates/default/views/index.ctp index b332daced..807d7a2fc 100644 --- a/lib/Cake/Console/Templates/default/views/index.ctp +++ b/lib/Cake/Console/Templates/default/views/index.ctp @@ -66,7 +66,7 @@
Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));\n"; echo "\t\techo \$this->Paginator->numbers(array('separator' => ''));\n"; echo "\t\techo \$this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));\n"; diff --git a/lib/Cake/Console/Templates/skel/Config/bootstrap.php b/lib/Cake/Console/Templates/skel/Config/bootstrap.php index fce18ccba..aa1d372b0 100644 --- a/lib/Cake/Console/Templates/skel/Config/bootstrap.php +++ b/lib/Cake/Console/Templates/skel/Config/bootstrap.php @@ -2,7 +2,7 @@ /** * This file is loaded automatically by the app/webroot/index.php file after core.php * - * This file should load/create any application wide configuration settings, such as + * This file should load/create any application wide configuration settings, such as * Caching, Logging, loading additional configuration files. * * You should also use this file to include any files that provide global functions/constants diff --git a/lib/Cake/Console/Templates/skel/Config/routes.php b/lib/Cake/Console/Templates/skel/Config/routes.php index d984d96ef..dfc6b579d 100644 --- a/lib/Cake/Console/Templates/skel/Config/routes.php +++ b/lib/Cake/Console/Templates/skel/Config/routes.php @@ -32,7 +32,7 @@ Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); /** - * Load all plugin routes. See the CakePlugin documentation on + * Load all plugin routes. See the CakePlugin documentation on * how to customize the loading of plugin routes. */ CakePlugin::routes(); diff --git a/lib/Cake/Controller/Component/Auth/BaseAuthorize.php b/lib/Cake/Controller/Component/Auth/BaseAuthorize.php index 926f5186d..f4c33fe3d 100644 --- a/lib/Cake/Controller/Component/Auth/BaseAuthorize.php +++ b/lib/Cake/Controller/Component/Auth/BaseAuthorize.php @@ -131,7 +131,7 @@ abstract class BaseAuthorize { * }}} * * You can use the custom CRUD operations to create additional generic permissions - * that behave like CRUD operations. Doing this will require additional columns on the + * that behave like CRUD operations. Doing this will require additional columns on the * permissions lookup. When using with DbAcl, you'll have to add additional _admin type columns * to the `aros_acos` table. * diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index f099cd3ce..27353a0d7 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -519,7 +519,7 @@ class AuthComponent extends Component { * Logs a user out, and returns the login action to redirect to. * Triggers the logout() method of all the authenticate objects, so they can perform * custom logout logic. AuthComponent will remove the session data, so - * there is no need to do that in an authentication object. Logging out + * there is no need to do that in an authentication object. Logging out * will also renew the session id. This helps mitigate issues with session replays. * * @return string AuthComponent::$logoutRedirect diff --git a/lib/Cake/Controller/Component/RequestHandlerComponent.php b/lib/Cake/Controller/Component/RequestHandlerComponent.php index e262d7f78..9f38c5652 100644 --- a/lib/Cake/Controller/Component/RequestHandlerComponent.php +++ b/lib/Cake/Controller/Component/RequestHandlerComponent.php @@ -98,7 +98,7 @@ class RequestHandlerComponent extends Component { /** * Checks to see if a file extension has been parsed by the Router, or if the * HTTP_ACCEPT_TYPE has matches only one content type with the supported extensions. - * If there is only one matching type between the supported content types & extensions, + * If there is only one matching type between the supported content types & extensions, * and the requested mime-types, RequestHandler::$ext is set to that value. * * @param Controller $controller A reference to the controller diff --git a/lib/Cake/Routing/Router.php b/lib/Cake/Routing/Router.php index d2702e9bb..e05b4add4 100644 --- a/lib/Cake/Routing/Router.php +++ b/lib/Cake/Routing/Router.php @@ -433,7 +433,7 @@ class Router { Router::connect($url, array( 'plugin' => $plugin, - 'controller' => $urlName, + 'controller' => $urlName, 'action' => $params['action'], '[method]' => $params['method'] ), diff --git a/lib/Cake/Test/Case/Cache/Engine/ApcEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/ApcEngineTest.php index 4971f8e3e..355a19589 100644 --- a/lib/Cake/Test/Case/Cache/Engine/ApcEngineTest.php +++ b/lib/Cake/Test/Case/Cache/Engine/ApcEngineTest.php @@ -157,7 +157,7 @@ class ApcEngineTest extends CakeTestCase { $result = Cache::read('test_decrement', 'apc'); $this->assertEqual(2, $result); - + } /** diff --git a/lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php index ecc995dd3..81529bb91 100644 --- a/lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php +++ b/lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php @@ -352,7 +352,7 @@ class FileEngineTest extends CakeTestCase { /** * Testing the mask setting in FileEngine - * + * * @return void */ public function testMaskSetting() { diff --git a/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php index 4fd308acf..e702c1199 100644 --- a/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php +++ b/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php @@ -24,13 +24,13 @@ class TestMemcacheEngine extends MemcacheEngine { /** * public accessor to _parseServerString * - * @param string $server + * @param string $server * @return array */ public function parseServerString($server) { return $this->_parseServerString($server); } - + public function setMemcache($memcache) { $this->_Memcache = $memcache; } diff --git a/lib/Cake/Test/Case/Cache/Engine/WincacheEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/WincacheEngineTest.php index 12bbee978..6e1a0cbc4 100644 --- a/lib/Cake/Test/Case/Cache/Engine/WincacheEngineTest.php +++ b/lib/Cake/Test/Case/Cache/Engine/WincacheEngineTest.php @@ -145,7 +145,7 @@ class WincacheEngineTest extends CakeTestCase { $result = Cache::read('test_decrement', 'wincache'); $this->assertEqual(2, $result); - + } /** diff --git a/lib/Cake/Test/Case/Console/Command/AclShellTest.php b/lib/Cake/Test/Case/Console/Command/AclShellTest.php index 7efc4fa7c..85023711c 100644 --- a/lib/Cake/Test/Case/Console/Command/AclShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/AclShellTest.php @@ -81,7 +81,7 @@ class AclShellTest extends CakeTestCase { $this->Task->expects($this->at(4))->method('out') ->with($this->stringContains('[3] Gandalf')); - + $this->Task->expects($this->at(6))->method('out') ->with($this->stringContains('[5] MyModel.2')); @@ -217,7 +217,7 @@ class AclShellTest extends CakeTestCase { $this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create'); $this->Task->expects($this->at(0))->method('out') ->with($this->stringContains('Permission denied'), true); - + $this->Task->deny(); $node = $this->Task->Acl->Aro->node(array('model' => 'AuthUser', 'foreign_key' => 2)); @@ -264,7 +264,7 @@ class AclShellTest extends CakeTestCase { ->with($this->matchesRegularExpression('/Permission .*granted/'), true); $this->Task->expects($this->at(1))->method('out') ->with($this->matchesRegularExpression('/Permission .*inherited/'), true); - + $this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create'); $this->Task->grant(); @@ -302,7 +302,7 @@ class AclShellTest extends CakeTestCase { public function testInitDb() { $this->Task->expects($this->once())->method('dispatchShell') ->with('schema create DbAcl'); - + $this->Task->initdb(); } } diff --git a/lib/Cake/Test/Case/Console/Command/BakeShellTest.php b/lib/Cake/Test/Case/Console/Command/BakeShellTest.php index 8ada2cdeb..c4667c7cf 100644 --- a/lib/Cake/Test/Case/Console/Command/BakeShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/BakeShellTest.php @@ -84,10 +84,10 @@ class BakeShellTest extends CakeTestCase { $this->Shell->DbConfig = $this->getMock('DbConfigTask', array(), array(&$this->Dispatcher)); $this->Shell->DbConfig->expects($this->once())->method('getConfig')->will($this->returnValue('test')); - + $this->Shell->Model->expects($this->never())->method('getName'); $this->Shell->Model->expects($this->once())->method('bake')->will($this->returnValue(true)); - + $this->Shell->Controller->expects($this->once())->method('bake')->will($this->returnValue(true)); $this->Shell->View->expects($this->once())->method('execute'); diff --git a/lib/Cake/Test/Case/Console/Command/CommandListShellTest.php b/lib/Cake/Test/Case/Console/Command/CommandListShellTest.php index 49f04837d..05c4a56ee 100644 --- a/lib/Cake/Test/Case/Console/Command/CommandListShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/CommandListShellTest.php @@ -146,7 +146,7 @@ class CommandListShellTest extends CakeTestCase { $output = $this->Shell->stdout->output; - $find = ''; + $find = ''; $this->assertContains($find, $output); $find = ''; diff --git a/lib/Cake/Test/Case/Console/Command/ShellTest.php b/lib/Cake/Test/Case/Console/Command/ShellTest.php index 92bc7b101..fdead81d1 100644 --- a/lib/Cake/Test/Case/Console/Command/ShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/ShellTest.php @@ -184,7 +184,7 @@ class ShellTest extends CakeTestCase { $this->assertTrue(isset($this->Shell->Comment)); $this->assertInstanceOf('Comment', $this->Shell->Comment); $this->assertEqual($this->Shell->modelClass, 'Comment'); - + App::build(); } @@ -832,7 +832,7 @@ TEXT; /** * Testing camel cased naming of tasks - * + * * @return void */ public function testShellNaming() { diff --git a/lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php index c8a4c0317..56db22d1a 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php @@ -40,7 +40,7 @@ class DbConfigTaskTest extends CakeTestCase { $out = $this->getMock('ConsoleOutput', array(), array(), '', false); $in = $this->getMock('ConsoleInput', array(), array(), '', false); - $this->Task = $this->getMock('DbConfigTask', + $this->Task = $this->getMock('DbConfigTask', array('in', 'out', 'err', 'hr', 'createFile', '_stop', '_checkUnitTest', '_verify'), array($out, $out, $in) ); diff --git a/lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php index 2435701cf..63d9a51b6 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php @@ -188,7 +188,7 @@ class FixtureTaskTest extends CakeTestCase { $this->Task->connection = 'test'; $this->Task->path = '/my/path/'; $result = $this->Task->bake('Article', false, array( - 'fromTable' => true, + 'fromTable' => true, 'schema' => 'Article', 'records' => false )); @@ -209,7 +209,7 @@ class FixtureTaskTest extends CakeTestCase { $this->Task->expects($this->at(0))->method('createFile') ->with($filename, $this->stringContains('class ArticleFixture')); - + $this->Task->execute(); } diff --git a/lib/Cake/Test/Case/Console/Command/Task/PluginTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/PluginTaskTest.php index 72e189f6d..96155ae4a 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/PluginTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/PluginTaskTest.php @@ -45,12 +45,12 @@ class PluginTaskTest extends CakeTestCase { $this->out = $this->getMock('ConsoleOutput', array(), array(), '', false); $this->in = $this->getMock('ConsoleInput', array(), array(), '', false); - $this->Task = $this->getMock('PluginTask', + $this->Task = $this->getMock('PluginTask', array('in', 'err', 'createFile', '_stop', 'clear'), array($this->out, $this->out, $this->in) ); $this->Task->path = TMP . 'tests' . DS; - + $this->_paths = $paths = App::path('plugins'); foreach ($paths as $i => $p) { if (!is_dir($p)) { @@ -84,7 +84,7 @@ class PluginTaskTest extends CakeTestCase { $path = $this->Task->path . 'BakeTestPlugin'; $this->assertTrue(is_dir($path), 'No plugin dir %s'); - + $directories = array( 'Config' . DS . 'Schema', 'Model' . DS . 'Behavior', @@ -155,7 +155,7 @@ class PluginTaskTest extends CakeTestCase { $file = $path . DS . 'Model' . DS . 'BakeTestPluginAppModel.php'; $this->Task->expects($this->at(3))->method('createFile') ->with($file, new PHPUnit_Framework_Constraint_IsAnything()); - + $this->Task->args = array('BakeTestPlugin'); $this->Task->execute(); @@ -174,7 +174,7 @@ class PluginTaskTest extends CakeTestCase { $last = count($paths); $paths[] = '/fake/path'; - $this->Task = $this->getMock('PluginTask', + $this->Task = $this->getMock('PluginTask', array('in', 'out', 'err', 'createFile', '_stop'), array($this->out, $this->out, $this->in) ); @@ -183,7 +183,7 @@ class PluginTaskTest extends CakeTestCase { // Make sure the added path is filtered out. $this->Task->expects($this->exactly($last)) ->method('out'); - + $this->Task->expects($this->once()) ->method('in') ->will($this->returnValue($last)); diff --git a/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php index 5210b9e51..7bc290457 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php @@ -130,7 +130,7 @@ class ProjectTaskTest extends CakeTestCase { } /** - * test bake with CakePHP on the include path. The constants should remain commented out. + * test bake with CakePHP on the include path. The constants should remain commented out. * * @return void */ diff --git a/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php index ef6d61746..581615b46 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php @@ -613,7 +613,7 @@ class ViewTaskTest extends CakeTestCase { TMP . 'ViewTaskComments' . DS . 'index.ctp', $this->stringContains('ViewTaskComment') ); - + $this->Task->expects($this->at(4))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'view.ctp', @@ -631,7 +631,7 @@ class ViewTaskTest extends CakeTestCase { TMP . 'ViewTaskComments' . DS . 'edit.ctp', $this->stringContains('Edit View Task Comment') ); - + $this->Task->expects($this->exactly(4))->method('createFile'); $this->Task->execute(); } @@ -678,7 +678,7 @@ class ViewTaskTest extends CakeTestCase { TMP . 'ViewTaskComments' . DS . 'admin_index.ctp', $this->stringContains('ViewTaskComment') ); - + $this->Task->expects($this->at(4))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'admin_view.ctp', @@ -696,7 +696,7 @@ class ViewTaskTest extends CakeTestCase { TMP . 'ViewTaskComments' . DS . 'admin_edit.ctp', $this->stringContains('Edit View Task Comment') ); - + $this->Task->expects($this->exactly(4))->method('createFile'); $this->Task->execute(); } diff --git a/lib/Cake/Test/Case/Console/ConsoleErrorHandlerTest.php b/lib/Cake/Test/Case/Console/ConsoleErrorHandlerTest.php index cb4d22509..662f6b35a 100644 --- a/lib/Cake/Test/Case/Console/ConsoleErrorHandlerTest.php +++ b/lib/Cake/Test/Case/Console/ConsoleErrorHandlerTest.php @@ -87,7 +87,7 @@ class ConsoleErrorHandlerTest extends CakeTestCase { ConsoleErrorHandler::$stderr->expects($this->once())->method('write') ->with($this->stringContains('Too many parameters.')); - + $this->Error->expects($this->once()) ->method('_stop') ->with(1); @@ -102,7 +102,7 @@ class ConsoleErrorHandlerTest extends CakeTestCase { */ public function testError404Exception() { $exception = new NotFoundException('dont use me in cli.'); - + ConsoleErrorHandler::$stderr->expects($this->once())->method('write') ->with($this->stringContains('dont use me in cli.')); diff --git a/lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php b/lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php index 026a4312c..3a4a6c291 100644 --- a/lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php +++ b/lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php @@ -48,7 +48,7 @@ class ConsoleOptionParserTest extends CakeTestCase { $this->assertEquals($parser, $result, 'Setting epilog is not chainable'); $this->assertEquals('A test', $parser->epilog(), 'getting value is wrong.'); - + $result = $parser->epilog(array('A test', 'something')); $this->assertEquals("A test\nsomething", $parser->epilog(), 'getting value is wrong.'); } @@ -116,7 +116,7 @@ class ConsoleOptionParserTest extends CakeTestCase { )); $result = $parser->parse(array('--test')); $this->assertEquals(array('test' => 'default value', 'help' => false), $result[0], 'Default value did not parse out'); - + $parser = new ConsoleOptionParser('test', false); $parser->addOption('test', array( 'default' => 'default value', @@ -165,7 +165,7 @@ class ConsoleOptionParserTest extends CakeTestCase { $result = $parser->parse(array('--test', 'value')); $expected = array(array('test' => true, 'help' => false), array('value')); $this->assertEquals($expected, $result); - + $result = $parser->parse(array('value')); $expected = array(array('test' => false, 'help' => false), array('value')); $this->assertEquals($expected, $result); @@ -249,7 +249,7 @@ class ConsoleOptionParserTest extends CakeTestCase { $result = $parser->parse(array('--fail', 'other')); } - + /** * test parsing short options that do not exist. * @@ -271,7 +271,7 @@ class ConsoleOptionParserTest extends CakeTestCase { public function testOptionWithChoices() { $parser = new ConsoleOptionParser('test', false); $parser->addOption('name', array('choices' => array('mark', 'jose'))); - + $result = $parser->parse(array('--name', 'mark')); $expected = array('name' => 'mark', 'help' => false); $this->assertEquals($expected, $result[0], 'Got the correct value.'); @@ -519,7 +519,7 @@ TEXT; $args = $parser->arguments(); $this->assertEquals(2, count($args)); - + $commands = $parser->subcommands(); $this->assertEquals(1, count($commands)); } @@ -567,7 +567,7 @@ TEXT; ) ) )); - + $result = $parser->parse(array('--secondary', '--fourth', '4', 'c'), 'sub'); $expected = array(array( 'secondary' => true, diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/ActionsAuthorizeTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/ActionsAuthorizeTest.php index adb09bfd3..709b9bdfe 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/ActionsAuthorizeTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/ActionsAuthorizeTest.php @@ -3,7 +3,7 @@ * ActionsAuthorizeTest file * * PHP 5 - * + * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @@ -77,7 +77,7 @@ class ActionsAuthorizeTest extends CakeTestCase { ->method('check') ->with($user, '/controllers/Posts/index') ->will($this->returnValue(false)); - + $this->assertFalse($this->auth->authorize($user['User'], $request)); } @@ -106,7 +106,7 @@ class ActionsAuthorizeTest extends CakeTestCase { ->method('check') ->with($user, '/controllers/Posts/index') ->will($this->returnValue(true)); - + $this->assertTrue($this->auth->authorize($user['User'], $request)); } diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/BasicAuthenticateTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/BasicAuthenticateTest.php index 2699c17f9..d742495a6 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/BasicAuthenticateTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/BasicAuthenticateTest.php @@ -3,7 +3,7 @@ * BasicAuthenticateTest file * * PHP 5 - * + * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php index ef46e01be..1ece40311 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/ControllerAuthorizeTest.php @@ -3,7 +3,7 @@ * ControllerAuthorizeTest file * * PHP 5 - * + * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @@ -36,12 +36,12 @@ class ControllerAuthorizeTest extends CakeTestCase { $this->components->expects($this->any()) ->method('getController') ->will($this->returnValue($this->controller)); - + $this->auth = new ControllerAuthorize($this->components); } /** - * + * * @expectedException CakeException */ public function testControllerTypeError() { @@ -74,7 +74,7 @@ class ControllerAuthorizeTest extends CakeTestCase { public function testAuthorizeSuccess() { $user = array('User' => array('username' => 'mark')); $request = new CakeRequest('/posts/index', false); - + $this->controller->expects($this->once()) ->method('isAuthorized') ->with($user) diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/CrudAuthorizeTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/CrudAuthorizeTest.php index 1b4b6d46c..ff726d8c1 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/CrudAuthorizeTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/CrudAuthorizeTest.php @@ -3,7 +3,7 @@ * CrudAuthorizeTest file * * PHP 5 - * + * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * @@ -179,7 +179,7 @@ class CrudAuthorizeTest extends CakeTestCase { public function testAutoPrefixMapActions() { Configure::write('Routing.prefixes', array('admin', 'manager')); Router::reload(); - + $auth = new CrudAuthorize($this->Components); $this->assertTrue(isset($auth->settings['actionMap']['admin_index'])); } diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/DigestAuthenticateTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/DigestAuthenticateTest.php index 01dcdab2f..dc8b4fc5f 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/DigestAuthenticateTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/DigestAuthenticateTest.php @@ -3,7 +3,7 @@ * DigestAuthenticateTest file * * PHP 5 - * + * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * diff --git a/lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php b/lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php index 70bfff45c..89b6c53d2 100644 --- a/lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Auth/FormAuthenticateTest.php @@ -3,7 +3,7 @@ * FormAuthenticateTest file * * PHP 5 - * + * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * diff --git a/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php b/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php index 0ddd8c0dc..f5d9063f9 100644 --- a/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php @@ -76,7 +76,7 @@ class CookieComponentTest extends CakeTestCase { $this->Cookie = $this->getMock('CookieComponent', array('_setcookie'), array($Collection)); $this->Controller = new CookieComponentTestController(); $this->Cookie->initialize($this->Controller); - + $this->Cookie->name = 'CakeTestCookie'; $this->Cookie->time = 10; $this->Cookie->path = '/'; diff --git a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php index 1a754fdd7..d19d868c3 100644 --- a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php @@ -453,7 +453,7 @@ class PaginatorComponentTest extends CakeTestCase { $Controller->params['url'] = array(); $Controller->constructClasses(); $Controller->Paginator->settings = array( - 'order' => 'PaginatorControllerPost.id DESC', + 'order' => 'PaginatorControllerPost.id DESC', 'maxLimit' => 10, 'paramType' => 'named' ); @@ -502,7 +502,7 @@ class PaginatorComponentTest extends CakeTestCase { } /** - * test that option merging prefers specific models + * test that option merging prefers specific models * * @return void */ @@ -671,7 +671,7 @@ class PaginatorComponentTest extends CakeTestCase { ->method('hasField') ->with('something') ->will($this->returnValue(false)); - + $model->expects($this->at(1)) ->method('hasField') ->with('something', true) diff --git a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php index ab5e4a1f3..a0f40c903 100644 --- a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php @@ -135,7 +135,7 @@ class SecurityComponentTest extends CakeTestCase { */ public function setUp() { parent::setUp(); - + $request = new CakeRequest('posts/index', false); $request->addParams(array('controller' => 'posts', 'action' => 'index')); $this->Controller = new SecurityTestController($request); @@ -492,7 +492,7 @@ class SecurityComponentTest extends CakeTestCase { } /** - * Test that objects can't be passed into the serialized string. This was a vector for RFI and LFI + * Test that objects can't be passed into the serialized string. This was a vector for RFI and LFI * attacks. Thanks to Felix Wilhelm * * @return void @@ -641,7 +641,7 @@ class SecurityComponentTest extends CakeTestCase { $fields = '19464422eafe977ee729c59222af07f983010c5f%3A'; $this->Controller->request->data = array( 'User.password' => 'bar', 'User.name' => 'foo', 'User.is_valid' => '1', - 'Tag' => array('Tag' => array(1)), + 'Tag' => array('Tag' => array(1)), '_Token' => compact('key', 'fields', 'unlocked'), ); $result = $this->Controller->Security->validatePost($this->Controller); @@ -1056,7 +1056,7 @@ class SecurityComponentTest extends CakeTestCase { } /** - * test that csrf checks are skipped for request action. + * test that csrf checks are skipped for request action. * * @return void */ @@ -1073,7 +1073,7 @@ class SecurityComponentTest extends CakeTestCase { } /** - * test setting + * test setting * * @return void */ @@ -1117,9 +1117,9 @@ class SecurityComponentTest extends CakeTestCase { $this->Security->validatePost = false; $this->Security->csrfCheck = true; $this->Security->csrfExpires = '+10 minutes'; - + $this->Security->Session->write('_Token.csrfTokens', array('nonce1' => strtotime('+10 minutes'))); - + $this->Controller->request = $this->getMock('CakeRequest', array('is')); $this->Controller->request->expects($this->once())->method('is') ->with('post') @@ -1148,7 +1148,7 @@ class SecurityComponentTest extends CakeTestCase { $this->Security->validatePost = false; $this->Security->csrfCheck = true; $this->Security->csrfExpires = '+10 minutes'; - + $this->Security->Session->write('_Token.csrfTokens', array( 'valid' => strtotime('+30 minutes'), 'poof' => strtotime('-11 minutes'), @@ -1158,7 +1158,7 @@ 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.'); - + } /** @@ -1170,9 +1170,9 @@ class SecurityComponentTest extends CakeTestCase { $this->Security->validatePost = false; $this->Security->csrfCheck = true; $this->Security->csrfExpires = '+10 minutes'; - + $this->Security->Session->write('_Token.csrfTokens', array('nonce1' => strtotime('+10 minutes'))); - + $this->Controller->request = $this->getMock('CakeRequest', array('is')); $this->Controller->request->expects($this->once())->method('is') ->with('post') diff --git a/lib/Cake/Test/Case/Controller/ControllerTest.php b/lib/Cake/Test/Case/Controller/ControllerTest.php index 2bd74090a..36f72110e 100644 --- a/lib/Cake/Test/Case/Controller/ControllerTest.php +++ b/lib/Cake/Test/Case/Controller/ControllerTest.php @@ -274,21 +274,21 @@ class TestController extends ControllerTestAppController { public function returner() { return 'I am from the controller.'; } - + protected function protected_m() { - + } private function private_m() { - + } public function _hidden() { - + } public function admin_add() { - + } } @@ -1319,5 +1319,5 @@ class ControllerTest extends CakeTestCase { $this->assertEquals('I am from the controller.', $result); } - + } diff --git a/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php b/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php index eb6f69862..909c5dbf9 100644 --- a/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php +++ b/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php @@ -238,7 +238,7 @@ class ContainableBehaviorTest extends CakeTestCase { /** * testBeforeFindWithNonExistingBinding method - * + * * @expectedException PHPUnit_Framework_Error_Warning * @return void */ @@ -3304,15 +3304,15 @@ class ContainableBehaviorTest extends CakeTestCase { $this->assertEqual($expected, array_keys($result)); $this->assertTrue(empty($this->Article->hasMany['ArticlesTag'])); - + $this->JoinA =& ClassRegistry::init('JoinA'); $this->JoinB =& ClassRegistry::init('JoinB'); $this->JoinC =& ClassRegistry::init('JoinC'); - + $this->JoinA->Behaviors->attach('Containable'); $this->JoinB->Behaviors->attach('Containable'); $this->JoinC->Behaviors->attach('Containable'); - + $this->JoinA->JoinB->find('all', array('contain' => array('JoinA'))); $this->JoinA->bindModel(array('hasOne' => array('JoinAsJoinC' => array('joinTable' => 'as_cs'))), false); $result = $this->JoinA->hasOne; diff --git a/lib/Cake/Test/Case/Model/CakeSchemaTest.php b/lib/Cake/Test/Case/Model/CakeSchemaTest.php index c61783c5f..f83c5a61b 100644 --- a/lib/Cake/Test/Case/Model/CakeSchemaTest.php +++ b/lib/Cake/Test/Case/Model/CakeSchemaTest.php @@ -566,7 +566,7 @@ class CakeSchemaTest extends CakeTestCase { )); $this->assertFalse(isset($read['tables']['missing']['posts_tags']), 'Join table marked as missing'); } - + /** * testSchemaReadWithAppModel method * @@ -575,7 +575,7 @@ class CakeSchemaTest extends CakeTestCase { */ public function testSchemaReadWithAppModel() { $connections = ConnectionManager::enumConnectionObjects(); - ConnectionManager::drop('default'); + ConnectionManager::drop('default'); ConnectionManager::create('default', $connections['test']); try { $read = $this->Schema->read(array( diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php index 6455ec28c..54fdad8dc 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php @@ -92,7 +92,7 @@ class SqlserverTestDb extends Sqlserver { public function clearFieldMappings() { $this->_fieldMappings = array(); } - + /** * describe method * @@ -568,11 +568,11 @@ class SqlserverTest extends CakeTestCase { */ public function testGetPrimaryKey() { $schema = $this->model->schema(); - + $this->db->describe = $schema; $result = $this->db->getPrimaryKey($this->model); $this->assertEqual($result, 'id'); - + unset($schema['id']['key']); $this->db->describe = $schema; $result = $this->db->getPrimaryKey($this->model); @@ -586,7 +586,7 @@ class SqlserverTest extends CakeTestCase { */ public function testInsertMulti() { $this->db->describe = $this->model->schema(); - + $fields = array('id', 'name', 'login'); $values = array( array(1, 'Larry', 'PhpNut'), diff --git a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php index 800bd917f..f870aac1c 100644 --- a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php @@ -612,7 +612,7 @@ class DboSourceTest extends CakeTestCase { $result = Set::extract($log['log'], '/query'); $expected = array('Query 1', 'Query 2'); $this->assertEqual($expected, $result); - + $oldDebug = Configure::read('debug'); Configure::write('debug', 2); ob_start(); diff --git a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php index ac64b6a36..7d29a397c 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php @@ -146,7 +146,7 @@ class DatabaseSessionTest extends CakeTestCase { $result = $this->storage->read('foo'); $expected = 'Some value'; $this->assertEquals($expected, $result); - + $result = $this->storage->read('made up value'); $this->assertFalse($result); } @@ -158,7 +158,7 @@ class DatabaseSessionTest extends CakeTestCase { */ public function testDestroy() { $this->storage->write('foo', 'Some value'); - + $this->assertTrue($this->storage->destroy('foo'), 'Destroy failed'); $this->assertFalse($this->storage->read('foo'), 'Value still present.'); } diff --git a/lib/Cake/Test/Case/Model/ModelWriteTest.php b/lib/Cake/Test/Case/Model/ModelWriteTest.php index 909cdc0c0..b95cc3f07 100644 --- a/lib/Cake/Test/Case/Model/ModelWriteTest.php +++ b/lib/Cake/Test/Case/Model/ModelWriteTest.php @@ -3457,7 +3457,7 @@ class ModelWriteTest extends BaseModelTest { ) ) ); - + $this->assertTrue($result[0]['Post']['updated'] >= $newTs); $this->assertTrue($result[1]['Post']['updated'] >= $newTs); $this->assertTrue($result[3]['Post']['updated'] >= $newTs); @@ -4372,7 +4372,7 @@ class ModelWriteTest extends BaseModelTest { $mock = $this->getMock( 'DboSource', - array('connect', 'rollback', 'describe', 'create', 'begin'), + array('connect', 'rollback', 'describe', 'create', 'begin'), array(), 'MockAssociatedTransactionDboSource', false @@ -4754,7 +4754,7 @@ class ModelWriteTest extends BaseModelTest { $result = $TestModel->find('all', array( 'fields' => array('id', 'author_id', 'title', 'body', 'published'), - 'recursive' => -1, + 'recursive' => -1, 'order' => 'Post.id ASC' )); $errors = array(1 => array('title' => array('This field cannot be left blank'))); @@ -4810,7 +4810,7 @@ class ModelWriteTest extends BaseModelTest { $result = $TestModel->find('all', array( 'fields' => array('id', 'author_id', 'title', 'body', 'published'), - 'recursive' => -1, + 'recursive' => -1, 'order' => 'Post.id ASC' )); $this->assertEqual($expected, $result); diff --git a/lib/Cake/Test/Case/Network/CakeRequestTest.php b/lib/Cake/Test/Case/Network/CakeRequestTest.php index acd0ba2a2..6af42d745 100644 --- a/lib/Cake/Test/Case/Network/CakeRequestTest.php +++ b/lib/Cake/Test/Case/Network/CakeRequestTest.php @@ -85,7 +85,7 @@ class CakeRequestTest extends CakeTestCase { ); $request = new CakeRequest('some/path'); $this->assertEqual($request->query, $_GET); - + $_GET = array( 'one' => 'param', 'two' => 'banana', @@ -106,7 +106,7 @@ class CakeRequestTest extends CakeTestCase { $expected = array('one' => 'something', 'two' => 'else'); $this->assertEqual($request->query, $expected); $this->assertEquals('some/path?one=something&two=else', $request->url); - + } /** @@ -553,7 +553,7 @@ class CakeRequestTest extends CakeTestCase { public function testHost() { $_SERVER['HTTP_HOST'] = 'localhost'; $request = new CakeRequest('some/path'); - + $this->assertEquals('localhost', $request->host()); } @@ -617,7 +617,7 @@ class CakeRequestTest extends CakeTestCase { $_SERVER['HTTP_USER_AGENT'] = 'Android 2.0'; $this->assertTrue($request->is('mobile')); $this->assertTrue($request->isMobile()); - + $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 5.1; rv:2.0b6pre) Gecko/20100902 Firefox/4.0b6pre Fennec/2.0b1pre'; $this->assertTrue($request->is('mobile')); $this->assertTrue($request->isMobile()); @@ -782,7 +782,7 @@ class CakeRequestTest extends CakeTestCase { public function testAccepts() { $_SERVER['HTTP_ACCEPT'] = 'text/xml,application/xml;q=0.9,application/xhtml+xml,text/html,text/plain,image/png'; $request = new CakeRequest('/', false); - + $result = $request->accepts(); $expected = array( 'text/xml', 'application/xhtml+xml', 'text/html', 'text/plain', 'image/png', 'application/xml' @@ -1047,7 +1047,7 @@ class CakeRequestTest extends CakeTestCase { 'IIS - No rewrite base path', array( 'App' => array( - 'base' => false, + 'base' => false, 'baseUrl' => '/index.php', 'dir' => 'app', 'webroot' => 'webroot' @@ -1076,7 +1076,7 @@ class CakeRequestTest extends CakeTestCase { 'IIS - No rewrite with path, no PHP_SELF', array( 'App' => array( - 'base' => false, + 'base' => false, 'baseUrl' => '/index.php?', 'dir' => 'app', 'webroot' => 'webroot' @@ -1101,21 +1101,21 @@ class CakeRequestTest extends CakeTestCase { 'IIS - No rewrite sub dir 2', array( 'App' => array( - 'base' => false, - 'baseUrl' => '/site/index.php', - 'dir' => 'app', - 'webroot' => 'webroot', + 'base' => false, + 'baseUrl' => '/site/index.php', + 'dir' => 'app', + 'webroot' => 'webroot', ), 'SERVER' => array( - 'SCRIPT_NAME' => '/site/index.php', - 'PATH_TRANSLATED' => 'C:\\Inetpub\\wwwroot', - 'QUERY_STRING' => '', - 'REQUEST_URI' => '/site/index.php', - 'URL' => '/site/index.php', - 'SCRIPT_FILENAME' => 'C:\\Inetpub\\wwwroot\\site\\index.php', - 'DOCUMENT_ROOT' => 'C:\\Inetpub\\wwwroot', - 'PHP_SELF' => '/site/index.php', - 'argv' => array(), + 'SCRIPT_NAME' => '/site/index.php', + 'PATH_TRANSLATED' => 'C:\\Inetpub\\wwwroot', + 'QUERY_STRING' => '', + 'REQUEST_URI' => '/site/index.php', + 'URL' => '/site/index.php', + 'SCRIPT_FILENAME' => 'C:\\Inetpub\\wwwroot\\site\\index.php', + 'DOCUMENT_ROOT' => 'C:\\Inetpub\\wwwroot', + 'PHP_SELF' => '/site/index.php', + 'argv' => array(), 'argc' => 0 ), ), @@ -1129,22 +1129,22 @@ class CakeRequestTest extends CakeTestCase { 'IIS - No rewrite sub dir 2 with path', array( 'App' => array( - 'base' => false, + 'base' => false, 'baseUrl' => '/site/index.php', 'dir' => 'app', 'webroot' => 'webroot' ), 'GET' => array('/posts/add' => ''), 'SERVER' => array( - 'SCRIPT_NAME' => '/site/index.php', - 'PATH_TRANSLATED' => 'C:\\Inetpub\\wwwroot', - 'QUERY_STRING' => '/posts/add', - 'REQUEST_URI' => '/site/index.php/posts/add', - 'URL' => '/site/index.php/posts/add', - 'ORIG_PATH_TRANSLATED' => 'C:\\Inetpub\\wwwroot\\site\\index.php', - 'DOCUMENT_ROOT' => 'C:\\Inetpub\\wwwroot', - 'PHP_SELF' => '/site/index.php/posts/add', - 'argv' => array('/posts/add'), + 'SCRIPT_NAME' => '/site/index.php', + 'PATH_TRANSLATED' => 'C:\\Inetpub\\wwwroot', + 'QUERY_STRING' => '/posts/add', + 'REQUEST_URI' => '/site/index.php/posts/add', + 'URL' => '/site/index.php/posts/add', + 'ORIG_PATH_TRANSLATED' => 'C:\\Inetpub\\wwwroot\\site\\index.php', + 'DOCUMENT_ROOT' => 'C:\\Inetpub\\wwwroot', + 'PHP_SELF' => '/site/index.php/posts/add', + 'argv' => array('/posts/add'), 'argc' => 1 ), ), @@ -1158,16 +1158,16 @@ class CakeRequestTest extends CakeTestCase { 'Apache - No rewrite, document root set to webroot, requesting path', array( 'App' => array( - 'base' => false, - 'baseUrl' => '/index.php', - 'dir' => 'app', + 'base' => false, + 'baseUrl' => '/index.php', + 'dir' => 'app', 'webroot' => 'webroot' ), 'SERVER' => array( - 'DOCUMENT_ROOT' => '/Library/WebServer/Documents/site/app/webroot', - 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/app/webroot/index.php', - 'QUERY_STRING' => '', - 'REQUEST_URI' => '/index.php/posts/index', + 'DOCUMENT_ROOT' => '/Library/WebServer/Documents/site/app/webroot', + 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/app/webroot/index.php', + 'QUERY_STRING' => '', + 'REQUEST_URI' => '/index.php/posts/index', 'SCRIPT_NAME' => '/index.php', 'PATH_INFO' => '/posts/index', 'PHP_SELF' => '/index.php/posts/index', @@ -1183,19 +1183,19 @@ class CakeRequestTest extends CakeTestCase { 'Apache - No rewrite, document root set to webroot, requesting root', array( 'App' => array( - 'base' => false, - 'baseUrl' => '/index.php', - 'dir' => 'app', + 'base' => false, + 'baseUrl' => '/index.php', + 'dir' => 'app', 'webroot' => 'webroot' ), 'SERVER' => array( - 'DOCUMENT_ROOT' => '/Library/WebServer/Documents/site/app/webroot', - 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/app/webroot/index.php', - 'QUERY_STRING' => '', - 'REQUEST_URI' => '/index.php', - 'SCRIPT_NAME' => '/index.php', - 'PATH_INFO' => '', - 'PHP_SELF' => '/index.php', + 'DOCUMENT_ROOT' => '/Library/WebServer/Documents/site/app/webroot', + 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/app/webroot/index.php', + 'QUERY_STRING' => '', + 'REQUEST_URI' => '/index.php', + 'SCRIPT_NAME' => '/index.php', + 'PATH_INFO' => '', + 'PHP_SELF' => '/index.php', ), ), array( @@ -1208,16 +1208,16 @@ class CakeRequestTest extends CakeTestCase { 'Apache - No rewrite, document root set above top level cake dir, requesting path', array( 'App' => array( - 'base' => false, - 'baseUrl' => '/site/index.php', - 'dir' => 'app', + 'base' => false, + 'baseUrl' => '/site/index.php', + 'dir' => 'app', 'webroot' => 'webroot' ), 'SERVER' => array( - 'SERVER_NAME' => 'localhost', - 'DOCUMENT_ROOT' => '/Library/WebServer/Documents', - 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/index.php', - 'REQUEST_URI' => '/site/index.php/posts/index', + 'SERVER_NAME' => 'localhost', + 'DOCUMENT_ROOT' => '/Library/WebServer/Documents', + 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/index.php', + 'REQUEST_URI' => '/site/index.php/posts/index', 'SCRIPT_NAME' => '/site/index.php', 'PATH_INFO' => '/posts/index', 'PHP_SELF' => '/site/index.php/posts/index', @@ -1233,15 +1233,15 @@ class CakeRequestTest extends CakeTestCase { 'Apache - No rewrite, document root set above top level cake dir, request root, no PATH_INFO', array( 'App' => array( - 'base' => false, - 'baseUrl' => '/site/index.php', - 'dir' => 'app', + 'base' => false, + 'baseUrl' => '/site/index.php', + 'dir' => 'app', 'webroot' => 'webroot' ), 'SERVER' => array( - 'SERVER_NAME' => 'localhost', - 'DOCUMENT_ROOT' => '/Library/WebServer/Documents', - 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/index.php', + 'SERVER_NAME' => 'localhost', + 'DOCUMENT_ROOT' => '/Library/WebServer/Documents', + 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/index.php', 'REQUEST_URI' => '/site/index.php/', 'SCRIPT_NAME' => '/site/index.php', 'PHP_SELF' => '/site/index.php/', @@ -1257,17 +1257,17 @@ class CakeRequestTest extends CakeTestCase { 'Apache - No rewrite, document root set above top level cake dir, request path, with GET', array( 'App' => array( - 'base' => false, - 'baseUrl' => '/site/index.php', - 'dir' => 'app', + 'base' => false, + 'baseUrl' => '/site/index.php', + 'dir' => 'app', 'webroot' => 'webroot' ), 'GET' => array('a' => 'b', 'c' => 'd'), 'SERVER' => array( - 'SERVER_NAME' => 'localhost', - 'DOCUMENT_ROOT' => '/Library/WebServer/Documents', - 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/index.php', - 'REQUEST_URI' => '/site/index.php/posts/index?a=b&c=d', + 'SERVER_NAME' => 'localhost', + 'DOCUMENT_ROOT' => '/Library/WebServer/Documents', + 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/index.php', + 'REQUEST_URI' => '/site/index.php/posts/index?a=b&c=d', 'SCRIPT_NAME' => '/site/index.php', 'PATH_INFO' => '/posts/index', 'PHP_SELF' => '/site/index.php/posts/index', @@ -1291,9 +1291,9 @@ class CakeRequestTest extends CakeTestCase { 'webroot' => 'webroot' ), 'SERVER' => array( - 'SERVER_NAME' => 'localhost', - 'DOCUMENT_ROOT' => '/Library/WebServer/Documents', - 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/index.php', + 'SERVER_NAME' => 'localhost', + 'DOCUMENT_ROOT' => '/Library/WebServer/Documents', + 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/index.php', 'REQUEST_URI' => '/site/', 'SCRIPT_NAME' => '/site/app/webroot/index.php', 'PHP_SELF' => '/site/app/webroot/index.php', @@ -1315,9 +1315,9 @@ class CakeRequestTest extends CakeTestCase { 'webroot' => 'webroot' ), 'SERVER' => array( - 'SERVER_NAME' => 'localhost', - 'DOCUMENT_ROOT' => '/Library/WebServer/Documents', - 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/index.php', + 'SERVER_NAME' => 'localhost', + 'DOCUMENT_ROOT' => '/Library/WebServer/Documents', + 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/index.php', 'SCRIPT_NAME' => '/site/app/webroot/index.php', 'PHP_SELF' => '/site/app/webroot/index.php', 'PATH_INFO' => null, @@ -1340,9 +1340,9 @@ class CakeRequestTest extends CakeTestCase { 'webroot' => 'webroot' ), 'SERVER' => array( - 'SERVER_NAME' => 'localhost', - 'DOCUMENT_ROOT' => '/Library/WebServer/Documents/site/app/webroot', - 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/app/webroot/index.php', + 'SERVER_NAME' => 'localhost', + 'DOCUMENT_ROOT' => '/Library/WebServer/Documents/site/app/webroot', + 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/app/webroot/index.php', 'SCRIPT_NAME' => '/index.php', 'PHP_SELF' => '/index.php', 'PATH_INFO' => null, @@ -1366,9 +1366,9 @@ class CakeRequestTest extends CakeTestCase { ), 'GET' => array('/posts/add' => ''), 'SERVER' => array( - 'SERVER_NAME' => 'localhost', - 'DOCUMENT_ROOT' => '/Library/WebServer/Documents/site/app/webroot', - 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/app/webroot/index.php', + 'SERVER_NAME' => 'localhost', + 'DOCUMENT_ROOT' => '/Library/WebServer/Documents/site/app/webroot', + 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/app/webroot/index.php', 'SCRIPT_NAME' => '/index.php', 'QUERY_STRING' => '/posts/add&', 'PHP_SELF' => '/index.php', @@ -1438,7 +1438,7 @@ class CakeRequestTest extends CakeTestCase { $request = new CakeRequest('posts/index'); $result = $request->data('Model.new_value', 'new value'); $this->assertSame($result, $request, 'Return was not $this'); - + $this->assertEquals($request->data['Model']['new_value'], 'new value'); $request->data('Post.title', 'New post')->data('Comment.1.author', 'Mark'); @@ -1456,13 +1456,13 @@ class CakeRequestTest extends CakeTestCase { $request->data('Post.null', null); $this->assertNull($request->data['Post']['null']); - + $request->data('Post.false', false); $this->assertFalse($request->data['Post']['false']); - + $request->data('Post.zero', 0); $this->assertSame(0, $request->data['Post']['zero']); - + $request->data('Post.empty', ''); $this->assertSame('', $request->data['Post']['empty']); } @@ -1480,7 +1480,7 @@ class CakeRequestTest extends CakeTestCase { $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'es_mx;en_ca'; $result = CakeRequest::acceptLanguage(); $this->assertEquals(array('es-mx', 'en-ca'), $result, 'Languages do not match'); - + $result = CakeRequest::acceptLanguage('en-ca'); $this->assertTrue($result); @@ -1489,7 +1489,7 @@ class CakeRequestTest extends CakeTestCase { } /** - * test the here() method + * test the here() method * * @return void */ @@ -1521,7 +1521,7 @@ class CakeRequestTest extends CakeTestCase { $request = $this->getMock('CakeRequest', array('_readInput')); $request->expects($this->once())->method('_readInput') ->will($this->returnValue('I came from stdin')); - + $result = $request->input(); $this->assertEquals('I came from stdin', $result); } @@ -1540,7 +1540,7 @@ class CakeRequestTest extends CakeTestCase { $this->assertEquals(array('name' => 'value'), (array)$result); } -/** +/** * Test input() decoding with additional arguments. * * @return void @@ -1560,7 +1560,7 @@ XML; $result = $request->input('Xml::build', array('return' => 'domdocument')); $this->assertInstanceOf('DOMDocument', $result); $this->assertEquals( - 'Test', + 'Test', $result->getElementsByTagName('title')->item(0)->childNodes->item(0)->wholeText ); } diff --git a/lib/Cake/Test/Case/Routing/RouterTest.php b/lib/Cake/Test/Case/Routing/RouterTest.php index ceca433d3..f04fb4163 100644 --- a/lib/Cake/Test/Case/Routing/RouterTest.php +++ b/lib/Cake/Test/Case/Routing/RouterTest.php @@ -146,7 +146,7 @@ class RouterTest extends CakeTestCase { 'named' => array(), 'plugin' => 'test_plugin', 'controller' => 'test_plugin', - 'action' => 'index', + 'action' => 'index', '[method]' => 'GET' ); $this->assertEqual($result, $expected); @@ -186,7 +186,7 @@ class RouterTest extends CakeTestCase { 'named' => array(), 'plugin' => 'test_plugin', 'controller' => 'test_plugin', - 'action' => 'index', + 'action' => 'index', '[method]' => 'GET' ); $this->assertEqual($result, $expected); diff --git a/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php b/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php index 807b3bcd5..f5b68521f 100644 --- a/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php +++ b/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php @@ -419,9 +419,9 @@ class CakeTestFixtureTest extends CakeTestCase { /** * Helper function to be used as callback and store the parameters of an insertMulti call * - * @param string $table - * @param string $fields - * @param string $values + * @param string $table + * @param string $fields + * @param string $values * @return boolean true */ function _insertCallback($table, $fields, $values) { diff --git a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php index a7dbc1312..5bd7f2440 100644 --- a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php +++ b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php @@ -257,7 +257,7 @@ class ObjectCollectionTest extends CakeTestCase { $this->Objects->TriggerMockSecond->expects($this->once()) ->method('callback') ->will($this->returnValue(array('three', 'four'))); - + $result = $this->Objects->trigger('callback', array(), array('collectReturn' => true)); $expected = array( array('one', 'two'), @@ -402,7 +402,7 @@ class ObjectCollectionTest extends CakeTestCase { 'Apple' => array('class' => 'Banana.Apple', 'settings' => array('foo' => 'bar')), ); $this->assertEquals($expected, $result); - + // This is the result after Controller::_mergeVars $components = array( 'Html' => null, diff --git a/lib/Cake/Test/Case/Utility/SecurityTest.php b/lib/Cake/Test/Case/Utility/SecurityTest.php index d18fc659f..7758ad848 100644 --- a/lib/Cake/Test/Case/Utility/SecurityTest.php +++ b/lib/Cake/Test/Case/Utility/SecurityTest.php @@ -134,7 +134,7 @@ class SecurityTest extends CakeTestCase { $key = 'my_key'; $result = Security::cipher($txt, $key); $this->assertEqual(Security::cipher($result, $key), $txt); - + $txt = 123456; $key = 'my_key'; $result = Security::cipher($txt, $key); diff --git a/lib/Cake/Test/Case/Utility/StringTest.php b/lib/Cake/Test/Case/Utility/StringTest.php index f4b04f60a..f78326014 100644 --- a/lib/Cake/Test/Case/Utility/StringTest.php +++ b/lib/Cake/Test/Case/Utility/StringTest.php @@ -322,7 +322,7 @@ TEXT; This is the song th at never ends. This is the song that n -ever ends. This is +ever ends. This is the song that never ends. TEXT; diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 27411b6f2..c6a45b4d6 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -845,7 +845,7 @@ class FormHelperTest extends CakeTestCase { ); $this->assertTags($result, $expected); } - + /** * Tests correct generation of number fields for integer fields * @@ -1610,7 +1610,7 @@ class FormHelperTest extends CakeTestCase { '/div' ); $this->assertTags($result, $expected); - + $result = $this->Form->error( 'ValidateUser.email', 'Invalid email', array('wrap' => false) ); @@ -7479,7 +7479,7 @@ class FormHelperTest extends CakeTestCase { 'input' => array('type' => 'text', 'name' => 'data[User][query]', 'id' => 'UserQuery', 'value' => 'test') ); $this->assertTags($result, $expected); - + $result = $this->Form->input('User.website', array('type' => 'url', 'value' => 'http://domain.tld', 'div' => false, 'label' => false)); $expected = array( 'input' => array('type' => 'url', 'name' => 'data[User][website]', 'id' => 'UserWebsite', 'value' => 'http://domain.tld') diff --git a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php index f76b5e2e7..d2115a51d 100644 --- a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php @@ -798,7 +798,7 @@ class HtmlHelperTest extends CakeTestCase { */ public function testBreadcrumb() { $this->assertNull($this->Html->getCrumbs()); - + $this->Html->addCrumb('First', '#first'); $this->Html->addCrumb('Second', '#second'); $this->Html->addCrumb('Third', '#third'); diff --git a/lib/Cake/Test/Case/View/Helper/RssHelperTest.php b/lib/Cake/Test/Case/View/Helper/RssHelperTest.php index 5e0a2ee52..df70fff54 100644 --- a/lib/Cake/Test/Case/View/Helper/RssHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/RssHelperTest.php @@ -576,7 +576,7 @@ class RssHelperTest extends CakeTestCase { $File = new File($tmpFile, true, '0777'); $this->assertTrue($File->write('123'), 'Could not write to ' . $tmpFile); clearstatcache(true, $tmpFile); - + $item = array( 'title' => array( 'value' => 'My Title', diff --git a/lib/Cake/Test/Case/View/Helper/TimeHelperTest.php b/lib/Cake/Test/Case/View/Helper/TimeHelperTest.php index 14dd0ede9..672d63efc 100644 --- a/lib/Cake/Test/Case/View/Helper/TimeHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/TimeHelperTest.php @@ -403,8 +403,8 @@ class TimeHelperTest extends CakeTestCase { $yourTimezone = new DateTimeZone($timezone); $yourTime = new DateTime('now', $yourTimezone); $userOffset = $yourTimezone->getOffset($yourTime) / HOUR; - $this->assertEqual($yourTime->format('r'), $this->Time->toRss(time(), $userOffset)); - } + $this->assertEqual($yourTime->format('r'), $this->Time->toRss(time(), $userOffset)); + } } } diff --git a/lib/Cake/Test/Fixture/FixturizedTestCase.php b/lib/Cake/Test/Fixture/FixturizedTestCase.php index cd9cdd22c..fc2436ac1 100644 --- a/lib/Cake/Test/Fixture/FixturizedTestCase.php +++ b/lib/Cake/Test/Fixture/FixturizedTestCase.php @@ -11,7 +11,7 @@ class FixturizedTestCase extends CakeTestCase { /** * Fixtures to use in this thes - * @var array + * @var array */ public $fixtures = array('core.category'); diff --git a/lib/Cake/Test/test_app/Lib/Cache/Engine/TestAppCacheEngine.php b/lib/Cake/Test/test_app/Lib/Cache/Engine/TestAppCacheEngine.php index ef8d58311..c672dc1ad 100644 --- a/lib/Cake/Test/test_app/Lib/Cache/Engine/TestAppCacheEngine.php +++ b/lib/Cake/Test/test_app/Lib/Cache/Engine/TestAppCacheEngine.php @@ -18,7 +18,7 @@ */ class TestAppCacheEngine extends CacheEngine { - public function write($key, $value, $duration) { + public function write($key, $value, $duration) { if ($key == 'fail') { return false; } diff --git a/lib/Cake/Test/test_app/Lib/Log/Engine/TestAppLog.php b/lib/Cake/Test/test_app/Lib/Log/Engine/TestAppLog.php index 4dc699a87..7441a2f97 100644 --- a/lib/Cake/Test/test_app/Lib/Log/Engine/TestAppLog.php +++ b/lib/Cake/Test/test_app/Lib/Log/Engine/TestAppLog.php @@ -22,6 +22,6 @@ App::uses('CakeLogInterface', 'Log'); class TestAppLog implements CakeLogInterface { public function write($type, $message) { - + } } diff --git a/lib/Cake/Test/test_app/Locale/ja_jp/LC_TIME b/lib/Cake/Test/test_app/Locale/ja_jp/LC_TIME index 2f1efb868..f70592d9e 100644 --- a/lib/Cake/Test/test_app/Locale/ja_jp/LC_TIME +++ b/lib/Cake/Test/test_app/Locale/ja_jp/LC_TIME @@ -23,7 +23,7 @@ mon "";"";/ "";"";/ "";"" % Appropriate date and time representation (%c) -% +% d_t_fmt "" % % Appropriate date representation (%x) @@ -31,18 +31,18 @@ d_t_fmt "< d_fmt "" % % Appropriate time representation (%X) -% +% t_fmt "" % % Appropriate AM/PM time representation (%r) -% +% t_fmt_ampm "" % % Strings for AM/PM % am_pm "";"" % -% Appropriate date representation (date(1)) +% Appropriate date representation (date(1)) date_fmt "/ / " diff --git a/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php b/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php index 93529c267..c16387b39 100644 --- a/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php +++ b/lib/Cake/Test/test_app/Model/Datasource/Session/TestAppLibSession.php @@ -10,22 +10,22 @@ class TestAppLibSession implements CakeSessionHandlerInterface { } public function close() { - + } public function read($id) { - + } public function write($id, $data) { - + } public function destroy($id) { - + } public function gc($expires = null) { - + } } \ No newline at end of file diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Console/Command/Task/other_task.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Console/Command/Task/other_task.php index ded321cc0..990c2bc40 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/Console/Command/Task/other_task.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Console/Command/Task/other_task.php @@ -17,5 +17,5 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ class OtherTaskTask extends Shell { - + } \ No newline at end of file diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/TestPluginController.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/TestPluginController.php index 075c78c08..e8c6732eb 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/TestPluginController.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/TestPluginController.php @@ -18,7 +18,7 @@ */ class TestPluginController extends TestPluginAppController { public $uses = array(); - + public function index() { $this->autoRender = false; } diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/Cache/Engine/TestPluginCacheEngine.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/Cache/Engine/TestPluginCacheEngine.php index c372b46ae..831e63727 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/Cache/Engine/TestPluginCacheEngine.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/Cache/Engine/TestPluginCacheEngine.php @@ -29,5 +29,5 @@ class TestPluginCacheEngine extends CacheEngine { public function delete($key) { } public function clear($check) { } - + } diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/Log/Engine/TestPluginLog.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/Log/Engine/TestPluginLog.php index 9e99ed6ff..4b0ef514f 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/Log/Engine/TestPluginLog.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/Log/Engine/TestPluginLog.php @@ -19,6 +19,6 @@ class TestPluginLog implements CakeLogInterface { public function write($type, $message) { - + } } diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php index 35a60d6e8..13657561f 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/Session/TestPluginSession.php @@ -9,22 +9,22 @@ class TestPluginSession implements CakeSessionHandlerInterface { } public function close() { - + } public function read($id) { - + } public function write($id, $data) { - + } public function destroy($id) { - + } public function gc($expires = null) { - + } } \ No newline at end of file diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/View/Helper/TestPluginAppHelper.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/View/Helper/TestPluginAppHelper.php index a95374c3e..cf5d5b200 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/View/Helper/TestPluginAppHelper.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/View/Helper/TestPluginAppHelper.php @@ -1,5 +1,5 @@ Html->link('Test link', '#'); ?> \ No newline at end of file diff --git a/lib/Cake/TestSuite/CakeTestCase.php b/lib/Cake/TestSuite/CakeTestCase.php index dfdac30fb..0a5db7b55 100644 --- a/lib/Cake/TestSuite/CakeTestCase.php +++ b/lib/Cake/TestSuite/CakeTestCase.php @@ -494,9 +494,9 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { /** * Compatibility wrapper for assertIsA * - * @param string $object - * @param string $type - * @param string $message + * @param string $object + * @param string $type + * @param string $message * @return void */ protected static function assertIsA($object, $type, $message = '') { diff --git a/lib/Cake/TestSuite/CakeTestRunner.php b/lib/Cake/TestSuite/CakeTestRunner.php index e8c2791c9..d4dc0e14b 100644 --- a/lib/Cake/TestSuite/CakeTestRunner.php +++ b/lib/Cake/TestSuite/CakeTestRunner.php @@ -38,8 +38,8 @@ class CakeTestRunner extends PHPUnit_TextUI_TestRunner { /** * Actually run a suite of tests. Cake initializes fixtures here using the chosen fixture manager * - * @param PHPUnit_Framework_Test $suite - * @param array $arguments + * @param PHPUnit_Framework_Test $suite + * @param array $arguments * @return void */ public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array()) { diff --git a/lib/Cake/TestSuite/ControllerTestCase.php b/lib/Cake/TestSuite/ControllerTestCase.php index 22ab2930e..7bebd7695 100644 --- a/lib/Cake/TestSuite/ControllerTestCase.php +++ b/lib/Cake/TestSuite/ControllerTestCase.php @@ -64,7 +64,7 @@ class ControllerTestDispatcher extends Dispatcher { /** * Loads routes and resets if the test case dictates it should - * + * * @return void */ protected function _loadRoutes() { @@ -190,7 +190,7 @@ abstract class ControllerTestCase extends CakeTestCase { * - `vars` Get the set view variables. * - `view` Get the rendered view, without a layout. * - `contents` Get the rendered view including the layout. - * - `result` Get the return value of the controller action. Useful + * - `result` Get the return value of the controller action. Useful * for testing requestAction methods. * * @param string $url The url to test @@ -260,7 +260,7 @@ abstract class ControllerTestCase extends CakeTestCase { * Generates a mocked controller and mocks any classes passed to `$mocks`. By * default, `_stop()` is stubbed as is sending the response headers, so to not * interfere with testing. - * + * * ### Mocks: * * - `methods` Methods to mock on the controller. `_stop()` is mocked by default @@ -289,10 +289,10 @@ abstract class ControllerTestCase extends CakeTestCase { )); } ClassRegistry::flush(); - + $mocks = array_merge_recursive(array( 'methods' => array('_stop'), - 'models' => array(), + 'models' => array(), 'components' => array() ), (array)$mocks); diff --git a/lib/Cake/TestSuite/Fixture/CakeTestFixture.php b/lib/Cake/TestSuite/Fixture/CakeTestFixture.php index 9aedd486b..e2756ad4b 100644 --- a/lib/Cake/TestSuite/Fixture/CakeTestFixture.php +++ b/lib/Cake/TestSuite/Fixture/CakeTestFixture.php @@ -188,7 +188,7 @@ class CakeTestFixture { } $this->Schema->build(array($this->table => $this->fields)); try { - + $db->execute($db->dropSchema($this->Schema), array('log' => false)); } catch (Exception $e) { return false; diff --git a/lib/Cake/TestSuite/Reporter/CakeTextReporter.php b/lib/Cake/TestSuite/Reporter/CakeTextReporter.php index 5978468ad..8de7269dc 100644 --- a/lib/Cake/TestSuite/Reporter/CakeTextReporter.php +++ b/lib/Cake/TestSuite/Reporter/CakeTextReporter.php @@ -61,7 +61,7 @@ class CakeTextReporter extends CakeBaseReporter { $context = $context[2]; printf( - "FAIL on line %s\n%s in\n%s %s()\n\n", + "FAIL on line %s\n%s in\n%s %s()\n\n", $context['line'], $message->toString(), $context['file'], $realContext['function'] ); } @@ -80,7 +80,7 @@ class CakeTextReporter extends CakeBaseReporter { echo "FAILURES!!!\n"; } - echo "Test cases run: " . $result->count() . + echo "Test cases run: " . $result->count() . "/" . ($result->count() - $result->skippedCount()) . ', Passes: ' . $this->numAssertions . ', Failures: ' . $result->failureCount() . diff --git a/lib/Cake/Utility/Debugger.php b/lib/Cake/Utility/Debugger.php index 54ae3d5cf..5c83fd122 100644 --- a/lib/Cake/Utility/Debugger.php +++ b/lib/Cake/Utility/Debugger.php @@ -547,8 +547,8 @@ class Debugger { * * `Debugger::addFormat('custom', $data);` * - * Where $data is an array of strings that use String::insert() variable - * replacement. The template vars should be in a `{:id}` style. + * Where $data is an array of strings that use String::insert() variable + * replacement. The template vars should be in a `{:id}` style. * An error formatter can have the following keys: * * - 'error' - Used for the container for the error message. Gets the following template @@ -557,11 +557,11 @@ class Debugger { * the contents of the other template keys. * - 'trace' - The container for a stack trace. Gets the following template * variables: `trace` - * - 'context' - The container element for the context variables. + * - 'context' - The container element for the context variables. * Gets the following templates: `id`, `context` * - 'links' - An array of HTML links that are used for creating links to other resources. * Typically this is used to create javascript links to open other sections. - * Link keys, are: `code`, `context`, `help`. See the js output format for an + * Link keys, are: `code`, `context`, `help`. See the js output format for an * example. * - 'traceLine' - Used for creating lines in the stacktrace. Gets the following * template variables: `reference`, `path`, `line` @@ -599,14 +599,14 @@ class Debugger { } /** - * Switches output format, updates format strings. + * Switches output format, updates format strings. * Can be used to switch the active output format: * * @param string $format Format to use, including 'js' for JavaScript-enhanced HTML, 'html' for * straight HTML output, or 'txt' for unformatted text. * @param array $strings Template strings to be used for the output format. * @return string - * @deprecated Use Debugger::outputAs() and Debugger::addFormat(). Will be removed + * @deprecated Use Debugger::outputAs() and Debugger::addFormat(). Will be removed * in 3.0 */ public function output($format = null, $strings = array()) { diff --git a/lib/Cake/View/Elements/sql_dump.ctp b/lib/Cake/View/Elements/sql_dump.ctp index 82aca3052..b022370e4 100644 --- a/lib/Cake/View/Elements/sql_dump.ctp +++ b/lib/Cake/View/Elements/sql_dump.ctp @@ -1,6 +1,6 @@ - Encountered unexpected $logs cannot generate SQL log

'; diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 26c014602..b918df048 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -271,7 +271,7 @@ class FormHelper extends AppHelper { * Returns false if given form field described by the current entity has no errors. * Otherwise it returns the validation message * - * @return mixed Either false when there or no errors, or the error + * @return mixed Either false when there or no errors, or the error * string. The error string could be ''. */ public function tagIsInvalid() { diff --git a/lib/Cake/View/Pages/home.ctp b/lib/Cake/View/Pages/home.ctp index 9c2b3ea23..76f333265 100644 --- a/lib/Cake/View/Pages/home.ctp +++ b/lib/Cake/View/Pages/home.ctp @@ -36,7 +36,7 @@ endif; 2) I don't / can't use URL rewriting

-=')): echo ''; echo __d('cake_dev', 'Your version of PHP is 5.2.6 or higher.'); diff --git a/lib/Cake/View/Scaffolds/index.ctp b/lib/Cake/View/Scaffolds/index.ctp index 0b5434004..2e608505a 100644 --- a/lib/Cake/View/Scaffolds/index.ctp +++ b/lib/Cake/View/Scaffolds/index.ctp @@ -49,8 +49,8 @@ foreach (${$pluralVar} as ${$singularVar}): echo $this->Html->link(__d('cake', 'View'), array('action' => 'view', ${$singularVar}[$modelClass][$primaryKey])); echo $this->Html->link(__d('cake', 'Edit'), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey])); echo $this->Form->postLink( - __d('cake', 'Delete'), - array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), + __d('cake', 'Delete'), + array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __d('cake', 'Are you sure you want to delete').' #' . ${$singularVar}[$modelClass][$primaryKey] ); From e682b446e6229cbc6fe435af8987b43cf3617b5c Mon Sep 17 00:00:00 2001 From: Juan Basso Date: Fri, 28 Oct 2011 18:48:38 -0400 Subject: [PATCH 19/43] Added space back to not break the test case. --- lib/Cake/Test/Case/Utility/StringTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/Utility/StringTest.php b/lib/Cake/Test/Case/Utility/StringTest.php index f78326014..f4b04f60a 100644 --- a/lib/Cake/Test/Case/Utility/StringTest.php +++ b/lib/Cake/Test/Case/Utility/StringTest.php @@ -322,7 +322,7 @@ TEXT; This is the song th at never ends. This is the song that n -ever ends. This is +ever ends. This is the song that never ends. TEXT; From 14efc4daae12078ba6fed06fb86adb8fc64529a9 Mon Sep 17 00:00:00 2001 From: Majna Date: Sat, 29 Oct 2011 00:51:40 +0200 Subject: [PATCH 20/43] Added missing 'write' param for schema dump shell. Fixes #2179. --- lib/Cake/Console/Command/SchemaShell.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Console/Command/SchemaShell.php b/lib/Cake/Console/Command/SchemaShell.php index 2705ffb89..259391223 100644 --- a/lib/Cake/Console/Command/SchemaShell.php +++ b/lib/Cake/Console/Command/SchemaShell.php @@ -498,7 +498,7 @@ class SchemaShell extends Shell { ))->addSubcommand('dump', array( 'help' => __d('cake_console', 'Dump database SQL based on a schema file to stdout.'), 'parser' => array( - 'options' => compact('plugin', 'path', 'file', 'name', 'connection'), + 'options' => compact('plugin', 'path', 'file', 'name', 'connection', 'write'), 'arguments' => compact('name') ) ))->addSubcommand('create', array( From ce9bb6b632858d80467d269a6970c229c670698b Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 28 Oct 2011 21:35:43 -0400 Subject: [PATCH 21/43] Fix validation detection in FormHelper string values for validation means a single validation method. That implies the field is required. Fixes #2181 --- .../Test/Case/View/Helper/FormHelperTest.php | 247 ++++++++++-------- lib/Cake/View/Helper/FormHelper.php | 6 +- 2 files changed, 140 insertions(+), 113 deletions(-) diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index c6a45b4d6..a3dc8c243 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -104,6 +104,7 @@ class Contact extends CakeTestModel { 'non_existing' => array(), 'idontexist' => array(), 'imrequired' => array('rule' => array('between', 5, 30), 'allowEmpty' => false), + 'string_required' => 'notEmpty', 'imalsorequired' => array('rule' => 'alphaNumeric', 'allowEmpty' => false), 'imrequiredtoo' => array('rule' => 'notEmpty'), 'required_one' => array('required' => array('rule' => array('notEmpty'))), @@ -6584,6 +6585,141 @@ class FormHelperTest extends CakeTestCase { $this->assertTags($result, $expected); } +/** + * Test that required fields are created for various types of validation. + * + * @return void + */ + function testFormInputRequiredDetection() { + $this->Form->create('Contact'); + + $result = $this->Form->input('Contact.non_existing'); + $expected = array( + 'div' => array('class' => 'input text required'), + 'label' => array('for' => 'ContactNonExisting'), + 'Non Existing', + '/label', + 'input' => array( + 'type' => 'text', 'name' => 'data[Contact][non_existing]', + 'id' => 'ContactNonExisting' + ), + '/div' + ); + $this->assertTags($result, $expected); + + $result = $this->Form->input('Contact.imrequired'); + $expected = array( + 'div' => array('class' => 'input text required'), + 'label' => array('for' => 'ContactImrequired'), + 'Imrequired', + '/label', + 'input' => array( + 'type' => 'text', 'name' => 'data[Contact][imrequired]', + 'id' => 'ContactImrequired' + ), + '/div' + ); + $this->assertTags($result, $expected); + + $result = $this->Form->input('Contact.imalsorequired'); + $expected = array( + 'div' => array('class' => 'input text required'), + 'label' => array('for' => 'ContactImalsorequired'), + 'Imalsorequired', + '/label', + 'input' => array( + 'type' => 'text', 'name' => 'data[Contact][imalsorequired]', + 'id' => 'ContactImalsorequired' + ), + '/div' + ); + $this->assertTags($result, $expected); + + $result = $this->Form->input('Contact.imrequiredtoo'); + $expected = array( + 'div' => array('class' => 'input text required'), + 'label' => array('for' => 'ContactImrequiredtoo'), + 'Imrequiredtoo', + '/label', + 'input' => array( + 'type' => 'text', 'name' => 'data[Contact][imrequiredtoo]', + 'id' => 'ContactImrequiredtoo' + ), + '/div' + ); + $this->assertTags($result, $expected); + + $result = $this->Form->input('Contact.required_one'); + $expected = array( + 'div' => array('class' => 'input text required'), + 'label' => array('for' => 'ContactRequiredOne'), + 'Required One', + '/label', + 'input' => array( + 'type' => 'text', 'name' => 'data[Contact][required_one]', + 'id' => 'ContactRequiredOne' + ), + '/div' + ); + $this->assertTags($result, $expected); + + $result = $this->Form->input('Contact.string_required'); + $expected = array( + 'div' => array('class' => 'input text required'), + 'label' => array('for' => 'ContactStringRequired'), + 'String Required', + '/label', + 'input' => array( + 'type' => 'text', 'name' => 'data[Contact][string_required]', + 'id' => 'ContactStringRequired' + ), + '/div' + ); + $this->assertTags($result, $expected); + + $result = $this->Form->input('Contact.imnotrequired'); + $expected = array( + 'div' => array('class' => 'input text'), + 'label' => array('for' => 'ContactImnotrequired'), + 'Imnotrequired', + '/label', + 'input' => array( + 'type' => 'text', 'name' => 'data[Contact][imnotrequired]', + 'id' => 'ContactImnotrequired' + ), + '/div' + ); + $this->assertTags($result, $expected); + + $result = $this->Form->input('Contact.imalsonotrequired'); + $expected = array( + 'div' => array('class' => 'input text'), + 'label' => array('for' => 'ContactImalsonotrequired'), + 'Imalsonotrequired', + '/label', + 'input' => array( + 'type' => 'text', 'name' => 'data[Contact][imalsonotrequired]', + 'id' => 'ContactImalsonotrequired' + ), + '/div' + ); + $this->assertTags($result, $expected); + + $result = $this->Form->input('Contact.imnotrequiredeither'); + $expected = array( + 'div' => array('class' => 'input text'), + 'label' => array('for' => 'ContactImnotrequiredeither'), + 'Imnotrequiredeither', + '/label', + 'input' => array( + 'type' => 'text', 'name' => 'data[Contact][imnotrequiredeither]', + 'id' => 'ContactImnotrequiredeither' + ), + '/div' + ); + $this->assertTags($result, $expected); + } + /** * testFormMagicInput method * @@ -6671,117 +6807,6 @@ class FormHelperTest extends CakeTestCase { ); $this->assertTags($result, $expected); - $result = $this->Form->input('Contact.non_existing'); - $expected = array( - 'div' => array('class' => 'input text required'), - 'label' => array('for' => 'ContactNonExisting'), - 'Non Existing', - '/label', - 'input' => array( - 'type' => 'text', 'name' => 'data[Contact][non_existing]', - 'id' => 'ContactNonExisting' - ), - '/div' - ); - $this->assertTags($result, $expected); - - $result = $this->Form->input('Contact.imrequired'); - $expected = array( - 'div' => array('class' => 'input text required'), - 'label' => array('for' => 'ContactImrequired'), - 'Imrequired', - '/label', - 'input' => array( - 'type' => 'text', 'name' => 'data[Contact][imrequired]', - 'id' => 'ContactImrequired' - ), - '/div' - ); - $this->assertTags($result, $expected); - - $result = $this->Form->input('Contact.imalsorequired'); - $expected = array( - 'div' => array('class' => 'input text required'), - 'label' => array('for' => 'ContactImalsorequired'), - 'Imalsorequired', - '/label', - 'input' => array( - 'type' => 'text', 'name' => 'data[Contact][imalsorequired]', - 'id' => 'ContactImalsorequired' - ), - '/div' - ); - $this->assertTags($result, $expected); - - $result = $this->Form->input('Contact.imrequiredtoo'); - $expected = array( - 'div' => array('class' => 'input text required'), - 'label' => array('for' => 'ContactImrequiredtoo'), - 'Imrequiredtoo', - '/label', - 'input' => array( - 'type' => 'text', 'name' => 'data[Contact][imrequiredtoo]', - 'id' => 'ContactImrequiredtoo' - ), - '/div' - ); - $this->assertTags($result, $expected); - - $result = $this->Form->input('Contact.required_one'); - $expected = array( - 'div' => array('class' => 'input text required'), - 'label' => array('for' => 'ContactRequiredOne'), - 'Required One', - '/label', - 'input' => array( - 'type' => 'text', 'name' => 'data[Contact][required_one]', - 'id' => 'ContactRequiredOne' - ), - '/div' - ); - $this->assertTags($result, $expected); - - $result = $this->Form->input('Contact.imnotrequired'); - $expected = array( - 'div' => array('class' => 'input text'), - 'label' => array('for' => 'ContactImnotrequired'), - 'Imnotrequired', - '/label', - 'input' => array( - 'type' => 'text', 'name' => 'data[Contact][imnotrequired]', - 'id' => 'ContactImnotrequired' - ), - '/div' - ); - $this->assertTags($result, $expected); - - $result = $this->Form->input('Contact.imalsonotrequired'); - $expected = array( - 'div' => array('class' => 'input text'), - 'label' => array('for' => 'ContactImalsonotrequired'), - 'Imalsonotrequired', - '/label', - 'input' => array( - 'type' => 'text', 'name' => 'data[Contact][imalsonotrequired]', - 'id' => 'ContactImalsonotrequired' - ), - '/div' - ); - $this->assertTags($result, $expected); - - $result = $this->Form->input('Contact.imnotrequiredeither'); - $expected = array( - 'div' => array('class' => 'input text'), - 'label' => array('for' => 'ContactImnotrequiredeither'), - 'Imnotrequiredeither', - '/label', - 'input' => array( - 'type' => 'text', 'name' => 'data[Contact][imnotrequiredeither]', - 'id' => 'ContactImnotrequiredeither' - ), - '/div' - ); - $this->assertTags($result, $expected); extract($this->dateRegex); $now = strtotime('now'); diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index b918df048..580d75a08 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -239,14 +239,16 @@ class FormHelper extends AppHelper { } /** - * Returns if a field is required to be filled based on validation properties from the validating object + * Returns if a field is required to be filled based on validation properties from the validating object. * * @param array $validateProperties * @return boolean true if field is required to be filled, false otherwise */ protected function _isRequiredField($validateProperties) { $required = false; - if (is_array($validateProperties)) { + if (is_string($validateProperties)) { + return true; + } elseif (is_array($validateProperties)) { $dims = Set::countDim($validateProperties); if ($dims == 1 || ($dims == 2 && isset($validateProperties['rule']))) { From 60e3f02eac982d5b20ab2c896009068a865e118a Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Fri, 28 Oct 2011 23:45:31 -0430 Subject: [PATCH 22/43] Setting a correct Content-Length for plugin assets --- lib/Cake/Routing/Dispatcher.php | 3 +++ lib/Cake/Test/Case/Routing/DispatcherTest.php | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/Cake/Routing/Dispatcher.php b/lib/Cake/Routing/Dispatcher.php index f60ffefc9..a49c737ac 100644 --- a/lib/Cake/Routing/Dispatcher.php +++ b/lib/Cake/Routing/Dispatcher.php @@ -315,6 +315,9 @@ class Dispatcher { } $response->type($contentType); } + if (!$compressionEnabled) { + $response->header('Content-Length', filesize($assetFile)); + } $response->cache(filemtime($assetFile)); $response->send(); ob_clean(); diff --git a/lib/Cake/Test/Case/Routing/DispatcherTest.php b/lib/Cake/Test/Case/Routing/DispatcherTest.php index 8602909cf..05ce608cd 100644 --- a/lib/Cake/Test/Case/Routing/DispatcherTest.php +++ b/lib/Cake/Test/Case/Routing/DispatcherTest.php @@ -1291,6 +1291,14 @@ class DispatcherTest extends CakeTestCase { $result = ob_get_clean(); $this->assertEqual('htc file', $result); + $response = $this->getMock('CakeResponse', array('_sendHeader')); + ob_start(); + $Dispatcher->asset('test_plugin/css/unknown.extension', $response); + ob_end_clean(); + $expected = filesize(CakePlugin::path('TestPlugin') . 'webroot' . DS . 'css' . DS . 'unknown.extension'); + $headers = $response->header(); + $this->assertEqual($expected, $headers['Content-Length']); + if (php_sapi_name() == 'cli') { while (ob_get_level()) { ob_get_clean(); From 09579198a94422ea0195f662f52c409e317e2e21 Mon Sep 17 00:00:00 2001 From: Daniel Pakuschewski Date: Sat, 29 Oct 2011 13:54:35 -0200 Subject: [PATCH 23/43] Droped support to deny('*'). --- lib/Cake/Controller/Component/AuthComponent.php | 5 +++-- .../Case/Controller/Component/AuthComponentTest.php | 11 ++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index a1dae987f..83c6dab1f 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -452,7 +452,8 @@ class AuthComponent extends Component { * You can use deny with either an array, or var args. * * `$this->Auth->deny(array('edit', 'add'));` or - * `$this->Auth->deny('edit', 'add');` + * `$this->Auth->deny('edit', 'add');` or + * `$this->Auth->deny();` to remove all items from the allowed list * * @param mixed $action,... Controller action name or array of actions * @return void @@ -461,7 +462,7 @@ class AuthComponent extends Component { */ public function deny($action = null) { $args = func_get_args(); - if(empty($args) || $args == array('*')){ + if(empty($args)){ $this->allowedActions = array(); }else{ if (isset($args[0]) && is_array($args[0])) { diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index fa718f11c..9bbc0002f 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -638,7 +638,7 @@ class AuthComponentTest extends CakeTestCase { $this->assertFalse($this->Controller->Auth->startup($this->Controller)); $this->Controller->Auth->allow('*'); - $this->Controller->Auth->deny('*'); + $this->Controller->Auth->deny(); $this->Controller->request['action'] = 'camelCase'; $this->assertFalse($this->Controller->Auth->startup($this->Controller)); @@ -655,6 +655,15 @@ class AuthComponentTest extends CakeTestCase { $this->Controller->request['action'] = 'login'; $this->assertFalse($this->Controller->Auth->startup($this->Controller)); + $this->Controller->Auth->allow(); + $this->Controller->Auth->deny('*'); + + $this->Controller->request['action'] = 'camelCase'; + $this->assertTrue($this->Controller->Auth->startup($this->Controller)); + + $this->Controller->request['action'] = 'login'; + $this->assertTrue($this->Controller->Auth->startup($this->Controller)); + } /** From 7cde0b654c6694f133d7f303890702885300c2e1 Mon Sep 17 00:00:00 2001 From: Daniel Pakuschewski Date: Sat, 29 Oct 2011 13:57:04 -0200 Subject: [PATCH 24/43] Removed tests for deny('*') to prevent people get confused with it --- .../Case/Controller/Component/AuthComponentTest.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index 9bbc0002f..4e2aa268a 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -654,16 +654,6 @@ class AuthComponentTest extends CakeTestCase { $this->Controller->request['action'] = 'login'; $this->assertFalse($this->Controller->Auth->startup($this->Controller)); - - $this->Controller->Auth->allow(); - $this->Controller->Auth->deny('*'); - - $this->Controller->request['action'] = 'camelCase'; - $this->assertTrue($this->Controller->Auth->startup($this->Controller)); - - $this->Controller->request['action'] = 'login'; - $this->assertTrue($this->Controller->Auth->startup($this->Controller)); - } /** From 92f9a6c1dbf4886dfc5d031cdd228969776dac00 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 29 Oct 2011 20:42:07 -0400 Subject: [PATCH 25/43] Fix missing urlencod/urldecode in routing. Named params and passed args should be urlencoded, as they may contain non-ascii characters. Refs GH-214 --- lib/Cake/Routing/Route/CakeRoute.php | 12 ++++++------ lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/Cake/Routing/Route/CakeRoute.php b/lib/Cake/Routing/Route/CakeRoute.php index 8a962f11d..0c007d1a4 100644 --- a/lib/Cake/Routing/Route/CakeRoute.php +++ b/lib/Cake/Routing/Route/CakeRoute.php @@ -272,11 +272,11 @@ class CakeRoute { $separatorIsPresent = strpos($param, $namedConfig['separator']) !== false; if ((!isset($this->options['named']) || !empty($this->options['named'])) && $separatorIsPresent) { list($key, $val) = explode($namedConfig['separator'], $param, 2); - $val = urldecode($val); + $val = rawurldecode($val); $hasRule = isset($rules[$key]); $passIt = (!$hasRule && !$greedy) || ($hasRule && !$this->_matchNamed($val, $rules[$key], $context)); if ($passIt) { - $pass[] = $param; + $pass[] = rawurldecode($param); } else { if (preg_match_all('/\[([A-Za-z0-9_-]+)?\]/', $key, $matches, PREG_SET_ORDER)) { $matches = array_reverse($matches); @@ -297,7 +297,7 @@ class CakeRoute { $named = array_merge_recursive($named, array($key => $val)); } } else { - $pass[] = $param; + $pass[] = rawurldecode($param); } } return array($pass, $named); @@ -463,7 +463,7 @@ class CakeRoute { } if (is_array($params['pass'])) { - $params['pass'] = implode('/', $params['pass']); + $params['pass'] = implode('/', array_map('rawurlencode', $params['pass'])); } $namedConfig = Router::namedConfig(); @@ -474,10 +474,10 @@ class CakeRoute { foreach ($params['named'] as $key => $value) { if (is_array($value)) { foreach ($value as $namedKey => $namedValue) { - $named[] = $key . "[$namedKey]" . $separator . $namedValue; + $named[] = $key . "[$namedKey]" . $separator . rawurlencode($namedValue); } } else { - $named[] = $key . $separator . $value; + $named[] = $key . $separator . rawurlencode($value); } } $params['pass'] = $params['pass'] . '/' . implode('/', $named); diff --git a/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php b/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php index 7f310d831..fb832c458 100644 --- a/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php +++ b/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php @@ -369,6 +369,8 @@ class CakeRouteTest extends CakeTestCase { $result = $route->match(array('controller' => 'posts', 'action' => 'view', 'plugin' => null, 5, 'page' => 1, 'limit' => 20, 'order' => 'title')); $this->assertEqual($result, '/posts/view/5/page:1/limit:20/order:title'); + $result = $route->match(array('controller' => 'posts', 'action' => 'view', 'plugin' => null, 'word space', 'order' => 'Θ')); + $this->assertEqual($result, '/posts/view/word%20space/order:%CE%98'); $route = new CakeRoute('/test2/*', array('controller' => 'pages', 'action' => 'display', 2)); $result = $route->match(array('controller' => 'pages', 'action' => 'display', 1)); @@ -395,6 +397,10 @@ class CakeRouteTest extends CakeTestCase { $result = $route->parse('/posts/index/page[]:%CE%98'); $this->assertEquals('Θ', $result['named']['page'][0]); + + $result = $route->parse('/posts/index/something%20else/page[]:%CE%98'); + $this->assertEquals('Θ', $result['named']['page'][0]); + $this->assertEquals('something else', $result['pass'][0]); } /** From d49096aab93ee2cd99faf4fef7bd2d709dddc071 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Sun, 30 Oct 2011 18:25:43 -0430 Subject: [PATCH 26/43] Fixing DbConfigTask to produce correct configurations --- lib/Cake/Console/Command/Task/DbConfigTask.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Console/Command/Task/DbConfigTask.php b/lib/Cake/Console/Command/Task/DbConfigTask.php index 4a274beaa..20469bcd3 100644 --- a/lib/Cake/Console/Command/Task/DbConfigTask.php +++ b/lib/Cake/Console/Command/Task/DbConfigTask.php @@ -283,7 +283,7 @@ class DbConfigTask extends Shell { $oldConfigs[] = array( 'name' => $configName, - 'driver' => $info['driver'], + 'datasource' => $info['datasource'], 'persistent' => $info['persistent'], 'host' => $info['host'], 'port' => $info['port'], From 7141dff5d13662aed9aa36df536d2af022ea8fb1 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Sun, 30 Oct 2011 18:28:32 -0430 Subject: [PATCH 27/43] Releasing 2.0.1 --- lib/Cake/Config/config.php | 2 +- lib/Cake/VERSION.txt | 3 ++- lib/Cake/View/Pages/home.ctp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Config/config.php b/lib/Cake/Config/config.php index 362222f5c..8ed27662a 100644 --- a/lib/Cake/Config/config.php +++ b/lib/Cake/Config/config.php @@ -16,4 +16,4 @@ * @since CakePHP(tm) v 1.1.11.4062 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -return $config['Cake.version'] = '2.0.0'; +return $config['Cake.version'] = '2.0.1'; diff --git a/lib/Cake/VERSION.txt b/lib/Cake/VERSION.txt index 604b280cf..fbbf5a420 100644 --- a/lib/Cake/VERSION.txt +++ b/lib/Cake/VERSION.txt @@ -17,6 +17,7 @@ // @license MIT License (http://www.opensource.org/licenses/mit-license.php) // +--------------------------------------------------------------------------------------------+ // //////////////////////////////////////////////////////////////////////////////////////////////////// -2.0.0 +2.0.1 + diff --git a/lib/Cake/View/Pages/home.ctp b/lib/Cake/View/Pages/home.ctp index 76f333265..b775a3238 100644 --- a/lib/Cake/View/Pages/home.ctp +++ b/lib/Cake/View/Pages/home.ctp @@ -24,7 +24,7 @@ App::uses('Debugger', 'Utility');

For updates and important announcements, visit http://cakefest.org

- + 0): Debugger::checkSecurityKeys(); From e53287583e3d804c6be3f37ad232582303bfebf0 Mon Sep 17 00:00:00 2001 From: Yasushi Ichikawa Date: Mon, 31 Oct 2011 18:31:08 +0900 Subject: [PATCH 28/43] return byte length instead of number of characters in Content-Length --- lib/Cake/Network/CakeResponse.php | 5 ++--- lib/Cake/Test/Case/Network/CakeResponseTest.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index 41cb0f412..baa97996d 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -350,10 +350,9 @@ class CakeResponse { $codeMessage = $this->_statusCodes[$this->_status]; $this->_sendHeader("{$this->_protocol} {$this->_status} {$codeMessage}"); $this->_sendHeader('Content-Type', "{$this->_contentType}; charset={$this->_charset}"); - $shouldSetLength = empty($this->_headers['Content-Length']) && class_exists('Multibyte'); - $shouldSetLength = $shouldSetLength && !in_array($this->_status, range(301, 307)); + $shouldSetLength = empty($this->_headers['Content-Length']) && !in_array($this->_status, range(301, 307)); if ($shouldSetLength && !$this->outputCompressed()) { - $this->_headers['Content-Length'] = mb_strlen($this->_body); + $this->_headers['Content-Length'] = strlen($this->_body); } foreach ($this->_headers as $header => $value) { $this->_sendHeader($header, $value); diff --git a/lib/Cake/Test/Case/Network/CakeResponseTest.php b/lib/Cake/Test/Case/Network/CakeResponseTest.php index c118fd62e..74b29573e 100644 --- a/lib/Cake/Test/Case/Network/CakeResponseTest.php +++ b/lib/Cake/Test/Case/Network/CakeResponseTest.php @@ -396,7 +396,7 @@ class CakeResponseTest extends CakeTestCase { $response->expects($this->at(1)) ->method('_sendHeader')->with('Content-Type', 'text/html; charset=UTF-8'); $response->expects($this->at(2)) - ->method('_sendHeader')->with('Content-Length', mb_strlen($body)); + ->method('_sendHeader')->with('Content-Length', 116); $response->send(); $response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', 'outputCompressed')); From f39c683130164e64214eb7e0958763a56eb71748 Mon Sep 17 00:00:00 2001 From: Yasushi Ichikawa Date: Mon, 31 Oct 2011 23:29:59 +0900 Subject: [PATCH 29/43] check mbstring.func_overload before using strlen() --- lib/Cake/Network/CakeResponse.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index baa97996d..55f9df353 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -352,7 +352,11 @@ class CakeResponse { $this->_sendHeader('Content-Type', "{$this->_contentType}; charset={$this->_charset}"); $shouldSetLength = empty($this->_headers['Content-Length']) && !in_array($this->_status, range(301, 307)); if ($shouldSetLength && !$this->outputCompressed()) { - $this->_headers['Content-Length'] = strlen($this->_body); + if (ini_get('mbstring.func_overload') & 2 && function_exists('mb_strlen')) { + $this->_headers['Content-Length'] = mb_strlen($this->_body, '8bit'); + } else { + $this->_headers['Content-Length'] = strlen($this->_body); + } } foreach ($this->_headers as $header => $value) { $this->_sendHeader($header, $value); From 4aeb5b461d64092d64e3c7dd69376dc1f044b85b Mon Sep 17 00:00:00 2001 From: Yasushi Ichikawa Date: Mon, 31 Oct 2011 23:47:36 +0900 Subject: [PATCH 30/43] delete App::uses Multibyte class. It is no longer needed. --- lib/Cake/Network/CakeResponse.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index 55f9df353..68401b5cc 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -17,8 +17,6 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -App::uses('Multibyte', 'I18n'); - /** * CakeResponse is responsible for managing the response text, status and headers of a HTTP response. * From bf43a5ee24838755dcc3007a59a55e1f800d6297 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 30 Oct 2011 22:36:40 -0400 Subject: [PATCH 31/43] Fix whitespace and add usage to doc block. --- lib/Cake/Controller/Component/AuthComponent.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index d17d7e6a1..27c63520d 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -425,6 +425,7 @@ class AuthComponent extends Component { * * `$this->Auth->allow(array('edit', 'add'));` or * `$this->Auth->allow('edit', 'add');` + * `$this->Auth->allow();` to allow all actions. * * allow() also supports '*' as a wildcard to mean all actions. * @@ -462,9 +463,9 @@ class AuthComponent extends Component { */ public function deny($action = null) { $args = func_get_args(); - if(empty($args)){ + if (empty($args)) { $this->allowedActions = array(); - }else{ + } else { if (isset($args[0]) && is_array($args[0])) { $args = $args[0]; } From 6623b7dc9d05eaa00192f5e010feaaa3f6dbef88 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 31 Oct 2011 22:27:43 -0400 Subject: [PATCH 32/43] Update generated cache files. - Cache files should contain a response object on the controller. Without it bad things happen. - Include the $request and $response contructor arguments for Controller. - Update import -> uses() Refs #2190 --- lib/Cake/View/Helper/CacheHelper.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/Cake/View/Helper/CacheHelper.php b/lib/Cake/View/Helper/CacheHelper.php index 914c079c5..4141bf78a 100644 --- a/lib/Cake/View/Helper/CacheHelper.php +++ b/lib/Cake/View/Helper/CacheHelper.php @@ -265,24 +265,26 @@ class CacheHelper extends AppHelper { $file = '_View->plugin)) { - $file .= ' - App::import(\'Controller\', \'' . $this->_View->name. '\'); - '; + $file .= " + App::uses('{$this->_View->name}Controller', 'Controller'); + "; } else { - $file .= ' - App::import(\'Controller\', \'' . $this->_View->plugin . '.' . $this->_View->name. '\'); - '; + $file .= " + App::uses('{$this->_View->name}Controller', '{$this->_View->plugin}.Controller'); + "; } - $file .= '$controller = new ' . $this->_View->name . 'Controller(); + $file .= ' + $request = unserialize(\'' . str_replace("'", "\\'", serialize($this->request)) . '\'); + $response = new CakeResponse(array("charset" => Configure::read("App.encoding"))); + $controller = new ' . $this->_View->name . 'Controller($request, $response); $controller->plugin = $this->plugin = \'' . $this->_View->plugin . '\'; $controller->helpers = $this->helpers = unserialize(\'' . serialize($this->_View->helpers) . '\'); $controller->layout = $this->layout = \'' . $this->_View->layout. '\'; - $controller->request = $this->request = unserialize(\'' . str_replace("'", "\\'", serialize($this->request)) . '\'); $controller->theme = $this->theme = \'' . $this->_View->theme . '\'; $controller->viewVars = $this->viewVars = unserialize(base64_decode(\'' . base64_encode(serialize($this->_View->viewVars)) . '\')); - Router::setRequestInfo($controller->request);'; - + Router::setRequestInfo($controller->request); + $this->request = $request;'; if ($useCallbacks == true) { $file .= ' From 550076d75ed7f0ea7488486f9f2872cfd9c7fe2d Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 31 Oct 2011 22:41:43 -0400 Subject: [PATCH 33/43] Fix issue in RequestHandlerComponent. Fixes issues where response and request properties would not be set as the initialize() callback would have not fired. Fixes #2190 Fixes #2189 --- .../Controller/Component/RequestHandlerComponent.php | 8 +++++--- .../Component/RequestHandlerComponentTest.php | 11 ++--------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/Cake/Controller/Component/RequestHandlerComponent.php b/lib/Cake/Controller/Component/RequestHandlerComponent.php index 9f38c5652..d5f855387 100644 --- a/lib/Cake/Controller/Component/RequestHandlerComponent.php +++ b/lib/Cake/Controller/Component/RequestHandlerComponent.php @@ -91,8 +91,12 @@ class RequestHandlerComponent extends Component { * @param array $settings Array of settings. */ public function __construct(ComponentCollection $collection, $settings = array()) { - $this->addInputType('xml', array(array($this, 'convertXml'))); parent::__construct($collection, $settings); + $this->addInputType('xml', array(array($this, 'convertXml'))); + + $Controller = $collection->getController(); + $this->request = $Controller->request; + $this->response = $Controller->response; } /** @@ -107,8 +111,6 @@ class RequestHandlerComponent extends Component { * @see Router::parseExtensions() */ public function initialize($controller, $settings = array()) { - $this->request = $controller->request; - $this->response = $controller->response; if (isset($this->request->params['ext'])) { $this->ext = $this->request->params['ext']; } diff --git a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php index 865f66c19..4aa2f98f6 100644 --- a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php @@ -29,13 +29,6 @@ App::uses('Router', 'Routing'); */ class RequestHandlerTestController extends Controller { -/** - * name property - * - * @var string - */ - public $name = 'RequestHandlerTest'; - /** * uses property * @@ -117,9 +110,8 @@ class RequestHandlerComponentTest extends CakeTestCase { $request = new CakeRequest('controller_posts/index'); $response = new CakeResponse(); $this->Controller = new RequestHandlerTestController($request, $response); + $this->Controller->constructClasses(); $this->RequestHandler = new RequestHandlerComponent($this->Controller->Components); - $this->RequestHandler->request = $request; - $this->RequestHandler->response = $response; $this->_extensions = Router::extensions(); } @@ -148,6 +140,7 @@ class RequestHandlerComponentTest extends CakeTestCase { 'ajaxLayout' => 'test_ajax' ); $Collection = new ComponentCollection(); + $Collection->init($this->Controller); $RequestHandler = new RequestHandlerComponent($Collection, $settings); $this->assertEqual($RequestHandler->ajaxLayout, 'test_ajax'); } From f531e7f24b1fbff1d7c8c265eb295e1aa506d888 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 31 Oct 2011 22:51:37 -0400 Subject: [PATCH 34/43] Fix UUID issue in SQLite Only varchar(36) was interpreted as a uuid. char(36) should also be treated this way. Most documentation refers to this type. Also char(x) fields should be treated as strings, not text. Fixes #2184 --- lib/Cake/Model/Datasource/Database/Sqlite.php | 2 +- .../Model/Datasource/Database/SqliteTest.php | 39 ++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Model/Datasource/Database/Sqlite.php b/lib/Cake/Model/Datasource/Database/Sqlite.php index c06f0ed87..6b616f1b7 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlite.php +++ b/lib/Cake/Model/Datasource/Database/Sqlite.php @@ -250,7 +250,7 @@ class Sqlite extends DboSource { if (in_array($col, array('text', 'integer', 'float', 'boolean', 'timestamp', 'date', 'datetime', 'time'))) { return $col; } - if (strpos($col, 'varchar') !== false) { + if (strpos($col, 'varchar') !== false || strpos($col, 'char') !== false) { return 'string'; } if (in_array($col, array('blob', 'clob'))) { diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php index 43f9f8ec3..9b08b4bdf 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php @@ -76,7 +76,7 @@ class SqliteTest extends CakeTestCase { * * @var object */ - public $fixtures = array('core.user'); + public $fixtures = array('core.user', 'core.uuid'); /** * Actual DB connection used in testing @@ -321,6 +321,20 @@ class SqliteTest extends CakeTestCase { ); $this->assertEqual($result['id'], $expected); $this->Dbo->query('DROP TABLE ' . $tableName); + + $tableName = 'uuid_tests'; + $this->Dbo->query("CREATE TABLE {$tableName} (id CHAR(36) PRIMARY KEY, name VARCHAR, created DATETIME, modified DATETIME)"); + $Model = new Model(array('name' => 'UuidTest', 'ds' => 'test', 'table' => 'uuid_tests')); + $result = $this->Dbo->describe($Model); + $expected = array( + 'type' => 'string', + 'length' => 36, + 'null' => false, + 'default' => null, + 'key' => 'primary', + ); + $this->assertEqual($result['id'], $expected); + $this->Dbo->query('DROP TABLE ' . $tableName); } /** @@ -338,4 +352,27 @@ class SqliteTest extends CakeTestCase { )); $this->assertEquals('ett', $result['User']['name']); } + +/** + * Test that records can be inserted with uuid primary keys, and + * that the primary key is not blank + * + * @return void + */ + public function testUuidPrimaryKeyInsertion() { + $this->loadFixtures('Uuid'); + $Model = ClassRegistry::init('Uuid'); + + $data = array( + 'title' => 'A uuid should work', + 'count' => 10 + ); + $Model->create($data); + $this->assertTrue((bool)$Model->save()); + $result = $Model->read(); + + $this->assertEquals($data['title'], $result['Uuid']['title']); + $this->assertTrue(Validation::uuid($result['Uuid']['id']), 'Not a uuid'); + } + } From 985dcad80254e5b1f18ad49a8c3ca7e74e41d5d2 Mon Sep 17 00:00:00 2001 From: Lubos Remplik Date: Tue, 1 Nov 2011 08:17:36 -0700 Subject: [PATCH 35/43] MimeType audio/ogg added --- lib/Cake/Network/CakeResponse.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index 68401b5cc..473fd8026 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -186,6 +186,7 @@ class CakeResponse { 'mp2' => 'audio/mpeg', 'mp3' => 'audio/mpeg', 'mpga' => 'audio/mpeg', + 'ogg' => 'audio/ogg', 'ra' => 'audio/x-realaudio', 'ram' => 'audio/x-pn-realaudio', 'rm' => 'audio/x-pn-realaudio', From 385f6f164fb8f07f837532a216058093ea5c1786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Markovi=C4=87?= Date: Tue, 1 Nov 2011 16:59:11 +0100 Subject: [PATCH 36/43] Fixed typos in css --- app/webroot/css/cake.generic.css | 2 +- lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/webroot/css/cake.generic.css b/app/webroot/css/cake.generic.css index d6f3d25c2..7535b4cce 100644 --- a/app/webroot/css/cake.generic.css +++ b/app/webroot/css/cake.generic.css @@ -368,7 +368,7 @@ form .submit input[type=submit]:hover { /* Form errors */ form .error { background: #FFDACC; - -moz-order-radius: 4px; + -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; font-weight: normal; diff --git a/lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css b/lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css index dfc30cab6..7535b4cce 100644 --- a/lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css +++ b/lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css @@ -368,7 +368,7 @@ form .submit input[type=submit]:hover { /* Form errors */ form .error { background: #FFDACC; - -moz-order-radius: 4px; + -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; font-weight: normal; @@ -611,7 +611,7 @@ pre { overflow: auto; position: relative; -moz-border-radius: 4px; - -wekbkit-border-radius: 4px; + -webkit-border-radius: 4px; border-radius: 4px; } .cake-stack-trace a { From 3fc6d293fcd4f2584bfb63aee99e18c5beb1f757 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Tue, 1 Nov 2011 13:49:40 -0430 Subject: [PATCH 37/43] Fixing regression in ControllerTestCase after changes done in RequestHandlerComponent --- lib/Cake/TestSuite/ControllerTestCase.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/Cake/TestSuite/ControllerTestCase.php b/lib/Cake/TestSuite/ControllerTestCase.php index 7bebd7695..a015b1728 100644 --- a/lib/Cake/TestSuite/ControllerTestCase.php +++ b/lib/Cake/TestSuite/ControllerTestCase.php @@ -59,6 +59,15 @@ class ControllerTestDispatcher extends Dispatcher { $this->testController->helpers = array_merge(array('InterceptContent'), $this->testController->helpers); $this->testController->setRequest($request); $this->testController->response = $this->response; + foreach ($this->testController->Components->attached() as $component) { + $object = $this->testController->Components->{$component}; + if (isset($object->response)) { + $object->response = $response; + } + } + if (isset($object->request)) { + $object->request = $request; + } return $this->testController; } From 201231cd4241f5686f1c8489746f35b4b9db42ab Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 2 Nov 2011 13:45:11 -0400 Subject: [PATCH 38/43] Fix encoding issues with debug(). Fixes #2199 --- lib/Cake/basics.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/basics.php b/lib/Cake/basics.php index 833fdc61e..e5b1f3ccb 100644 --- a/lib/Cake/basics.php +++ b/lib/Cake/basics.php @@ -106,7 +106,7 @@ TEXT; } $var = print_r($var, true); if ($showHtml) { - $var = htmlentities($var); + $var = h($var); } printf($template, $file, $line, $var); } From 18a34c03a4c73a865e2a92f24987b1bf1a9d41b0 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 2 Nov 2011 21:21:48 -0400 Subject: [PATCH 39/43] Fix issue where unknown exceptions would be squashed. Fix issue where unknown exceptions with error codes that were not in HTTP ranges would be ignored. In development those messages should display. Fixes #2205 --- lib/Cake/Error/ExceptionRenderer.php | 13 +++---- .../Test/Case/Error/ExceptionRendererTest.php | 37 +++++++++++++++++-- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/lib/Cake/Error/ExceptionRenderer.php b/lib/Cake/Error/ExceptionRenderer.php index 58a410d26..758cc913d 100644 --- a/lib/Cake/Error/ExceptionRenderer.php +++ b/lib/Cake/Error/ExceptionRenderer.php @@ -119,12 +119,7 @@ class ExceptionRenderer { } if (Configure::read('debug') == 0) { - $parentClass = get_parent_class($this); - if ($parentClass != __CLASS__) { - $method = 'error400'; - } - $parentMethods = (array)get_class_methods($parentClass); - if (in_array($method, $parentMethods)) { + if ($method == '_cakeError') { $method = 'error400'; } if ($code == 500) { @@ -223,11 +218,15 @@ class ExceptionRenderer { * @return void */ public function error500($error) { + $message = $error->getMessage(); + if (Configure::read('debug') == 0) { + $message = __d('cake', 'An Internal Error Has Occurred'); + } $url = $this->controller->request->here(); $code = ($error->getCode() > 500 && $error->getCode() < 506) ? $error->getCode() : 500; $this->controller->response->statusCode($code); $this->controller->set(array( - 'name' => __d('cake', 'An Internal Error Has Occurred'), + 'name' => $message, 'message' => h($url), 'error' => $error, )); diff --git a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php index c45a07b56..48064925a 100644 --- a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php +++ b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php @@ -287,10 +287,11 @@ class ExceptionRendererTest extends CakeTestCase { ob_start(); $ExceptionRenderer->render(); - $results = ob_get_clean(); + $result = ob_get_clean(); $this->assertFalse(method_exists($ExceptionRenderer, 'missingWidgetThing'), 'no method should exist.'); $this->assertEquals('error400', $ExceptionRenderer->method, 'incorrect method coercion.'); + $this->assertContains('coding fail', $result, 'Text should show up.'); } /** @@ -302,13 +303,40 @@ class ExceptionRendererTest extends CakeTestCase { $exception = new OutOfBoundsException('foul ball.'); $ExceptionRenderer = new ExceptionRenderer($exception); $ExceptionRenderer->controller->response = $this->getMock('CakeResponse', array('statusCode', '_sendHeader')); - $ExceptionRenderer->controller->response->expects($this->once())->method('statusCode')->with(500); + $ExceptionRenderer->controller->response->expects($this->once()) + ->method('statusCode') + ->with(500); ob_start(); $ExceptionRenderer->render(); - $results = ob_get_clean(); + $result = ob_get_clean(); $this->assertEquals('error500', $ExceptionRenderer->method, 'incorrect method coercion.'); + $this->assertContains('foul ball.', $result, 'Text should show up as its debug mode.'); + } + +/** + * test that unknown exceptions have messages ignored. + * + * @return void + */ + public function testUnknownExceptionInProduction() { + Configure::write('debug', 0); + + $exception = new OutOfBoundsException('foul ball.'); + $ExceptionRenderer = new ExceptionRenderer($exception); + $ExceptionRenderer->controller->response = $this->getMock('CakeResponse', array('statusCode', '_sendHeader')); + $ExceptionRenderer->controller->response->expects($this->once()) + ->method('statusCode') + ->with(500); + + ob_start(); + $ExceptionRenderer->render(); + $result = ob_get_clean(); + + $this->assertEquals('error500', $ExceptionRenderer->method, 'incorrect method coercion.'); + $this->assertNotContains('foul ball.', $result, 'Text should no show up.'); + $this->assertContains('Internal Error', $result, 'Generic message only.'); } /** @@ -324,9 +352,10 @@ class ExceptionRendererTest extends CakeTestCase { ob_start(); $ExceptionRenderer->render(); - $results = ob_get_clean(); + $result = ob_get_clean(); $this->assertEquals('error500', $ExceptionRenderer->method, 'incorrect method coercion.'); + $this->assertContains('foul ball.', $result, 'Text should show up as its debug mode.'); } /** From 98a8f44fa75106e715c454bedb3df5bd5051ce9e Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 2 Nov 2011 21:50:16 -0400 Subject: [PATCH 40/43] Make formatting tag removal smarter. Instead of removing all tags, only known formatting tags. Fixes #2203 --- lib/Cake/Console/ConsoleOutput.php | 3 ++- lib/Cake/Test/Case/Console/ConsoleOutputTest.php | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Console/ConsoleOutput.php b/lib/Cake/Console/ConsoleOutput.php index ffe51f7c4..a6cfd7d1f 100644 --- a/lib/Cake/Console/ConsoleOutput.php +++ b/lib/Cake/Console/ConsoleOutput.php @@ -178,7 +178,8 @@ class ConsoleOutput { return $text; } if ($this->_outputAs == self::PLAIN) { - return strip_tags($text); + $tags = implode('|', array_keys(self::$_styles)); + return preg_replace('##', '', $text); } return preg_replace_callback( '/<(?[a-z0-9-_]+)>(?.*?)<\/(\1)>/ims', array($this, '_replaceTags'), $text diff --git a/lib/Cake/Test/Case/Console/ConsoleOutputTest.php b/lib/Cake/Test/Case/Console/ConsoleOutputTest.php index 9cdfcf0cd..39b3f98b7 100644 --- a/lib/Cake/Test/Case/Console/ConsoleOutputTest.php +++ b/lib/Cake/Test/Case/Console/ConsoleOutputTest.php @@ -225,4 +225,17 @@ class ConsoleOutputTest extends CakeTestCase { $this->output->write('Bad Regular', false); } + +/** + * test plain output only strips tags used for formatting. + * + * @return void + */ + public function testOutputAsPlainSelectiveTagRemoval() { + $this->output->outputAs(ConsoleOutput::PLAIN); + $this->output->expects($this->once())->method('_write') + ->with('Bad Regular Left behind '); + + $this->output->write('Bad Regular Left behind ', false); + } } From 606c30b77ff0e402f555bf1924bd224922751246 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Wed, 2 Nov 2011 23:44:50 -0430 Subject: [PATCH 41/43] Releasing 2.0.2 --- lib/Cake/Config/config.php | 2 +- lib/Cake/VERSION.txt | 5 +---- lib/Cake/View/Pages/home.ctp | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/Cake/Config/config.php b/lib/Cake/Config/config.php index 8ed27662a..5f9c32d03 100644 --- a/lib/Cake/Config/config.php +++ b/lib/Cake/Config/config.php @@ -16,4 +16,4 @@ * @since CakePHP(tm) v 1.1.11.4062 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -return $config['Cake.version'] = '2.0.1'; +return $config['Cake.version'] = '2.0.2'; diff --git a/lib/Cake/VERSION.txt b/lib/Cake/VERSION.txt index fbbf5a420..18107e509 100644 --- a/lib/Cake/VERSION.txt +++ b/lib/Cake/VERSION.txt @@ -17,7 +17,4 @@ // @license MIT License (http://www.opensource.org/licenses/mit-license.php) // +--------------------------------------------------------------------------------------------+ // //////////////////////////////////////////////////////////////////////////////////////////////////// -2.0.1 - - - +2.0.2 \ No newline at end of file diff --git a/lib/Cake/View/Pages/home.ctp b/lib/Cake/View/Pages/home.ctp index b775a3238..87015b9d6 100644 --- a/lib/Cake/View/Pages/home.ctp +++ b/lib/Cake/View/Pages/home.ctp @@ -24,7 +24,7 @@ App::uses('Debugger', 'Utility');

For updates and important announcements, visit http://cakefest.org

- + 0): Debugger::checkSecurityKeys(); From 51ccbad170074678870f6808cc744730a1a88ee6 Mon Sep 17 00:00:00 2001 From: Majna Date: Thu, 3 Nov 2011 21:34:32 +0100 Subject: [PATCH 42/43] Fixing ignored '--exclude-plugins' option on Windows for Extract task. --- lib/Cake/Console/Command/Task/ExtractTask.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Console/Command/Task/ExtractTask.php b/lib/Cake/Console/Command/Task/ExtractTask.php index 08f00ad65..50c8c94b5 100644 --- a/lib/Cake/Console/Command/Task/ExtractTask.php +++ b/lib/Cake/Console/Command/Task/ExtractTask.php @@ -606,7 +606,7 @@ class ExtractTask extends Shell { if (!empty($this->_exclude)) { $exclude = array(); foreach ($this->_exclude as $e) { - if ($e[0] !== DS) { + if (DS !== '\\' && $e[0] !== DS) { $e = DS . $e; } $exclude[] = preg_quote($e, '/'); From a92995103861801f304341ad4ed1094b0512cc22 Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 3 Nov 2011 20:13:22 -0400 Subject: [PATCH 43/43] Fix issue with Controller::setAction() Calling setAction did not modify which view file was rendered. This was a regression with 1.3 Fixes #2212 --- lib/Cake/Controller/Controller.php | 1 + lib/Cake/Test/Case/Controller/ControllerTest.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index 1303b7cc6..ef3472c54 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -805,6 +805,7 @@ class Controller extends Object { */ public function setAction($action) { $this->request->action = $action; + $this->view = $action; $args = func_get_args(); unset($args[0]); return call_user_func_array(array(&$this, $action), $args); diff --git a/lib/Cake/Test/Case/Controller/ControllerTest.php b/lib/Cake/Test/Case/Controller/ControllerTest.php index 36f72110e..c93079b62 100644 --- a/lib/Cake/Test/Case/Controller/ControllerTest.php +++ b/lib/Cake/Test/Case/Controller/ControllerTest.php @@ -967,7 +967,8 @@ class ControllerTest extends CakeTestCase { $TestController = new TestController($request); $TestController->setAction('index', 1, 2); $expected = array('testId' => 1, 'test2Id' => 2); - $this->assertidentical($TestController->data, $expected); + $this->assertSame($expected, $TestController->request->data); + $this->assertSame('index', $TestController->view); } /**