From eefdc432142b57776c21cad1a36e58c42daf3b28 Mon Sep 17 00:00:00 2001 From: Graham Weldon Date: Tue, 15 Nov 2011 17:30:49 +1100 Subject: [PATCH 01/20] Fix plugins not being loaded before looking for pluign paths --- lib/Cake/Console/Command/UpgradeShell.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Cake/Console/Command/UpgradeShell.php b/lib/Cake/Console/Command/UpgradeShell.php index 66d59be5b..e4cebc78c 100644 --- a/lib/Cake/Console/Command/UpgradeShell.php +++ b/lib/Cake/Console/Command/UpgradeShell.php @@ -221,6 +221,7 @@ class UpgradeShell extends Shell { $plugins = App::objects('plugin'); $pluginHelpers = array(); foreach ($plugins as $plugin) { + CakePlugin::load($plugin); $pluginHelpers = array_merge( $pluginHelpers, App::objects('helper', App::pluginPath($plugin) . DS . 'views' . DS . 'helpers' . DS, false) From 060e225b76c7d19884aebddb0030b2a20e43acad Mon Sep 17 00:00:00 2001 From: Kyle Robinson Young Date: Tue, 13 Dec 2011 22:19:50 -0800 Subject: [PATCH 02/20] Add test for Model::getID(), simplify return and remove dated @see link --- lib/Cake/Model/Model.php | 6 +---- .../Test/Case/Model/ModelIntegrationTest.php | 25 ++++++++++++++++++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index e55f8411d..57c5d9430 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -3164,11 +3164,7 @@ class Model extends Object { return false; } - foreach ($this->id as $id) { - return $id; - } - - return false; + return current($this->id); } /** diff --git a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php index 908b0f62b..2a8ccbbb6 100644 --- a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php +++ b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php @@ -2022,7 +2022,6 @@ class ModelIntegrationTest extends BaseModelTest { /** * testEscapeField to prove it escapes the field well even when it has part of the alias on it - * @see ttp://cakephp.lighthouseapp.com/projects/42648-cakephp-1x/tickets/473-escapefield-doesnt-consistently-prepend-modelname * * @return void */ @@ -2052,6 +2051,30 @@ class ModelIntegrationTest extends BaseModelTest { ConnectionManager::drop('mock'); } +/** + * testGetID + * + * @return void + */ + public function testGetID() { + $TestModel = new Test(); + + $result = $TestModel->getID(); + $this->assertFalse($result); + + $TestModel->id = 9; + $result = $TestModel->getID(); + $this->assertEquals(9, $result); + + $TestModel->id = array(10, 9, 8, 7); + $result = $TestModel->getID(2); + $this->assertEquals(8, $result); + + $TestModel->id = array(array(), 1, 2, 3); + $result = $TestModel->getID(); + $this->assertFalse($result); + } + /** * test that model->hasMethod checks self and behaviors. * From e6e0027ec769c7586323f686b5fe40472baf6006 Mon Sep 17 00:00:00 2001 From: Kyle Robinson Young Date: Tue, 13 Dec 2011 22:26:22 -0800 Subject: [PATCH 03/20] Fix typo on TranslateBehavior error message --- lib/Cake/Model/Behavior/TranslateBehavior.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Model/Behavior/TranslateBehavior.php b/lib/Cake/Model/Behavior/TranslateBehavior.php index ed7e0e5af..15161b141 100644 --- a/lib/Cake/Model/Behavior/TranslateBehavior.php +++ b/lib/Cake/Model/Behavior/TranslateBehavior.php @@ -420,7 +420,7 @@ class TranslateBehavior extends ModelBehavior { foreach (array('hasOne', 'hasMany', 'belongsTo', 'hasAndBelongsToMany') as $type) { if (isset($model->{$type}[$association]) || isset($model->__backAssociation[$type][$association])) { trigger_error( - __d('cake_dev', 'Association %s is already binded to model %s', $association, $model->alias), + __d('cake_dev', 'Association %s is already bound to model %s', $association, $model->alias), E_USER_ERROR ); return false; From 9d6ea57c30d6b75dacad2ec9da8f2da2b5cd322b Mon Sep 17 00:00:00 2001 From: euromark Date: Wed, 14 Dec 2011 04:34:42 +0100 Subject: [PATCH 04/20] Fix missing App::uses() added Fixes #2374 Signed-off-by: mark_story --- lib/Cake/Model/Aco.php | 1 + lib/Cake/Model/Aro.php | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/Cake/Model/Aco.php b/lib/Cake/Model/Aco.php index 88e06a4c1..d1beedf50 100644 --- a/lib/Cake/Model/Aco.php +++ b/lib/Cake/Model/Aco.php @@ -17,6 +17,7 @@ */ App::uses('AppModel', 'Model'); +App::uses('AclNode', 'Model'); /** * Access Control Object diff --git a/lib/Cake/Model/Aro.php b/lib/Cake/Model/Aro.php index 5d9799c4b..def6ec3da 100644 --- a/lib/Cake/Model/Aro.php +++ b/lib/Cake/Model/Aro.php @@ -17,6 +17,7 @@ */ App::uses('AppModel', 'Model'); +App::uses('AclNode', 'Model'); /** * Access Request Object From b3396538b71340a3ca091af01845a40cc54d148f Mon Sep 17 00:00:00 2001 From: Kyle Robinson Young Date: Wed, 14 Dec 2011 22:48:41 -0800 Subject: [PATCH 05/20] Add debug flag to flush output --- lib/Cake/TestSuite/CakeTestCase.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Cake/TestSuite/CakeTestCase.php b/lib/Cake/TestSuite/CakeTestCase.php index be28b5105..f6142c073 100644 --- a/lib/Cake/TestSuite/CakeTestCase.php +++ b/lib/Cake/TestSuite/CakeTestCase.php @@ -147,6 +147,9 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { ClassRegistry::flush(); } Configure::write($this->_configure); + if (isset($_GET['debug']) && $_GET['debug']) { + ob_flush(); + } } /** From 54ed278284a26215edf861ef6fb585aa7052c6ba Mon Sep 17 00:00:00 2001 From: Kyle Robinson Young Date: Wed, 14 Dec 2011 22:54:03 -0800 Subject: [PATCH 06/20] Code formatting --- lib/Cake/TestSuite/CakeTestSuiteCommand.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/Cake/TestSuite/CakeTestSuiteCommand.php b/lib/Cake/TestSuite/CakeTestSuiteCommand.php index cc463b72b..5e7b78ef6 100644 --- a/lib/Cake/TestSuite/CakeTestSuiteCommand.php +++ b/lib/Cake/TestSuite/CakeTestSuiteCommand.php @@ -40,7 +40,7 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command { */ public function __construct($loader, $params = array()) { if ($loader && !class_exists($loader)) { - throw new MissingTestLoaderException(array('class' => $loader)); + throw new MissingTestLoaderException(array('class' => $loader)); } $this->arguments['loader'] = $loader; $this->arguments['test'] = $params['case']; @@ -67,15 +67,15 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command { $suite = $this->arguments['test']; } else { $suite = $runner->getTest( - $this->arguments['test'], - $this->arguments['testFile'] + $this->arguments['test'], + $this->arguments['testFile'] ); } if (count($suite) == 0) { $skeleton = new PHPUnit_Util_Skeleton_Test( - $suite->getName(), - $this->arguments['testFile'] + $suite->getName(), + $this->arguments['testFile'] ); $result = $skeleton->generate(true); @@ -83,7 +83,7 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command { if (!$result['incomplete']) { eval(str_replace(array(''), '', $result['code'])); $suite = new PHPUnit_Framework_TestSuite( - $this->arguments['test'] . 'Test' + $this->arguments['test'] . 'Test' ); } } @@ -108,9 +108,7 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command { try { $result = $runner->doRun($suite, $this->arguments); - } - - catch (PHPUnit_Framework_Exception $e) { + } catch (PHPUnit_Framework_Exception $e) { print $e->getMessage() . "\n"; } From 321caf6db6517b0b053aa8c26b5edcf498fd34f9 Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 15 Dec 2011 22:56:39 -0500 Subject: [PATCH 07/20] Fix incorrect value being stored in Auth.redirect. An incorrect value would be stored in Auth.redirect when a custom route with the `pass` key set. Fixes #2366 --- lib/Cake/Controller/Component/AuthComponent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index 18880aa6a..94cbd5634 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -314,7 +314,7 @@ class AuthComponent extends Component { if (!$this->_getUser()) { if (!$request->is('ajax')) { $this->flash($this->authError); - $this->Session->write('Auth.redirect', Router::reverse($request)); + $this->Session->write('Auth.redirect', $request->here()); $controller->redirect($loginAction); return false; } elseif (!empty($this->ajaxLogin)) { From f1b566b88e325710a5668baf86bacfd3058ffb73 Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 15 Dec 2011 23:45:13 -0500 Subject: [PATCH 08/20] Fix failing tests. Remove duplicated test. --- .../Component/AuthComponentTest.php | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index c4c8c8fa1..f5637402b 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -795,10 +795,11 @@ class AuthComponentTest extends CakeTestCase { //Ticket #4750 //named params + $this->Controller->request = $this->Auth->request; $this->Auth->Session->delete('Auth'); $url = '/posts/index/year:2008/month:feb'; $this->Auth->request->addParams(Router::parse($url)); - $this->Auth->request->url = Router::normalize($url); + $this->Auth->request->url = $this->Auth->request->here = Router::normalize($url); $this->Auth->initialize($this->Controller); $this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login'); $this->Auth->startup($this->Controller); @@ -809,7 +810,7 @@ class AuthComponentTest extends CakeTestCase { $this->Auth->Session->delete('Auth'); $url = '/posts/view/1'; $this->Auth->request->addParams(Router::parse($url)); - $this->Auth->request->url = Router::normalize($url); + $this->Auth->request->url = $this->Auth->request->here = Router::normalize($url); $this->Auth->initialize($this->Controller); $this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login'); $this->Auth->startup($this->Controller); @@ -819,14 +820,14 @@ class AuthComponentTest extends CakeTestCase { // QueryString parameters $_back = $_GET; $_GET = array( - 'url' => '/posts/index/29', 'print' => 'true', 'refer' => 'menu' ); $this->Auth->Session->delete('Auth'); $url = '/posts/index/29'; - $this->Auth->request = $this->Controller->request = new CakeRequest($url); $this->Auth->request->addParams(Router::parse($url)); + $this->Auth->request->url = $this->Auth->request->here = Router::normalize($url); + $this->Auth->request->query = $_GET; $this->Auth->initialize($this->Controller); $this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login'); @@ -834,33 +835,15 @@ class AuthComponentTest extends CakeTestCase { $expected = Router::normalize('posts/index/29?print=true&refer=menu'); $this->assertEquals($expected, $this->Auth->Session->read('Auth.redirect')); - $_GET = array( - 'url' => '/posts/index/29', - 'print' => 'true', - 'refer' => 'menu' - ); - $this->Auth->Session->delete('Auth'); - $url = '/posts/index/29'; - $this->Auth->request = $this->Controller->request = new CakeRequest($url); - $this->Auth->request->addParams(Router::parse($url)); - - $this->Auth->initialize($this->Controller); - $this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login'); - $this->Auth->startup($this->Controller); - $expected = Router::normalize('posts/index/29?print=true&refer=menu'); - $this->assertEquals($expected, $this->Auth->Session->read('Auth.redirect')); $_GET = $_back; //external authed action $_SERVER['HTTP_REFERER'] = 'http://webmail.example.com/view/message'; - $_GET = array( - 'url' => '/posts/edit/1' - ); $this->Auth->Session->delete('Auth'); $url = '/posts/edit/1'; $this->Auth->request = $this->Controller->request = new CakeRequest($url); $this->Auth->request->addParams(Router::parse($url)); - $this->Auth->request->url = Router::normalize($url); + $this->Auth->request->url = $this->Auth->request->here = Router::normalize($url); $this->Auth->initialize($this->Controller); $this->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login'); $this->Auth->startup($this->Controller); From 51f9837db4a1a23676c9d26d6aa835998ff44da4 Mon Sep 17 00:00:00 2001 From: Kyle Robinson Young Date: Thu, 15 Dec 2011 22:52:07 -0800 Subject: [PATCH 09/20] Code standards formatting --- lib/Cake/Console/Command/ApiShell.php | 4 +- lib/Cake/Console/Command/Task/ProjectTask.php | 6 +- .../Controller/Component/AclComponent.php | 8 +-- lib/Cake/Controller/Controller.php | 6 +- lib/Cake/Core/App.php | 2 +- lib/Cake/I18n/I18n.php | 6 +- lib/Cake/I18n/Multibyte.php | 2 +- .../Model/Behavior/ContainableBehavior.php | 4 +- lib/Cake/Model/Behavior/TranslateBehavior.php | 38 +++++------ lib/Cake/Model/Behavior/TreeBehavior.php | 8 +-- .../Model/Datasource/Database/Postgres.php | 6 +- lib/Cake/Model/Datasource/Database/Sqlite.php | 2 +- .../Model/Datasource/Database/Sqlserver.php | 2 +- lib/Cake/Model/Datasource/DboSource.php | 2 +- lib/Cake/Model/Model.php | 2 +- lib/Cake/Network/CakeResponse.php | 2 +- lib/Cake/Network/CakeSocket.php | 4 +- .../Case/Cache/Engine/MemcacheEngineTest.php | 10 +-- .../Case/Console/Command/AclShellTest.php | 6 +- .../Console/Command/Task/ExtractTaskTest.php | 8 +-- .../Console/Command/Task/ModelTaskTest.php | 4 +- .../Console/Command/Task/ProjectTaskTest.php | 2 +- lib/Cake/Test/Case/Console/ShellTest.php | 4 +- .../Component/AuthComponentTest.php | 2 +- .../Test/Case/Controller/ScaffoldTest.php | 12 ++-- lib/Cake/Test/Case/Core/AppTest.php | 10 +-- .../Behavior/ContainableBehaviorTest.php | 4 +- .../Model/Behavior/TranslateBehaviorTest.php | 2 +- .../Model/Datasource/Database/MysqlTest.php | 2 +- .../Datasource/Database/PostgresTest.php | 8 +-- lib/Cake/Test/Case/Model/DbAclTest.php | 2 +- lib/Cake/Test/Case/Model/ModelWriteTest.php | 8 +-- lib/Cake/Test/Case/Model/models.php | 8 +-- .../Test/Case/Network/Email/CakeEmailTest.php | 18 +++--- lib/Cake/Test/Case/Utility/FileTest.php | 4 +- lib/Cake/Test/Case/Utility/ValidationTest.php | 2 +- .../Test/Case/View/Helper/CacheHelperTest.php | 2 +- .../Test/Case/View/Helper/HtmlHelperTest.php | 4 +- .../Case/View/Helper/NumberHelperTest.php | 12 ++-- .../Test/Case/View/Helper/TextHelperTest.php | 6 +- .../Test/Fixture/CounterCachePostFixture.php | 4 +- ...rCachePostNonstandardPrimaryKeyFixture.php | 4 +- .../Test/Fixture/GroupUpdateAllFixture.php | 56 +++++++++-------- .../Test/Fixture/ProductUpdateAllFixture.php | 63 ++++++++++--------- lib/Cake/Test/test_app/View/Pages/home.ctp | 2 +- lib/Cake/TestSuite/CakeTestRunner.php | 2 +- .../TestSuite/Reporter/CakeHtmlReporter.php | 2 +- .../TestSuite/Reporter/CakeTextReporter.php | 2 +- lib/Cake/Utility/File.php | 2 +- lib/Cake/Utility/Set.php | 4 +- lib/Cake/Utility/String.php | 2 +- lib/Cake/Utility/Validation.php | 2 +- lib/Cake/View/Helper/CacheHelper.php | 2 +- lib/Cake/View/Helper/HtmlHelper.php | 2 +- lib/Cake/View/Helper/TextHelper.php | 2 +- lib/Cake/View/Helper/TimeHelper.php | 8 +-- lib/Cake/View/Scaffolds/view.ctp | 8 +-- lib/Cake/bootstrap.php | 22 +++---- 58 files changed, 220 insertions(+), 213 deletions(-) diff --git a/lib/Cake/Console/Command/ApiShell.php b/lib/Cake/Console/Command/ApiShell.php index 7018c03bc..18c44b09e 100644 --- a/lib/Cake/Console/Command/ApiShell.php +++ b/lib/Cake/Console/Command/ApiShell.php @@ -101,7 +101,7 @@ class ApiShell extends AppShell { $this->_stop(); } $method = $parsed[$this->params['method']]; - $this->out($class .'::'.$method['method'] . $method['parameters']); + $this->out($class . '::' . $method['method'] . $method['parameters']); $this->hr(); $this->out($method['comment'], true); } else { @@ -127,7 +127,7 @@ class ApiShell extends AppShell { if (isset($methods[--$number])) { $method = $parsed[$methods[$number]]; $this->hr(); - $this->out($class .'::'.$method['method'] . $method['parameters']); + $this->out($class . '::' . $method['method'] . $method['parameters']); $this->hr(); $this->out($method['comment'], true); } diff --git a/lib/Cake/Console/Command/Task/ProjectTask.php b/lib/Cake/Console/Command/Task/ProjectTask.php index 17c87be43..f6e30b2d3 100644 --- a/lib/Cake/Console/Command/Task/ProjectTask.php +++ b/lib/Cake/Console/Command/Task/ProjectTask.php @@ -269,7 +269,7 @@ class ProjectTask extends AppShell { $contents = $File->read(); if (preg_match('/([\s]*Configure::write\(\'Security.salt\',[\s\'A-z0-9]*\);)/', $contents, $match)) { $string = Security::generateAuthKey(); - $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \''.$string.'\');', $contents); + $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \'' . $string . '\');', $contents); if ($File->write($result)) { return true; } @@ -290,7 +290,7 @@ class ProjectTask extends AppShell { if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) { App::uses('Security', 'Utility'); $string = substr(bin2hex(Security::generateAuthKey()), 0, 30); - $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \''.$string.'\');', $contents); + $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \'' . $string . '\');', $contents); if ($File->write($result)) { return true; } @@ -357,7 +357,7 @@ class ProjectTask extends AppShell { $File = new File($path . 'core.php'); $contents = $File->read(); if (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) { - $result = str_replace($match[0], "\n" . 'Configure::write(\'Routing.prefixes\', array(\''.$name.'\'));', $contents); + $result = str_replace($match[0], "\n" . 'Configure::write(\'Routing.prefixes\', array(\'' . $name . '\'));', $contents); if ($File->write($result)) { Configure::write('Routing.prefixes', array($name)); return true; diff --git a/lib/Cake/Controller/Component/AclComponent.php b/lib/Cake/Controller/Component/AclComponent.php index 631c6d30c..a5e1cdd93 100644 --- a/lib/Cake/Controller/Component/AclComponent.php +++ b/lib/Cake/Controller/Component/AclComponent.php @@ -488,11 +488,11 @@ class DbAcl extends Object implements AclInterface { } return array( - 'aro' => Set::extract($obj, 'Aro.0.'.$this->Aro->alias.'.id'), - 'aco' => Set::extract($obj, 'Aco.0.'.$this->Aco->alias.'.id'), + 'aro' => Set::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'), + 'aco' => Set::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id'), 'link' => $this->Aro->Permission->find('all', array('conditions' => array( - $this->Aro->Permission->alias . '.aro_id' => Set::extract($obj, 'Aro.0.'.$this->Aro->alias.'.id'), - $this->Aro->Permission->alias . '.aco_id' => Set::extract($obj, 'Aco.0.'.$this->Aco->alias.'.id') + $this->Aro->Permission->alias . '.aro_id' => Set::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'), + $this->Aro->Permission->alias . '.aco_id' => Set::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id') ))) ); } diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index ef3472c54..b32e2ba24 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -981,7 +981,7 @@ class Controller extends Object { $arrayOp = is_array($op); foreach ($data as $model => $fields) { foreach ($fields as $field => $value) { - $key = $model.'.'.$field; + $key = $model . '.' . $field; $fieldOp = $op; if ($arrayOp) { if (array_key_exists($key, $op)) { @@ -998,9 +998,9 @@ class Controller extends Object { $fieldOp = strtoupper(trim($fieldOp)); if ($fieldOp === 'LIKE') { $key = $key.' LIKE'; - $value = '%'.$value.'%'; + $value = '%' . $value . '%'; } elseif ($fieldOp && $fieldOp != '=') { - $key = $key.' '.$fieldOp; + $key = $key.' ' . $fieldOp; } $cond[$key] = $value; } diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index f55fc400a..ba55143a3 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -656,7 +656,7 @@ class App { } App::uses($extends, $extendType); if ($plugin && in_array($originalType, array('controller', 'model'))) { - App::uses($plugin . $extends, $plugin . '.' .$type); + App::uses($plugin . $extends, $plugin . '.' . $type); } } if ($plugin) { diff --git a/lib/Cake/I18n/I18n.php b/lib/Cake/I18n/I18n.php index 1c7af9959..f2f6af97b 100644 --- a/lib/Cake/I18n/I18n.php +++ b/lib/Cake/I18n/I18n.php @@ -164,7 +164,7 @@ class I18n { } if ($_this->category == 'LC_TIME') { - return $_this->_translateTime($singular,$domain); + return $_this->_translateTime($singular, $domain); } if (!isset($count)) { @@ -466,7 +466,7 @@ class I18n { } while (!feof($file)); fclose($file); $merge[""] = $header; - return $this->_domains[$domain][$this->_lang][$this->category] = array_merge($merge ,$translations); + return $this->_domains[$domain][$this->_lang][$this->category] = array_merge($merge, $translations); } /** @@ -486,7 +486,7 @@ class I18n { if (empty($line) || $line[0] === $comment) { continue; } - $parts = preg_split("/[[:space:]]+/",$line); + $parts = preg_split("/[[:space:]]+/", $line); if ($parts[0] === 'comment_char') { $comment = $parts[1]; continue; diff --git a/lib/Cake/I18n/Multibyte.php b/lib/Cake/I18n/Multibyte.php index bc581b506..7116e29aa 100644 --- a/lib/Cake/I18n/Multibyte.php +++ b/lib/Cake/I18n/Multibyte.php @@ -893,7 +893,7 @@ class Multibyte { * @param string $haystack The string being checked. * @param string $needle The string being found. * @return integer The number of times the $needle substring occurs in the $haystack string. - */ + */ public static function substrCount($haystack, $needle) { $count = 0; $haystack = Multibyte::utf8($haystack); diff --git a/lib/Cake/Model/Behavior/ContainableBehavior.php b/lib/Cake/Model/Behavior/ContainableBehavior.php index 46f75eb70..5dbffcda7 100644 --- a/lib/Cake/Model/Behavior/ContainableBehavior.php +++ b/lib/Cake/Model/Behavior/ContainableBehavior.php @@ -308,10 +308,10 @@ class ContainableBehavior extends ModelBehavior { $val = preg_split('/\s*,\s*/', substr(substr($key, 1), 0, -1)); } elseif (preg_match('/ASC|DESC$/', $key)) { $option = 'order'; - $val = $Model->{$name}->alias.'.'.$key; + $val = $Model->{$name}->alias . '.' . $key; } elseif (preg_match('/[ =!]/', $key)) { $option = 'conditions'; - $val = $Model->{$name}->alias.'.'.$key; + $val = $Model->{$name}->alias . '.' . $key; } $children[$option] = is_array($val) ? $val : array($val); $newChildren = null; diff --git a/lib/Cake/Model/Behavior/TranslateBehavior.php b/lib/Cake/Model/Behavior/TranslateBehavior.php index 15161b141..165ed8065 100644 --- a/lib/Cake/Model/Behavior/TranslateBehavior.php +++ b/lib/Cake/Model/Behavior/TranslateBehavior.php @@ -103,8 +103,8 @@ class TranslateBehavior extends ModelBehavior { $joinTable->tablePrefix = $tablePrefix; $joinTable->table = $RuntimeModel->table; - if (is_string($query['fields']) && 'COUNT(*) AS '.$db->name('count') == $query['fields']) { - $query['fields'] = 'COUNT(DISTINCT('.$db->name($model->alias . '.' . $model->primaryKey) . ')) ' . $db->alias . 'count'; + if (is_string($query['fields']) && 'COUNT(*) AS ' . $db->name('count') == $query['fields']) { + $query['fields'] = 'COUNT(DISTINCT(' . $db->name($model->alias . '.' . $model->primaryKey) . ')) ' . $db->alias . 'count'; $query['joins'][] = array( 'type' => 'INNER', 'alias' => $RuntimeModel->alias, @@ -126,7 +126,7 @@ class TranslateBehavior extends ModelBehavior { foreach ($fields as $key => $value) { $field = (is_numeric($key)) ? $value : $key; - if (in_array($model->alias.'.*', $query['fields']) || in_array($model->alias.'.'.$field, $query['fields']) || in_array($field, $query['fields'])) { + if (in_array($model->alias.'.*', $query['fields']) || in_array($model->alias.'.' . $field, $query['fields']) || in_array($field, $query['fields'])) { $addFields[] = $field; } } @@ -137,7 +137,7 @@ class TranslateBehavior extends ModelBehavior { foreach ($addFields as $_f => $field) { $aliasField = is_numeric($_f) ? $field : $_f; - foreach (array($aliasField, $model->alias.'.'.$aliasField) as $_field) { + foreach (array($aliasField, $model->alias . '.' . $aliasField) as $_field) { $key = array_search($_field, (array)$query['fields']); if ($key !== false) { @@ -147,36 +147,36 @@ class TranslateBehavior extends ModelBehavior { if (is_array($locale)) { foreach ($locale as $_locale) { - $model->virtualFields['i18n_'.$field.'_'.$_locale] = 'I18n__'.$field.'__'.$_locale.'.content'; + $model->virtualFields['i18n_' . $field . '_' . $_locale] = 'I18n__' . $field . '__' . $_locale . '.content'; if (!empty($query['fields'])) { - $query['fields'][] = 'i18n_'.$field.'_'.$_locale; + $query['fields'][] = 'i18n_' . $field . '_' . $_locale; } $query['joins'][] = array( 'type' => 'LEFT', - 'alias' => 'I18n__'.$field.'__'.$_locale, + 'alias' => 'I18n__' . $field . '__' . $_locale, 'table' => $joinTable, 'conditions' => array( $model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}__{$_locale}.foreign_key"), - 'I18n__'.$field.'__'.$_locale.'.model' => $model->name, - 'I18n__'.$field.'__'.$_locale.'.'.$RuntimeModel->displayField => $aliasField, - 'I18n__'.$field.'__'.$_locale.'.locale' => $_locale + 'I18n__' . $field . '__' . $_locale . '.model' => $model->name, + 'I18n__' . $field . '__' . $_locale . '.' . $RuntimeModel->displayField => $aliasField, + 'I18n__' . $field . '__' . $_locale . '.locale' => $_locale ) ); } } else { - $model->virtualFields['i18n_'.$field] = 'I18n__'.$field.'.content'; + $model->virtualFields['i18n_' . $field] = 'I18n__' . $field . '.content'; if (!empty($query['fields'])) { - $query['fields'][] = 'i18n_'.$field; + $query['fields'][] = 'i18n_' . $field; } $query['joins'][] = array( 'type' => 'INNER', - 'alias' => 'I18n__'.$field, + 'alias' => 'I18n__' . $field, 'table' => $joinTable, 'conditions' => array( $model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}.foreign_key"), - 'I18n__'.$field.'.model' => $model->name, - 'I18n__'.$field.'.'.$RuntimeModel->displayField => $aliasField, - 'I18n__'.$field.'.locale' => $locale + 'I18n__' . $field . '.model' => $model->name, + 'I18n__' . $field . '.' . $RuntimeModel->displayField => $aliasField, + 'I18n__' . $field . '.locale' => $locale ) ); } @@ -211,11 +211,11 @@ class TranslateBehavior extends ModelBehavior { if (is_array($locale)) { foreach ($locale as $_locale) { - if (!isset($row[$model->alias][$aliasField]) && !empty($row[$model->alias]['i18n_'.$field.'_'.$_locale])) { - $row[$model->alias][$aliasField] = $row[$model->alias]['i18n_'.$field.'_'.$_locale]; + if (!isset($row[$model->alias][$aliasField]) && !empty($row[$model->alias]['i18n_' . $field . '_' . $_locale])) { + $row[$model->alias][$aliasField] = $row[$model->alias]['i18n_' . $field . '_' . $_locale]; $row[$model->alias]['locale'] = $_locale; } - unset($row[$model->alias]['i18n_'.$field.'_'.$_locale]); + unset($row[$model->alias]['i18n_' . $field . '_' . $_locale]); } if (!isset($row[$model->alias][$aliasField])) { diff --git a/lib/Cake/Model/Behavior/TreeBehavior.php b/lib/Cake/Model/Behavior/TreeBehavior.php index 621bf69b2..ff14fc98d 100644 --- a/lib/Cake/Model/Behavior/TreeBehavior.php +++ b/lib/Cake/Model/Behavior/TreeBehavior.php @@ -163,8 +163,8 @@ class TreeBehavior extends ModelBehavior { $this->_addToWhitelist($Model, $parent); } else { $values = $Model->find('first', array( - 'conditions' => array($scope,$Model->escapeField() => $Model->id), - 'fields' => array($Model->primaryKey, $parent, $left, $right ), 'recursive' => $recursive) + 'conditions' => array($scope, $Model->escapeField() => $Model->id), + 'fields' => array($Model->primaryKey, $parent, $left, $right), 'recursive' => $recursive) ); if ($values === false) { @@ -503,7 +503,7 @@ class TreeBehavior extends ModelBehavior { extract($this->settings[$Model->alias]); list($node) = array_values($Model->find('first', array( 'conditions' => array($scope, $Model->escapeField() => $id), - 'fields' => array($Model->primaryKey, $left, $right, $parent ), 'recursive' => $recursive + 'fields' => array($Model->primaryKey, $left, $right, $parent), 'recursive' => $recursive ))); if ($node[$parent]) { list($parentNode) = array_values($Model->find('first', array( @@ -527,7 +527,7 @@ class TreeBehavior extends ModelBehavior { } $edge = $this->_getMax($Model, $scope, $right, $recursive); $this->_sync($Model, $edge - $previousNode[$left] +1, '+', 'BETWEEN ' . $previousNode[$left] . ' AND ' . $previousNode[$right]); - $this->_sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN ' .$node[$left] . ' AND ' . $node[$right]); + $this->_sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right]); $this->_sync($Model, $edge - $previousNode[$left] - ($node[$right] - $node[$left]), '-', '> ' . $edge); if (is_int($number)) { $number--; diff --git a/lib/Cake/Model/Datasource/Database/Postgres.php b/lib/Cake/Model/Datasource/Database/Postgres.php index ae3fe8945..bf60819d6 100644 --- a/lib/Cake/Model/Datasource/Database/Postgres.php +++ b/lib/Cake/Model/Datasource/Database/Postgres.php @@ -412,7 +412,7 @@ class Postgres extends DboSource { $match[1] = $this->name($match[1]); } } - return '(' . $prepend .$match[1] . ')'; + return '(' . $prepend . $match[1] . ')'; } /** @@ -480,13 +480,13 @@ class Postgres extends DboSource { case 'add': foreach ($column as $field => $col) { $col['name'] = $field; - $colList[] = 'ADD COLUMN '.$this->buildColumn($col); + $colList[] = 'ADD COLUMN ' . $this->buildColumn($col); } break; case 'drop': foreach ($column as $field => $col) { $col['name'] = $field; - $colList[] = 'DROP COLUMN '.$this->name($field); + $colList[] = 'DROP COLUMN ' . $this->name($field); } break; case 'change': diff --git a/lib/Cake/Model/Datasource/Database/Sqlite.php b/lib/Cake/Model/Datasource/Database/Sqlite.php index e8e2e836b..35f77385d 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlite.php +++ b/lib/Cake/Model/Datasource/Database/Sqlite.php @@ -238,7 +238,7 @@ class Sqlite extends DboSource { if (is_array($real)) { $col = $real['name']; if (isset($real['limit'])) { - $col .= '('.$real['limit'].')'; + $col .= '(' . $real['limit'] . ')'; } return $col; } diff --git a/lib/Cake/Model/Datasource/Database/Sqlserver.php b/lib/Cake/Model/Datasource/Database/Sqlserver.php index ff39122b2..9e60c1622 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlserver.php +++ b/lib/Cake/Model/Datasource/Database/Sqlserver.php @@ -302,7 +302,7 @@ class Sqlserver extends DboSource { $fieldAlias = $this->name($alias . '__' . $fields[$i]); } else { $build = explode('.', $fields[$i]); - $this->_fieldMappings[$build[0] . '__' .$build[1]] = $fields[$i]; + $this->_fieldMappings[$build[0] . '__' . $build[1]] = $fields[$i]; $fieldName = $this->name($build[0] . '.' . $build[1]); $fieldAlias = $this->name(preg_replace("/^\[(.+)\]$/", "$1", $build[0]) . '__' . $build[1]); } diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index f6f153081..ca47d200f 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -787,7 +787,7 @@ class DboSource extends DataSource { } return $data; } - $cacheKey = crc32($this->startQuote.$data.$this->endQuote); + $cacheKey = crc32($this->startQuote . $data . $this->endQuote); if ($return = $this->cacheMethod(__FUNCTION__, $cacheKey)) { return $return; } diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 57c5d9430..3fdc303cf 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -2417,7 +2417,7 @@ class Model extends Object { * Queries the datasource and returns a result set array. * * Also used to perform notation finds, where the first argument is type of find operation to perform - * (all / first / count / neighbors / list / threaded ), + * (all / first / count / neighbors / list / threaded), * second parameter options for finding ( indexed array, including: 'conditions', 'limit', * 'recursive', 'page', 'fields', 'offset', 'order') * diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index 1168cb4ef..be9ce5ae8 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -372,7 +372,7 @@ class CakeResponse { $this->_headers['Content-Length'] = $offset + strlen($this->_body); } } - } + } /** * Sends a header to the client. diff --git a/lib/Cake/Network/CakeSocket.php b/lib/Cake/Network/CakeSocket.php index 1f7a4c4d9..eb4e34a7e 100644 --- a/lib/Cake/Network/CakeSocket.php +++ b/lib/Cake/Network/CakeSocket.php @@ -106,9 +106,9 @@ class CakeSocket { } if ($this->config['persistent'] == true) { - $this->connection = @pfsockopen($scheme.$this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']); + $this->connection = @pfsockopen($scheme . $this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']); } else { - $this->connection = @fsockopen($scheme.$this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']); + $this->connection = @fsockopen($scheme . $this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']); } if (!empty($errNum) || !empty($errStr)) { diff --git a/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php index 71fbb5d1c..42a24c60a 100644 --- a/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php +++ b/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php @@ -169,11 +169,11 @@ class MemcacheEngineTest extends CakeTestCase { * * @return void */ - function testParseServerStringUnix() { - $Memcache =& new TestMemcacheEngine(); - $result = $Memcache->parseServerString('unix:///path/to/memcached.sock'); - $this->assertEquals($result, array('unix:///path/to/memcached.sock', 0)); - } + function testParseServerStringUnix() { + $Memcache =& new TestMemcacheEngine(); + $result = $Memcache->parseServerString('unix:///path/to/memcached.sock'); + $this->assertEquals($result, array('unix:///path/to/memcached.sock', 0)); + } /** * testReadAndWriteCache method diff --git a/lib/Cake/Test/Case/Console/Command/AclShellTest.php b/lib/Cake/Test/Case/Console/Command/AclShellTest.php index 6eff3fe73..689eaaaf0 100644 --- a/lib/Cake/Test/Case/Console/Command/AclShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/AclShellTest.php @@ -289,9 +289,9 @@ class AclShellTest extends CakeTestCase { $first = $node[0]['Aro']['id']; $second = $node[1]['Aro']['id']; $last = $node[2]['Aro']['id']; - $this->Task->expects($this->at(2))->method('out')->with('['.$last.'] ROOT'); - $this->Task->expects($this->at(3))->method('out')->with(' ['.$second.'] admins'); - $this->Task->expects($this->at(4))->method('out')->with(' ['.$first.'] Elrond'); + $this->Task->expects($this->at(2))->method('out')->with('[' . $last . '] ROOT'); + $this->Task->expects($this->at(3))->method('out')->with(' [' . $second . '] admins'); + $this->Task->expects($this->at(4))->method('out')->with(' [' . $first . '] Elrond'); $this->Task->getPath(); } diff --git a/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php index b8273b8b7..15e0254ee 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php @@ -329,10 +329,10 @@ class ExtractTaskTest extends CakeTestCase { $this->Task->execute(); $result = file_get_contents($this->path . DS . 'test_plugin.pot'); - $pattern = preg_quote('#Plugin' . DS. 'TestPlugin' . DS. 'Model' . DS. 'TestPluginPost.php:validation for field title#', '\\'); + $pattern = preg_quote('#Plugin' . DS . 'TestPlugin' . DS . 'Model' . DS . 'TestPluginPost.php:validation for field title#', '\\'); $this->assertRegExp($pattern, $result); - $pattern = preg_quote('#Plugin' . DS. 'TestPlugin' . DS. 'Model' . DS. 'TestPluginPost.php:validation for field body#', '\\'); + $pattern = preg_quote('#Plugin' . DS . 'TestPlugin' . DS . 'Model' . DS . 'TestPluginPost.php:validation for field body#', '\\'); $this->assertRegExp($pattern, $result); $pattern = '#msgid "Post title is required"#'; @@ -369,10 +369,10 @@ class ExtractTaskTest extends CakeTestCase { $this->Task->execute(); $result = file_get_contents($this->path . DS . 'test_plugin.pot'); - $pattern = preg_quote('#Model' . DS. 'TestPluginPost.php:validation for field title#', '\\'); + $pattern = preg_quote('#Model' . DS . 'TestPluginPost.php:validation for field title#', '\\'); $this->assertRegExp($pattern, $result); - $pattern = preg_quote('#Model' . DS. 'TestPluginPost.php:validation for field body#', '\\'); + $pattern = preg_quote('#Model' . DS . 'TestPluginPost.php:validation for field body#', '\\'); $this->assertRegExp($pattern, $result); $pattern = '#msgid "Post title is required"#'; diff --git a/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php index 224526c56..0fa3ba081 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php @@ -948,7 +948,7 @@ STRINGEND; * * @return void */ - public function testExecuteIntoAllOddTables() { + public function testExecuteIntoAllOddTables() { $out = $this->getMock('ConsoleOutput', array(), array(), '', false); $in = $this->getMock('ConsoleInput', array(), array(), '', false); $this->Task = $this->getMock('ModelTask', @@ -1003,7 +1003,7 @@ STRINGEND; * * @return void */ - public function testExecuteIntoBakeOddTables() { + public function testExecuteIntoBakeOddTables() { $out = $this->getMock('ConsoleOutput', array(), array(), '', false); $in = $this->getMock('ConsoleInput', array(), array(), '', false); $this->Task = $this->getMock('ModelTask', diff --git a/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php index 04ffbf420..a18e8c23a 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php @@ -301,7 +301,7 @@ class ProjectTaskTest extends CakeTestCase { * @return void */ public function testExecute() { - $this->Task->params['skel'] = CAKE . 'Console' . DS. 'Templates' . DS . 'skel'; + $this->Task->params['skel'] = CAKE . 'Console' . DS . 'Templates' . DS . 'skel'; $this->Task->params['working'] = TMP . 'tests' . DS; $path = $this->Task->path . 'bake_test_app'; diff --git a/lib/Cake/Test/Case/Console/ShellTest.php b/lib/Cake/Test/Case/Console/ShellTest.php index c6cef822c..b51cdeb37 100644 --- a/lib/Cake/Test/Case/Console/ShellTest.php +++ b/lib/Cake/Test/Case/Console/ShellTest.php @@ -380,8 +380,8 @@ class ShellTest extends CakeTestCase { $bar = '---------------------------------------------------------------'; $this->Shell->stdout->expects($this->at(0))->method('write')->with('', 0); - $this->Shell->stdout->expects($this->at(1))->method('write')->with($bar, 1); - $this->Shell->stdout->expects($this->at(2))->method('write')->with('', 0); + $this->Shell->stdout->expects($this->at(1))->method('write')->with($bar, 1); + $this->Shell->stdout->expects($this->at(2))->method('write')->with('', 0); $this->Shell->stdout->expects($this->at(3))->method('write')->with("", true); $this->Shell->stdout->expects($this->at(4))->method('write')->with($bar, 1); diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php index f5637402b..71ae1aad2 100644 --- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php @@ -817,7 +817,7 @@ class AuthComponentTest extends CakeTestCase { $expected = Router::normalize('posts/view/1'); $this->assertEquals($expected, $this->Auth->Session->read('Auth.redirect')); - // QueryString parameters + // QueryString parameters $_back = $_GET; $_GET = array( 'print' => 'true', diff --git a/lib/Cake/Test/Case/Controller/ScaffoldTest.php b/lib/Cake/Test/Case/Controller/ScaffoldTest.php index c96885597..585041bb7 100644 --- a/lib/Cake/Test/Case/Controller/ScaffoldTest.php +++ b/lib/Cake/Test/Case/Controller/ScaffoldTest.php @@ -90,18 +90,18 @@ class TestScaffoldMock extends Scaffold { * * @param unknown_type $params */ - function _scaffold(CakeRequest $request) { - $this->_params = $request; - } + function _scaffold(CakeRequest $request) { + $this->_params = $request; + } /** * Get Params from the Controller. * * @return unknown */ - function getParams() { - return $this->_params; - } + function getParams() { + return $this->_params; + } } /** diff --git a/lib/Cake/Test/Case/Core/AppTest.php b/lib/Cake/Test/Case/Core/AppTest.php index 50f64005d..de6b4fe8b 100644 --- a/lib/Cake/Test/Case/Core/AppTest.php +++ b/lib/Cake/Test/Case/Core/AppTest.php @@ -731,13 +731,13 @@ class AppTest extends CakeTestCase { $this->assertEquals($text, 'This is a file with dot in file name'); ob_start(); - $result = App::import('Vendor', 'TestHello', array('file' => 'Test'.DS.'hello.php')); + $result = App::import('Vendor', 'TestHello', array('file' => 'Test' . DS . 'hello.php')); $text = ob_get_clean(); $this->assertTrue($result); $this->assertEquals($text, 'This is the hello.php file in Test directory'); ob_start(); - $result = App::import('Vendor', 'MyTest', array('file' => 'Test'.DS.'MyTest.php')); + $result = App::import('Vendor', 'MyTest', array('file' => 'Test' . DS . 'MyTest.php')); $text = ob_get_clean(); $this->assertTrue($result); $this->assertEquals($text, 'This is the MyTest.php file'); @@ -804,13 +804,13 @@ class AppTest extends CakeTestCase { * * @return void */ - public function testPluginLibClasses() { - App::build(array( + 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/Case/Model/Behavior/ContainableBehaviorTest.php b/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php index 0567b19fb..3d62813f7 100644 --- a/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php +++ b/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php @@ -3600,8 +3600,8 @@ class ContainableBehaviorTest extends CakeTestCase { * @return void */ public function testLazyLoad() { - // Local set up - $this->User = ClassRegistry::init('User'); + // Local set up + $this->User = ClassRegistry::init('User'); $this->User->bindModel(array( 'hasMany' => array('Article', 'ArticleFeatured', 'Comment') ), false); diff --git a/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php b/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php index 4907d5f3b..8c342a5e4 100644 --- a/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php +++ b/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php @@ -766,7 +766,7 @@ class TranslateBehaviorTest extends CakeTestCase { 'user' => 'mariano', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:16:23', - 'updated' => '2007-03-17 01:18:31' + 'updated' => '2007-03-17 01:18:31' ) ); $this->assertEquals($expected, $result); diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php index 478961fed..53c42f9da 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php @@ -3177,7 +3177,7 @@ class MysqlTest extends CakeTestCase { ); $conditions = array('comment_count >' => 2); - $query = 'SELECT ' . join(',',$this->Dbo->fields($Article, null, array('id', 'comment_count'))) . + $query = 'SELECT ' . join(',', $this->Dbo->fields($Article, null, array('id', 'comment_count'))) . ' FROM ' . $this->Dbo->fullTableName($Article) . ' Article ' . $this->Dbo->conditions($conditions, true, true, $Article); $result = $this->Dbo->fetchAll($query); $expected = array(array( diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php index d1b486eea..0b60aa1c8 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php @@ -285,10 +285,10 @@ class PostgresTest extends CakeTestCase { $result = $this->Dbo->fields($this->model, null, array('*', 'PostgresClientTestModel.*')); $expected = array_merge($fields, array( '"PostgresClientTestModel"."id" AS "PostgresClientTestModel__id"', - '"PostgresClientTestModel"."name" AS "PostgresClientTestModel__name"', - '"PostgresClientTestModel"."email" AS "PostgresClientTestModel__email"', - '"PostgresClientTestModel"."created" AS "PostgresClientTestModel__created"', - '"PostgresClientTestModel"."updated" AS "PostgresClientTestModel__updated"')); + '"PostgresClientTestModel"."name" AS "PostgresClientTestModel__name"', + '"PostgresClientTestModel"."email" AS "PostgresClientTestModel__email"', + '"PostgresClientTestModel"."created" AS "PostgresClientTestModel__created"', + '"PostgresClientTestModel"."updated" AS "PostgresClientTestModel__updated"')); $this->assertEquals($expected, $result); } diff --git a/lib/Cake/Test/Case/Model/DbAclTest.php b/lib/Cake/Test/Case/Model/DbAclTest.php index edde6b82d..7884cf4bd 100644 --- a/lib/Cake/Test/Case/Model/DbAclTest.php +++ b/lib/Cake/Test/Case/Model/DbAclTest.php @@ -355,7 +355,7 @@ class AclNodeTest extends CakeTestCase { $result = $Aco->find('all'); $expected = array( array('DbAcoTest' => array('id' => '1', 'parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'Application', 'lft' => '1', 'rght' => '4'), 'DbAroTest' => array()), - array('DbAcoTest' => array('id' => '2', 'parent_id' => '1', 'model' => null, 'foreign_key' => null, 'alias' => 'Pages', 'lft' => '2', 'rght' => '3', ), 'DbAroTest' => array()) + array('DbAcoTest' => array('id' => '2', 'parent_id' => '1', 'model' => null, 'foreign_key' => null, 'alias' => 'Pages', 'lft' => '2', 'rght' => '3'), 'DbAroTest' => array()) ); $this->assertEquals($expected, $result); } diff --git a/lib/Cake/Test/Case/Model/ModelWriteTest.php b/lib/Cake/Test/Case/Model/ModelWriteTest.php index 6f6b928a2..cb37bbdd2 100644 --- a/lib/Cake/Test/Case/Model/ModelWriteTest.php +++ b/lib/Cake/Test/Case/Model/ModelWriteTest.php @@ -5412,7 +5412,7 @@ class ModelWriteTest extends BaseModelTest { * * @return void */ - function testUpdateAllWithoutForeignKey() { + public function testUpdateAllWithoutForeignKey() { $this->skipIf(!$this->db instanceof Mysql, 'Currently, there is no way of doing joins in an update statement in postgresql'); $this->loadFixtures('ProductUpdateAll', 'GroupUpdateAll'); @@ -5420,12 +5420,12 @@ class ModelWriteTest extends BaseModelTest { $conditions = array('Group.name' => 'group one'); - $ProductUpdateAll->bindModel(array('belongsTo' => array( + $ProductUpdateAll->bindModel(array('belongsTo' => array( 'Group' => array('className' => 'GroupUpdateAll') ))); - $ProductUpdateAll->belongsTo = array( - 'Group' => array( + $ProductUpdateAll->belongsTo = array( + 'Group' => array( 'className' => 'GroupUpdateAll', 'foreignKey' => false, 'conditions' => 'ProductUpdateAll.groupcode = Group.code' diff --git a/lib/Cake/Test/Case/Model/models.php b/lib/Cake/Test/Case/Model/models.php index 8f4ef61b2..bfa493de1 100644 --- a/lib/Cake/Test/Case/Model/models.php +++ b/lib/Cake/Test/Case/Model/models.php @@ -3131,7 +3131,7 @@ class CounterCachePost extends CakeTestModel { class CounterCacheUserNonstandardPrimaryKey extends CakeTestModel { public $name = 'CounterCacheUserNonstandardPrimaryKey'; public $alias = 'User'; - public $primaryKey = 'uid'; + public $primaryKey = 'uid'; public $hasMany = array('Post' => array( 'className' => 'CounterCachePostNonstandardPrimaryKey', @@ -3142,7 +3142,7 @@ class CounterCacheUserNonstandardPrimaryKey extends CakeTestModel { class CounterCachePostNonstandardPrimaryKey extends CakeTestModel { public $name = 'CounterCachePostNonstandardPrimaryKey'; public $alias = 'Post'; - public $primaryKey = 'pid'; + public $primaryKey = 'pid'; public $belongsTo = array('User' => array( 'className' => 'CounterCacheUserNonstandardPrimaryKey', @@ -4473,8 +4473,8 @@ class MysqlTestModel extends Model { class PrefixTestModel extends CakeTestModel { } class PrefixTestUseTableModel extends CakeTestModel { - public $name = 'PrefixTest'; - public $useTable = 'prefix_tests'; + public $name = 'PrefixTest'; + public $useTable = 'prefix_tests'; } /** diff --git a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php index 310feab78..ee5a1d415 100644 --- a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php +++ b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php @@ -402,19 +402,19 @@ class CakeEmailTest extends CakeTestCase { */ public function testSubjectJapanese() { $this->skipIf(!function_exists('mb_convert_encoding')); - mb_internal_encoding('UTF-8'); + mb_internal_encoding('UTF-8'); - $this->CakeEmail->headerCharset = 'ISO-2022-JP'; + $this->CakeEmail->headerCharset = 'ISO-2022-JP'; $this->CakeEmail->subject('日本語のSubjectにも対応するよ'); - $expected = '=?ISO-2022-JP?B?GyRCRnxLXDhsJE4bKEJTdWJqZWN0GyRCJEskYkJQMX4kOSRrJGgbKEI=?='; + $expected = '=?ISO-2022-JP?B?GyRCRnxLXDhsJE4bKEJTdWJqZWN0GyRCJEskYkJQMX4kOSRrJGgbKEI=?='; $this->assertSame($this->CakeEmail->subject(), $expected); $this->CakeEmail->subject('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう?'); - $expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n" - ." =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n" - ." =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?="; + $expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n" + ." =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n" + ." =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?="; $this->assertSame($this->CakeEmail->subject(), $expected); - } + } /** @@ -1355,8 +1355,8 @@ class CakeEmailTest extends CakeTestCase { $this->CakeEmail->headerCharset = 'ISO-2022-JP'; $result = $this->CakeEmail->encode('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう?'); $expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n" - . " =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n" - . " =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?="; + . " =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n" + . " =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?="; $this->assertSame($expected, $result); } } diff --git a/lib/Cake/Test/Case/Utility/FileTest.php b/lib/Cake/Test/Case/Utility/FileTest.php index aedaafda6..e21061f80 100644 --- a/lib/Cake/Test/Case/Utility/FileTest.php +++ b/lib/Cake/Test/Case/Utility/FileTest.php @@ -226,7 +226,7 @@ class FileTest extends CakeTestCase { * @return void */ public function testCreate() { - $tmpFile = TMP.'tests'.DS.'cakephp.file.test.tmp'; + $tmpFile = TMP.'tests' . DS . 'cakephp.file.test.tmp'; $File = new File($tmpFile, true, 0777); $this->assertTrue($File->exists()); } @@ -387,7 +387,7 @@ class FileTest extends CakeTestCase { $r = $TmpFile->append($fragment); $this->assertTrue($r); $this->assertTrue(file_exists($tmpFile)); - $data = $data.$fragment; + $data = $data . $fragment; $this->assertEquals($data, file_get_contents($tmpFile)); $TmpFile->close(); } diff --git a/lib/Cake/Test/Case/Utility/ValidationTest.php b/lib/Cake/Test/Case/Utility/ValidationTest.php index 0d73c9694..b843e593c 100644 --- a/lib/Cake/Test/Case/Utility/ValidationTest.php +++ b/lib/Cake/Test/Case/Utility/ValidationTest.php @@ -2099,7 +2099,7 @@ class ValidationTest extends CakeTestCase { * * @return void */ - function testDatetime() { + function testDatetime() { $this->assertTrue(Validation::datetime('27-12-2006 01:00', 'dmy')); $this->assertTrue(Validation::datetime('27-12-2006 01:00', array('dmy'))); $this->assertFalse(Validation::datetime('27-12-2006 1:00', 'dmy')); diff --git a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php index 7fa6cd4b6..0e32e2207 100644 --- a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php @@ -535,7 +535,7 @@ class CacheHelperTest extends CakeTestCase { $filename = CACHE . 'views' . DS . 'cache_cachetest_cache_name.php'; $this->assertTrue(file_exists($filename)); @unlink($filename); - } + } /** * test that afterRender checks the conditions correctly. diff --git a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php index c3608ce93..70a98f421 100644 --- a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php @@ -573,7 +573,7 @@ class HtmlHelperTest extends CakeTestCase { Configure::write('debug', 2); Configure::write('Asset.timestamp', true); - touch(WWW_ROOT . 'js' . DS. '__cake_js_test.js'); + touch(WWW_ROOT . 'js' . DS . '__cake_js_test.js'); $timestamp = substr(strtotime('now'), 0, 8); $result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false)); @@ -583,7 +583,7 @@ class HtmlHelperTest extends CakeTestCase { Configure::write('Asset.timestamp', 'force'); $result = $this->Html->script('__cake_js_test', array('inline' => true, 'once' => false)); $this->assertRegExp('/__cake_js_test.js\?' . $timestamp . '[0-9]{2}"/', $result, 'Timestamp value not found %s'); - unlink(WWW_ROOT . 'js' . DS. '__cake_js_test.js'); + unlink(WWW_ROOT . 'js' . DS . '__cake_js_test.js'); Configure::write('Asset.timestamp', false); } diff --git a/lib/Cake/Test/Case/View/Helper/NumberHelperTest.php b/lib/Cake/Test/Case/View/Helper/NumberHelperTest.php index 07069d506..0e7a9a9a4 100644 --- a/lib/Cake/Test/Case/View/Helper/NumberHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/NumberHelperTest.php @@ -118,15 +118,15 @@ class NumberHelperTest extends CakeTestCase { $result = $this->Number->currency(1000.45, NULL, array('after' => 'øre', 'before' => 'Kr. ', 'decimals' => ',', 'thousands' => '.')); $expected = 'Kr. 1.000,45'; - $this->assertEquals($expected,$result); + $this->assertEquals($expected, $result); $result = $this->Number->currency(0.5, 'USD'); $expected = '50c'; - $this->assertEquals($expected,$result); + $this->assertEquals($expected, $result); $result = $this->Number->currency(0.5, NULL, array('after' => 'øre')); $expected = '50øre'; - $this->assertEquals($expected,$result); + $this->assertEquals($expected, $result); $result = $this->Number->currency(1, null, array('wholeSymbol' => '$ ')); $expected = '$ 1.00'; @@ -174,16 +174,16 @@ class NumberHelperTest extends CakeTestCase { $this->Number->addFormat('NOK', array('before' => 'Kr. ')); $result = $this->Number->currency(1000, 'NOK'); $expected = 'Kr. 1,000.00'; - $this->assertEquals($expected,$result); + $this->assertEquals($expected, $result); $this->Number->addFormat('Other', array('before' => '$$ ', 'after' => 'c!')); $result = $this->Number->currency(0.22, 'Other'); $expected = '22c!'; - $this->assertEquals($expected,$result); + $this->assertEquals($expected, $result); $result = $this->Number->currency(-10, 'Other'); $expected = '($$ 10.00)'; - $this->assertEquals($expected,$result); + $this->assertEquals($expected, $result); } /** diff --git a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php index 36e91f454..a10a211dc 100644 --- a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php @@ -58,9 +58,9 @@ class TextHelperTest extends CakeTestCase { $text3 = '© 2005-2007, Cake Software Foundation, Inc.
written by Alexander Wegener'; $text4 = ' This image tag is not XHTML conform!

But the following image tag should be conform Me, myself and I
Great, or?'; $text5 = '01234567890'; - $text6 = '

Extra dates have been announced for this year\'s tour.

Tickets for the new shows in

'; - $text7 = 'El moño está en el lugar correcto. Eso fue lo que dijo la niña, ¿habrá dicho la verdad?'; - $text8 = 'Vive la R'.chr(195).chr(169).'publique de France'; + $text6 = '

Extra dates have been announced for this year\'s tour.

Tickets for the new shows in

'; + $text7 = 'El moño está en el lugar correcto. Eso fue lo que dijo la niña, ¿habrá dicho la verdad?'; + $text8 = 'Vive la R'.chr(195).chr(169).'publique de France'; $text9 = 'НОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыь'; $this->assertSame($this->Text->truncate($text1, 15), 'The quick br...'); diff --git a/lib/Cake/Test/Fixture/CounterCachePostFixture.php b/lib/Cake/Test/Fixture/CounterCachePostFixture.php index dd7b92f1c..c2459d91f 100644 --- a/lib/Cake/Test/Fixture/CounterCachePostFixture.php +++ b/lib/Cake/Test/Fixture/CounterCachePostFixture.php @@ -33,9 +33,9 @@ class CounterCachePostFixture extends CakeTestFixture { 'published' => array('type' => 'boolean', 'null' => false, 'default' => 0) ); - public $records = array( + public $records = array( array('id' => 1, 'title' => 'Rock and Roll', 'user_id' => 66, 'published' => false), array('id' => 2, 'title' => 'Music', 'user_id' => 66, 'published' => true), array('id' => 3, 'title' => 'Food', 'user_id' => 301, 'published' => true), - ); + ); } diff --git a/lib/Cake/Test/Fixture/CounterCachePostNonstandardPrimaryKeyFixture.php b/lib/Cake/Test/Fixture/CounterCachePostNonstandardPrimaryKeyFixture.php index b4b4f3f21..baee67fe2 100644 --- a/lib/Cake/Test/Fixture/CounterCachePostNonstandardPrimaryKeyFixture.php +++ b/lib/Cake/Test/Fixture/CounterCachePostNonstandardPrimaryKeyFixture.php @@ -32,9 +32,9 @@ class CounterCachePostNonstandardPrimaryKeyFixture extends CakeTestFixture { 'uid' => array('type' => 'integer', 'null' => true), ); - public $records = array( + public $records = array( array('pid' => 1, 'title' => 'Rock and Roll', 'uid' => 66), array('pid' => 2, 'title' => 'Music', 'uid' => 66), array('pid' => 3, 'title' => 'Food', 'uid' => 301), - ); + ); } diff --git a/lib/Cake/Test/Fixture/GroupUpdateAllFixture.php b/lib/Cake/Test/Fixture/GroupUpdateAllFixture.php index 30fc34866..c8d17117f 100644 --- a/lib/Cake/Test/Fixture/GroupUpdateAllFixture.php +++ b/lib/Cake/Test/Fixture/GroupUpdateAllFixture.php @@ -23,31 +23,35 @@ * @package Cake.Test.Fixture */ class GroupUpdateAllFixture extends CakeTestFixture { - public $name = 'GroupUpdateAll'; - public $table = 'group_update_all'; + public $name = 'GroupUpdateAll'; + public $table = 'group_update_all'; - public $fields = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), - 'name' => array('type' => 'string', 'null' => false, 'length' => 29), - 'code' => array('type' => 'integer', 'null' => false, 'length' => 4), - 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) - ); - public $records = array( - array( - 'id' => 1, - 'name' => 'group one', - 'code' => 120), - array( - 'id' => 2, - 'name' => 'group two', - 'code' => 125), - array( - 'id' => 3, - 'name' => 'group three', - 'code' => 130), - array( - 'id' => 4, - 'name' => 'group four', - 'code' => 135) - ); + public $fields = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), + 'name' => array('type' => 'string', 'null' => false, 'length' => 29), + 'code' => array('type' => 'integer', 'null' => false, 'length' => 4), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) + ); + public $records = array( + array( + 'id' => 1, + 'name' => 'group one', + 'code' => 120 + ), + array( + 'id' => 2, + 'name' => 'group two', + 'code' => 125 + ), + array( + 'id' => 3, + 'name' => 'group three', + 'code' => 130 + ), + array( + 'id' => 4, + 'name' => 'group four', + 'code' => 135 + ), + ); } diff --git a/lib/Cake/Test/Fixture/ProductUpdateAllFixture.php b/lib/Cake/Test/Fixture/ProductUpdateAllFixture.php index 5aebb80f0..4e3c078a2 100644 --- a/lib/Cake/Test/Fixture/ProductUpdateAllFixture.php +++ b/lib/Cake/Test/Fixture/ProductUpdateAllFixture.php @@ -26,34 +26,37 @@ class ProductUpdateAllFixture extends CakeTestFixture { public $name = 'ProductUpdateAll'; public $table = 'product_update_all'; - public $fields = array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), - 'name' => array('type' => 'string', 'null' => false, 'length' => 29), - 'groupcode' => array('type' => 'integer', 'null' => false, 'length' => 4), - 'group_id' => array('type' => 'integer', 'null' => false, 'length' => 8), - 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) - ); - public $records = array( - array( - 'id' => 1, - 'name' => 'product one', - 'groupcode' => 120, - 'group_id' => 1 - ), - array( - 'id' => 2, - 'name' => 'product two', - 'groupcode' => 120, - 'group_id' => 1), - array( - 'id' => 3, - 'name' => 'product three', - 'groupcode' => 125, - 'group_id' => 2), - array( - 'id' => 4, - 'name' => 'product four', - 'groupcode' => 135, - 'group_id' => 4) - ); + public $fields = array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), + 'name' => array('type' => 'string', 'null' => false, 'length' => 29), + 'groupcode' => array('type' => 'integer', 'null' => false, 'length' => 4), + 'group_id' => array('type' => 'integer', 'null' => false, 'length' => 8), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)) + ); + public $records = array( + array( + 'id' => 1, + 'name' => 'product one', + 'groupcode' => 120, + 'group_id' => 1 + ), + array( + 'id' => 2, + 'name' => 'product two', + 'groupcode' => 120, + 'group_id' => 1 + ), + array( + 'id' => 3, + 'name' => 'product three', + 'groupcode' => 125, + 'group_id' => 2 + ), + array( + 'id' => 4, + 'name' => 'product four', + 'groupcode' => 135, + 'group_id' => 4 + ), + ); } diff --git a/lib/Cake/Test/test_app/View/Pages/home.ctp b/lib/Cake/Test/test_app/View/Pages/home.ctp index a765a8878..9d84a57b9 100644 --- a/lib/Cake/Test/test_app/View/Pages/home.ctp +++ b/lib/Cake/Test/test_app/View/Pages/home.ctp @@ -49,7 +49,7 @@ App::uses('Debugger', 'Utility');

'; echo __d('cake_dev', 'Your database configuration file is present.'); $filePresent = true; diff --git a/lib/Cake/TestSuite/CakeTestRunner.php b/lib/Cake/TestSuite/CakeTestRunner.php index 7c8b2c27f..f4eb51495 100644 --- a/lib/Cake/TestSuite/CakeTestRunner.php +++ b/lib/Cake/TestSuite/CakeTestRunner.php @@ -74,7 +74,7 @@ class CakeTestRunner extends PHPUnit_TextUI_TestRunner { } } return $result; - } + } /** * Get the fixture manager class specified or use the default one. diff --git a/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php b/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php index 16bb9d760..a2ce54a8b 100644 --- a/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php +++ b/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php @@ -137,7 +137,7 @@ class CakeHtmlReporter extends CakeBaseReporter { echo "\n"; echo '

'; echo '

Time: ' . $result->time() . ' seconds

'; - echo '

Peak memory: ' . number_format(memory_get_peak_usage()) . ' bytes

'; + echo '

Peak memory: ' . number_format(memory_get_peak_usage()) . ' bytes

'; echo $this->_paintLinks(); echo '
'; if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) { diff --git a/lib/Cake/TestSuite/Reporter/CakeTextReporter.php b/lib/Cake/TestSuite/Reporter/CakeTextReporter.php index 543b9f014..d8dbce046 100644 --- a/lib/Cake/TestSuite/Reporter/CakeTextReporter.php +++ b/lib/Cake/TestSuite/Reporter/CakeTextReporter.php @@ -84,7 +84,7 @@ class CakeTextReporter extends CakeBaseReporter { ', Exceptions: ' . $result->errorCount() . "\n"; echo 'Time: ' . $result->time() . " seconds\n"; - echo 'Peak memory: ' . number_format(memory_get_peak_usage()) . " bytes\n"; + echo 'Peak memory: ' . number_format(memory_get_peak_usage()) . " bytes\n"; if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) { $coverage = $result->getCodeCoverage()->getSummary(); diff --git a/lib/Cake/Utility/File.php b/lib/Cake/Utility/File.php index 46b9225a0..3cb0219c6 100644 --- a/lib/Cake/Utility/File.php +++ b/lib/Cake/Utility/File.php @@ -333,7 +333,7 @@ class File { $this->info(); } if (isset($this->info['extension'])) { - return basename($this->name, '.'.$this->info['extension']); + return basename($this->name, '.' . $this->info['extension']); } elseif ($this->name) { return $this->name; } diff --git a/lib/Cake/Utility/Set.php b/lib/Cake/Utility/Set.php index e53a9b37f..8f7729b94 100644 --- a/lib/Cake/Utility/Set.php +++ b/lib/Cake/Utility/Set.php @@ -529,7 +529,7 @@ class Set { } continue; } - list(,$key,$op,$expected) = $match; + list(, $key, $op, $expected) = $match; if (!isset($data[$key])) { return false; } @@ -630,7 +630,7 @@ class Set { $pattern = substr($key, 1, -1); foreach ($data as $j => $val) { - if (preg_match('/^'.$pattern.'/s', $j) !== 0) { + if (preg_match('/^' . $pattern . '/s', $j) !== 0) { $tmpPath = array_slice($path, $i + 1); if (empty($tmpPath)) { $tmp[$j] = $val; diff --git a/lib/Cake/Utility/String.php b/lib/Cake/Utility/String.php index f9c51c396..4b2a524b3 100644 --- a/lib/Cake/Utility/String.php +++ b/lib/Cake/Utility/String.php @@ -247,7 +247,7 @@ class String { } if (!isset($options['format']) && isset($options['before'])) { - $str = str_replace($options['escape'].$options['before'], $options['before'], $str); + $str = str_replace($options['escape'] . $options['before'], $options['before'], $str); } return ($options['clean']) ? String::cleanInsert($str, $options) : $str; } diff --git a/lib/Cake/Utility/Validation.php b/lib/Cake/Utility/Validation.php index 26dea7bc3..3c7ee5831 100644 --- a/lib/Cake/Utility/Validation.php +++ b/lib/Cake/Utility/Validation.php @@ -382,7 +382,7 @@ class Validation { if (is_null($places)) { $regex = '/^[-+]?[0-9]*\\.{1}[0-9]+(?:[eE][-+]?[0-9]+)?$/'; } else { - $regex = '/^[-+]?[0-9]*\\.{1}[0-9]{'.$places.'}$/'; + $regex = '/^[-+]?[0-9]*\\.{1}[0-9]{' . $places . '}$/'; } } return self::_check($check, $regex); diff --git a/lib/Cake/View/Helper/CacheHelper.php b/lib/Cake/View/Helper/CacheHelper.php index 642a52df9..2f2e4a8a9 100644 --- a/lib/Cake/View/Helper/CacheHelper.php +++ b/lib/Cake/View/Helper/CacheHelper.php @@ -298,7 +298,7 @@ class CacheHelper extends AppHelper { $this->loadHelpers(); extract($this->viewVars, EXTR_SKIP); ?>'; - $content = preg_replace("/(<\\?xml)/", "",$content); + $content = preg_replace("/(<\\?xml)/", "", $content); $file .= $content; return cache('views' . DS . $cache, $file, $timestamp); } diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index 7e9ae0779..835151ad3 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -605,7 +605,7 @@ class HtmlHelper extends AppHelper { } $out = array(); foreach ($data as $key=> $value) { - $out[] = $key.':'.$value.';'; + $out[] = $key . ':' . $value . ';'; } if ($oneline) { return join(' ', $out); diff --git a/lib/Cake/View/Helper/TextHelper.php b/lib/Cake/View/Helper/TextHelper.php index ee35d594d..ee11b037b 100644 --- a/lib/Cake/View/Helper/TextHelper.php +++ b/lib/Cake/View/Helper/TextHelper.php @@ -294,7 +294,7 @@ class TextHelper extends AppHelper { if ($html) { foreach ($openTags as $tag) { - $truncate .= ''; + $truncate .= ''; } } diff --git a/lib/Cake/View/Helper/TimeHelper.php b/lib/Cake/View/Helper/TimeHelper.php index 729f3436e..95dc61dff 100644 --- a/lib/Cake/View/Helper/TimeHelper.php +++ b/lib/Cake/View/Helper/TimeHelper.php @@ -132,7 +132,7 @@ class TimeHelper extends AppHelper { case 'p': case 'P': $default = array('am' => 0, 'pm' => 1); - $meridiem = $default[date('a',$this->__time)]; + $meridiem = $default[date('a', $this->__time)]; $format = __dc('cake', 'am_pm', 5); if (is_array($format)) { $meridiem = $format[$meridiem]; @@ -142,7 +142,7 @@ class TimeHelper extends AppHelper { case 'r': $complete = __dc('cake', 't_fmt_ampm', 5); if ($complete != 't_fmt_ampm') { - return str_replace('%p',$this->_translateSpecifier(array('%p', 'p')),$complete); + return str_replace('%p', $this->_translateSpecifier(array('%p', 'p')), $complete); } break; case 'R': @@ -344,7 +344,7 @@ class TimeHelper extends AppHelper { */ public function isThisMonth($dateString, $userOffset = null) { $date = $this->fromString($dateString); - return date('m Y',$date) == date('m Y', time()); + return date('m Y', $date) == date('m Y', time()); } /** @@ -671,7 +671,7 @@ class TimeHelper extends AppHelper { } $date = $this->fromString($dateString, $userOffset); - $interval = $this->fromString('-'.$timeInterval); + $interval = $this->fromString('-' . $timeInterval); if ($date >= $interval && $date <= time()) { return true; diff --git a/lib/Cake/View/Scaffolds/view.ctp b/lib/Cake/View/Scaffolds/view.ctp index 9e36fffd4..7ad263587 100644 --- a/lib/Cake/View/Scaffolds/view.ctp +++ b/lib/Cake/View/Scaffolds/view.ctp @@ -45,10 +45,10 @@ foreach ($scaffoldFields as $_field) {

    " .$this->Html->link(__d('cake', 'Edit %s', $singularHumanName), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey])). " \n"; - echo "\t\t
  • " .$this->Html->link(__d('cake', 'Delete %s', $singularHumanName), array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __d('cake', 'Are you sure you want to delete').' #' . ${$singularVar}[$modelClass][$primaryKey] . '?'). "
  • \n"; - echo "\t\t
  • " .$this->Html->link(__d('cake', 'List %s', $pluralHumanName), array('action' => 'index')). "
  • \n"; - echo "\t\t
  • " .$this->Html->link(__d('cake', 'New %s', $singularHumanName), array('action' => 'add')). "
  • \n"; + echo "\t\t
  • " . $this->Html->link(__d('cake', 'Edit %s', $singularHumanName), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey])) . "
  • \n"; + echo "\t\t
  • " . $this->Html->link(__d('cake', 'Delete %s', $singularHumanName), array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __d('cake', 'Are you sure you want to delete').' #' . ${$singularVar}[$modelClass][$primaryKey] . '?') . "
  • \n"; + echo "\t\t
  • " . $this->Html->link(__d('cake', 'List %s', $pluralHumanName), array('action' => 'index')) . "
  • \n"; + echo "\t\t
  • " . $this->Html->link(__d('cake', 'New %s', $singularHumanName), array('action' => 'add')) . "
  • \n"; $done = array(); foreach ($associations as $_type => $_data) { diff --git a/lib/Cake/bootstrap.php b/lib/Cake/bootstrap.php index aee3dc4ff..17f647784 100644 --- a/lib/Cake/bootstrap.php +++ b/lib/Cake/bootstrap.php @@ -46,52 +46,52 @@ if (!defined('WEBROOT_DIR')) { * Path to the application's directory. */ if (!defined('APP')) { - define('APP', ROOT.DS.APP_DIR.DS); + define('APP', ROOT . DS . APP_DIR.DS); } /** * Path to the application's libs directory. */ - define('APPLIBS', APP.'Lib'.DS); + define('APPLIBS', APP . 'Lib' . DS); /** * Path to the public CSS directory. */ - define('CSS', WWW_ROOT.'css'.DS); + define('CSS', WWW_ROOT . 'css' . DS); /** * Path to the public JavaScript directory. */ - define('JS', WWW_ROOT.'js'.DS); + define('JS', WWW_ROOT . 'js' . DS); /** * Path to the public images directory. */ - define('IMAGES', WWW_ROOT.'img'.DS); + define('IMAGES', WWW_ROOT . 'img' . DS); /** * Path to the tests directory. */ if (!defined('TESTS')) { - define('TESTS', APP.'Test'.DS); + define('TESTS', APP . 'Test' . DS); } /** * Path to the temporary files directory. */ if (!defined('TMP')) { - define('TMP', APP.'tmp'.DS); + define('TMP', APP . 'tmp' . DS); } /** * Path to the logs directory. */ - define('LOGS', TMP.'logs'.DS); + define('LOGS', TMP . 'logs' . DS); /** * Path to the cache files directory. It can be shared between hosts in a multi-server setup. */ - define('CACHE', TMP.'cache'.DS); + define('CACHE', TMP . 'cache' . DS); /** * Path to the vendors directory. @@ -143,13 +143,13 @@ Configure::bootstrap(isset($boot) ? $boot : true); if (!defined('FULL_BASE_URL')) { $s = null; if (env('HTTPS')) { - $s ='s'; + $s = 's'; } $httpHost = env('HTTP_HOST'); if (isset($httpHost)) { - define('FULL_BASE_URL', 'http'.$s.'://'.$httpHost); + define('FULL_BASE_URL', 'http' . $s . '://' . $httpHost); } unset($httpHost, $s); } From d794084d382b75e0dedecdbe7247169d49926ea9 Mon Sep 17 00:00:00 2001 From: Kyle Robinson Young Date: Thu, 15 Dec 2011 23:00:07 -0800 Subject: [PATCH 10/20] More code standards formatting --- .../Controller/Component/AclComponent.php | 2 +- lib/Cake/Model/AclNode.php | 2 +- .../Model/Datasource/Database/Postgres.php | 10 +++---- .../Test/Case/Model/ModelIntegrationTest.php | 2 +- lib/Cake/Test/Case/Model/ModelWriteTest.php | 14 ++++----- lib/Cake/Test/Case/Model/models.php | 2 +- lib/Cake/Test/Case/Utility/SetTest.php | 2 +- .../Test/Fixture/GroupUpdateAllFixture.php | 24 +++++++-------- lib/Cake/Utility/Debugger.php | 26 ++++++++-------- lib/Cake/Utility/Inflector.php | 2 +- lib/Cake/Utility/Validation.php | 30 ++++++++++--------- lib/Cake/View/Helper/HtmlHelper.php | 6 ++-- 12 files changed, 62 insertions(+), 60 deletions(-) diff --git a/lib/Cake/Controller/Component/AclComponent.php b/lib/Cake/Controller/Component/AclComponent.php index a5e1cdd93..73d7506a9 100644 --- a/lib/Cake/Controller/Component/AclComponent.php +++ b/lib/Cake/Controller/Component/AclComponent.php @@ -489,7 +489,7 @@ class DbAcl extends Object implements AclInterface { return array( 'aro' => Set::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'), - 'aco' => Set::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id'), + 'aco' => Set::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id'), 'link' => $this->Aro->Permission->find('all', array('conditions' => array( $this->Aro->Permission->alias . '.aro_id' => Set::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'), $this->Aro->Permission->alias . '.aco_id' => Set::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id') diff --git a/lib/Cake/Model/AclNode.php b/lib/Cake/Model/AclNode.php index a07b33210..80305cceb 100644 --- a/lib/Cake/Model/AclNode.php +++ b/lib/Cake/Model/AclNode.php @@ -95,7 +95,7 @@ class AclNode extends AppModel { $queryData['joins'][] = array( 'table' => $table, 'alias' => "{$type}{$i}", - 'type' => 'LEFT', + 'type' => 'LEFT', 'conditions' => array( $db->name("{$type}{$i}.lft") . ' > ' . $db->name("{$type}{$j}.lft"), $db->name("{$type}{$i}.rght") . ' < ' . $db->name("{$type}{$j}.rght"), diff --git a/lib/Cake/Model/Datasource/Database/Postgres.php b/lib/Cake/Model/Datasource/Database/Postgres.php index bf60819d6..531adb62c 100644 --- a/lib/Cake/Model/Datasource/Database/Postgres.php +++ b/lib/Cake/Model/Datasource/Database/Postgres.php @@ -67,7 +67,7 @@ class Postgres extends DboSource { */ public $columns = array( 'primary_key' => array('name' => 'serial NOT NULL'), - 'string' => array('name' => 'varchar', 'limit' => '255'), + 'string' => array('name' => 'varchar', 'limit' => '255'), 'text' => array('name' => 'text'), 'integer' => array('name' => 'integer', 'formatter' => 'intval'), 'float' => array('name' => 'float', 'formatter' => 'floatval'), @@ -78,7 +78,7 @@ class Postgres extends DboSource { 'binary' => array('name' => 'bytea'), 'boolean' => array('name' => 'boolean'), 'number' => array('name' => 'numeric'), - 'inet' => array('name' => 'inet') + 'inet' => array('name' => 'inet') ); /** @@ -218,14 +218,14 @@ class Postgres extends DboSource { $length = null; } $fields[$c->name] = array( - 'type' => $this->column($type), - 'null' => ($c->null == 'NO' ? false : true), + 'type' => $this->column($type), + 'null' => ($c->null == 'NO' ? false : true), 'default' => preg_replace( "/^'(.*)'$/", "$1", preg_replace('/::.*/', '', $c->default) ), - 'length' => $length + 'length' => $length ); if ($model instanceof Model) { if ($c->name == $model->primaryKey) { diff --git a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php index 2a8ccbbb6..2ac6758cb 100644 --- a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php +++ b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php @@ -255,7 +255,7 @@ class ModelIntegrationTest extends BaseModelTest { array( 'table' => 'articles', 'alias' => 'Article', - 'type' => 'LEFT', + 'type' => 'LEFT', 'conditions' => array( 'User.id = Article.user_id', ), diff --git a/lib/Cake/Test/Case/Model/ModelWriteTest.php b/lib/Cake/Test/Case/Model/ModelWriteTest.php index cb37bbdd2..795549301 100644 --- a/lib/Cake/Test/Case/Model/ModelWriteTest.php +++ b/lib/Cake/Test/Case/Model/ModelWriteTest.php @@ -3780,7 +3780,7 @@ class ModelWriteTest extends BaseModelTest { ), array( 'body' => 3, - 'published' => 'sd', + 'published' => 'sd', ), ); $Something->create(); @@ -5320,7 +5320,7 @@ class ModelWriteTest extends BaseModelTest { $expected = array( '0' => array( 'ProductUpdateAll' => array( - 'id' => 1, + 'id' => 1, 'name' => 'product one', 'groupcode' => 120, 'group_id' => 1), @@ -5331,7 +5331,7 @@ class ModelWriteTest extends BaseModelTest { ), '1' => array( 'ProductUpdateAll' => array( - 'id' => 2, + 'id' => 2, 'name' => 'product two', 'groupcode' => 120, 'group_id' => 1), @@ -5384,7 +5384,7 @@ class ModelWriteTest extends BaseModelTest { $expected = array( '0' => array( 'ProductUpdateAll' => array( - 'id' => 1, + 'id' => 1, 'name' => 'new product', 'groupcode' => 120, 'group_id' => 1), @@ -5395,7 +5395,7 @@ class ModelWriteTest extends BaseModelTest { ), '1' => array( 'ProductUpdateAll' => array( - 'id' => 2, + 'id' => 2, 'name' => 'new product', 'groupcode' => 120, 'group_id' => 1), @@ -5437,7 +5437,7 @@ class ModelWriteTest extends BaseModelTest { $expected = array( '0' => array( 'ProductUpdateAll' => array( - 'id' => 1, + 'id' => 1, 'name' => 'new product', 'groupcode' => 120, 'group_id' => 1), @@ -5448,7 +5448,7 @@ class ModelWriteTest extends BaseModelTest { ), '1' => array( 'ProductUpdateAll' => array( - 'id' => 2, + 'id' => 2, 'name' => 'new product', 'groupcode' => 120, 'group_id' => 1), diff --git a/lib/Cake/Test/Case/Model/models.php b/lib/Cake/Test/Case/Model/models.php index bfa493de1..116b2f941 100644 --- a/lib/Cake/Test/Case/Model/models.php +++ b/lib/Cake/Test/Case/Model/models.php @@ -2504,7 +2504,7 @@ class UnconventionalTree extends NumberTree { public $actsAs = array( 'Tree' => array( 'parent' => 'join', - 'left' => 'left', + 'left' => 'left', 'right' => 'right' ) ); diff --git a/lib/Cake/Test/Case/Utility/SetTest.php b/lib/Cake/Test/Case/Utility/SetTest.php index dcb6b79fa..183c7675a 100644 --- a/lib/Cake/Test/Case/Utility/SetTest.php +++ b/lib/Cake/Test/Case/Utility/SetTest.php @@ -2909,7 +2909,7 @@ class SetTest extends CakeTestCase { 'item' => array( '@attr' => '123', 'titles' => 'list', - '@' => 'textforitems' + '@' => 'textforitems' ) ) ); diff --git a/lib/Cake/Test/Fixture/GroupUpdateAllFixture.php b/lib/Cake/Test/Fixture/GroupUpdateAllFixture.php index c8d17117f..3638f10f6 100644 --- a/lib/Cake/Test/Fixture/GroupUpdateAllFixture.php +++ b/lib/Cake/Test/Fixture/GroupUpdateAllFixture.php @@ -34,24 +34,24 @@ class GroupUpdateAllFixture extends CakeTestFixture { ); public $records = array( array( - 'id' => 1, - 'name' => 'group one', - 'code' => 120 + 'id' => 1, + 'name' => 'group one', + 'code' => 120 ), array( - 'id' => 2, - 'name' => 'group two', - 'code' => 125 + 'id' => 2, + 'name' => 'group two', + 'code' => 125 ), array( - 'id' => 3, - 'name' => 'group three', - 'code' => 130 + 'id' => 3, + 'name' => 'group three', + 'code' => 130 ), array( - 'id' => 4, - 'name' => 'group four', - 'code' => 135 + 'id' => 4, + 'name' => 'group four', + 'code' => 135 ), ); } diff --git a/lib/Cake/Utility/Debugger.php b/lib/Cake/Utility/Debugger.php index c6b2a0ffb..a90d658dc 100644 --- a/lib/Cake/Utility/Debugger.php +++ b/lib/Cake/Utility/Debugger.php @@ -276,12 +276,12 @@ class Debugger { public static function trace($options = array()) { $_this = Debugger::getInstance(); $defaults = array( - 'depth' => 999, - 'format' => $_this->_outputFormat, - 'args' => false, - 'start' => 0, - 'scope' => null, - 'exclude' => array('call_user_func_array', 'trigger_error') + 'depth' => 999, + 'format' => $_this->_outputFormat, + 'args' => false, + 'start' => 0, + 'scope' => null, + 'exclude' => array('call_user_func_array', 'trigger_error') ); $options = Set::merge($defaults, $options); @@ -453,13 +453,13 @@ class Debugger { return get_class($var) . "\n" . self::_object($var); case 'array': $var = array_merge($var, array_intersect_key(array( - 'password' => '*****', - 'login' => '*****', - 'host' => '*****', - 'database' => '*****', - 'port' => '*****', - 'prefix' => '*****', - 'schema' => '*****' + 'password' => '*****', + 'login' => '*****', + 'host' => '*****', + 'database' => '*****', + 'port' => '*****', + 'prefix' => '*****', + 'schema' => '*****' ), $var)); $out = "array("; diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index 0651c6544..62e8d39d7 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -41,7 +41,7 @@ class Inflector { '/(quiz)$/i' => '\1zes', '/^(ox)$/i' => '\1\2en', '/([m|l])ouse$/i' => '\1ice', - '/(matr|vert|ind)(ix|ex)$/i' => '\1ices', + '/(matr|vert|ind)(ix|ex)$/i' => '\1ices', '/(x|ch|ss|sh)$/i' => '\1es', '/([^aeiouy]|qu)y$/i' => '\1ies', '/(hive)$/i' => '\1s', diff --git a/lib/Cake/Utility/Validation.php b/lib/Cake/Utility/Validation.php index 3c7ee5831..3c0a84ceb 100644 --- a/lib/Cake/Utility/Validation.php +++ b/lib/Cake/Utility/Validation.php @@ -154,20 +154,22 @@ class Validation { } $cards = array( 'all' => array( - 'amex' => '/^3[4|7]\\d{13}$/', - 'bankcard' => '/^56(10\\d\\d|022[1-5])\\d{10}$/', - 'diners' => '/^(?:3(0[0-5]|[68]\\d)\\d{11})|(?:5[1-5]\\d{14})$/', - 'disc' => '/^(?:6011|650\\d)\\d{12}$/', - 'electron' => '/^(?:417500|4917\\d{2}|4913\\d{2})\\d{10}$/', - 'enroute' => '/^2(?:014|149)\\d{11}$/', - 'jcb' => '/^(3\\d{4}|2100|1800)\\d{11}$/', - 'maestro' => '/^(?:5020|6\\d{3})\\d{12}$/', - 'mc' => '/^5[1-5]\\d{14}$/', - 'solo' => '/^(6334[5-9][0-9]|6767[0-9]{2})\\d{10}(\\d{2,3})?$/', - 'switch' => '/^(?:49(03(0[2-9]|3[5-9])|11(0[1-2]|7[4-9]|8[1-2])|36[0-9]{2})\\d{10}(\\d{2,3})?)|(?:564182\\d{10}(\\d{2,3})?)|(6(3(33[0-4][0-9])|759[0-9]{2})\\d{10}(\\d{2,3})?)$/', - 'visa' => '/^4\\d{12}(\\d{3})?$/', - 'voyager' => '/^8699[0-9]{11}$/'), - 'fast' => '/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/'); + 'amex' => '/^3[4|7]\\d{13}$/', + 'bankcard' => '/^56(10\\d\\d|022[1-5])\\d{10}$/', + 'diners' => '/^(?:3(0[0-5]|[68]\\d)\\d{11})|(?:5[1-5]\\d{14})$/', + 'disc' => '/^(?:6011|650\\d)\\d{12}$/', + 'electron' => '/^(?:417500|4917\\d{2}|4913\\d{2})\\d{10}$/', + 'enroute' => '/^2(?:014|149)\\d{11}$/', + 'jcb' => '/^(3\\d{4}|2100|1800)\\d{11}$/', + 'maestro' => '/^(?:5020|6\\d{3})\\d{12}$/', + 'mc' => '/^5[1-5]\\d{14}$/', + 'solo' => '/^(6334[5-9][0-9]|6767[0-9]{2})\\d{10}(\\d{2,3})?$/', + 'switch' => '/^(?:49(03(0[2-9]|3[5-9])|11(0[1-2]|7[4-9]|8[1-2])|36[0-9]{2})\\d{10}(\\d{2,3})?)|(?:564182\\d{10}(\\d{2,3})?)|(6(3(33[0-4][0-9])|759[0-9]{2})\\d{10}(\\d{2,3})?)$/', + 'visa' => '/^4\\d{12}(\\d{3})?$/', + 'voyager' => '/^8699[0-9]{11}$/' + ), + 'fast' => '/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/' + ); if (is_array($type)) { foreach ($type as $value) { diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index 835151ad3..34fced7b2 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -144,9 +144,9 @@ class HtmlHelper extends AppHelper { * @var array */ protected $_docTypes = array( - 'html4-strict' => '', - 'html4-trans' => '', - 'html4-frame' => '', + 'html4-strict' => '', + 'html4-trans' => '', + 'html4-frame' => '', 'html5' => '', 'xhtml-strict' => '', 'xhtml-trans' => '', From 78325a13b900c451c5dfd05d5789c8de371f6787 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 16 Dec 2011 23:02:27 -0500 Subject: [PATCH 11/20] Remove un-used variable. Fixes #2382 --- lib/Cake/View/Helper/FormHelper.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index fa8d0abbb..d39ddc0e8 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -1756,10 +1756,6 @@ class FormHelper extends AppHelper { unset($attributes['type']); } - if (!isset($selected)) { - $selected = $attributes['value']; - } - if (!empty($attributes['multiple'])) { $style = ($attributes['multiple'] === 'checkbox') ? 'checkbox' : null; $template = ($style) ? 'checkboxmultiplestart' : 'selectmultiplestart'; From a71b0f98678d9e177a21f4de0d2bffb62fe3fad9 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 17 Dec 2011 12:09:50 -0500 Subject: [PATCH 12/20] Adding test for CacheHelper. Refs #2381 --- .../Test/Case/View/Helper/CacheHelperTest.php | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php index 0e32e2207..0f9dba07a 100644 --- a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php @@ -109,7 +109,6 @@ class CacheHelperTest extends CakeTestCase { $this->Controller->request->addParams(array( 'controller' => 'cache_test', 'action' => 'cache_parsing', - 'url' => array(), 'pass' => array(), 'named' => array() )); @@ -143,7 +142,6 @@ class CacheHelperTest extends CakeTestCase { $this->Controller->request->addParams(array( 'controller' => 'cache_test', 'action' => 'cache_parsing', - 'url' => array(), 'pass' => array('風街ろまん'), 'named' => array() )); @@ -170,7 +168,6 @@ class CacheHelperTest extends CakeTestCase { $this->Controller->request->addParams(array( 'controller' => 'cache_test', 'action' => 'cache_parsing', - 'url' => array(), 'pass' => array(), 'named' => array() )); @@ -205,7 +202,6 @@ class CacheHelperTest extends CakeTestCase { $this->Controller->request->addParams(array( 'controller' => 'cache_test', 'action' => 'cache_parsing', - 'url' => array(), 'pass' => array(), 'named' => array() )); @@ -237,7 +233,6 @@ class CacheHelperTest extends CakeTestCase { $this->Controller->request->addParams(array( 'controller' => 'cache_test', 'action' => 'cache_complex', - 'url' => array(), 'pass' => array(), 'named' => array() )); @@ -298,7 +293,6 @@ class CacheHelperTest extends CakeTestCase { $this->Controller->params = array( 'controller' => 'cache_test', 'action' => 'cache_parsing', - 'url' => array(), 'pass' => array(), 'named' => array() ); @@ -332,7 +326,6 @@ class CacheHelperTest extends CakeTestCase { $this->Controller->params = array( 'controller' => 'cache_test', 'action' => 'cache_parsing', - 'url' => array(), 'pass' => array(), 'named' => array() ); @@ -368,7 +361,6 @@ class CacheHelperTest extends CakeTestCase { $this->Controller->request->addParams(array( 'controller' => 'cache_test', 'action' => 'cache_parsing', - 'url' => array(), 'pass' => array(), 'named' => array() )); @@ -411,7 +403,6 @@ class CacheHelperTest extends CakeTestCase { $this->Controller->request->addParams(array( 'controller' => 'cache_test', 'action' => 'cache_parsing', - 'url' => array(), 'pass' => array(), 'named' => array() )); @@ -443,7 +434,6 @@ class CacheHelperTest extends CakeTestCase { $this->Controller->request->addParams(array( 'controller' => 'cache_test', 'action' => 'cache_parsing', - 'url' => array(), 'pass' => array(1, 2), 'named' => array( 'name' => 'mark', @@ -466,6 +456,38 @@ class CacheHelperTest extends CakeTestCase { @unlink($filename); } +/** + * Test that query string parameters are included in the cache filename. + * + * @return void + */ + public function testCacheWithQueryStringParams() { + Router::reload(); + + $this->Controller->cache_parsing(); + $this->Controller->request->addParams(array( + 'controller' => 'cache_test', + 'action' => 'cache_parsing', + 'pass' => array(), + 'named' => array() + )); + $this->Controller->request->query = array('q' => 'cakephp'); + $this->Controller->cacheAction = array( + 'cache_parsing' => 21600 + ); + $this->Controller->request->here = '/cache_test/cache_parsing'; + + $View = new View($this->Controller); + $result = $View->render('index'); + + $this->assertNotRegExp('/cake:nocache/', $result); + $this->assertNotRegExp('/php echo/', $result); + + $filename = CACHE . 'views' . DS . 'cache_test_cache_parsing_q_cakephp.php'; + $this->assertTrue(file_exists($filename), 'Missing cache file ' . $filename); + @unlink($filename); + } + /** * test that custom routes are respected when generating cache files. * @@ -480,7 +502,6 @@ class CacheHelperTest extends CakeTestCase { 'lang' => 'en', 'controller' => 'cache_test', 'action' => 'cache_parsing', - 'url' => array(), 'pass' => array(), 'named' => array() )); @@ -518,7 +539,6 @@ class CacheHelperTest extends CakeTestCase { $this->Controller->params = array( 'controller' => 'cacheTest', 'action' => 'cache_name', - 'url' => array(), 'pass' => array(), 'named' => array() ); @@ -597,7 +617,6 @@ class CacheHelperTest extends CakeTestCase { $this->Controller->params = array( 'controller' => 'cacheTest', 'action' => 'cache_empty_sections', - 'url' => array(), 'pass' => array(), 'named' => array() ); From e05d7d1791e275ac93cd5a4924c9c70372271add Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 17 Dec 2011 12:19:34 -0500 Subject: [PATCH 13/20] Make dispatcher::cached() use here() This allows separate cache files to be created for different query parameters. Fixes #2381 --- lib/Cake/Routing/Dispatcher.php | 4 ++-- lib/Cake/Test/Case/Routing/DispatcherTest.php | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Routing/Dispatcher.php b/lib/Cake/Routing/Dispatcher.php index 959fef242..4c4909d70 100644 --- a/lib/Cake/Routing/Dispatcher.php +++ b/lib/Cake/Routing/Dispatcher.php @@ -68,7 +68,7 @@ class Dispatcher { * are encountered. */ public function dispatch(CakeRequest $request, CakeResponse $response, $additionalParams = array()) { - if ($this->asset($request->url, $response) || $this->cached($request->here)) { + if ($this->asset($request->url, $response) || $this->cached($request->here())) { return; } @@ -203,7 +203,7 @@ class Dispatcher { /** * Outputs cached dispatch view cache * - * @param string $path Requested URL path + * @param string $path Requested URL path with any query string parameters * @return string|boolean False if is not cached or output */ public function cached($path) { diff --git a/lib/Cake/Test/Case/Routing/DispatcherTest.php b/lib/Cake/Test/Case/Routing/DispatcherTest.php index b827c6023..77521d7ed 100644 --- a/lib/Cake/Test/Case/Routing/DispatcherTest.php +++ b/lib/Cake/Test/Case/Routing/DispatcherTest.php @@ -1360,6 +1360,7 @@ class DispatcherTest extends CakeTestCase { * - Test simple views * - Test views with nocache tags * - Test requests with named + passed params. + * - Test requests with query string params * - Test themed views. * * @return array @@ -1373,6 +1374,7 @@ class DispatcherTest extends CakeTestCase { array('TestCachedPages/test_nocache_tags'), array('test_cached_pages/view/param/param'), array('test_cached_pages/view/foo:bar/value:goo'), + array('test_cached_pages/view?q=cakephp'), array('test_cached_pages/themed'), ); } @@ -1405,7 +1407,7 @@ class DispatcherTest extends CakeTestCase { $out = ob_get_clean(); ob_start(); - $dispatcher->cached($request->here); + $dispatcher->cached($request->here()); $cached = ob_get_clean(); $result = str_replace(array("\t", "\r\n", "\n"), "", $out); @@ -1414,7 +1416,7 @@ class DispatcherTest extends CakeTestCase { $this->assertEquals($expected, $result); - $filename = $this->__cachePath($request->here); + $filename = $this->__cachePath($request->here()); unlink($filename); } From 248a2d3f261229dcb7da30b82d90071bd8a72ab2 Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 18 Dec 2011 03:43:36 +0530 Subject: [PATCH 14/20] Adding missing Model::create() when using Model::save() in a loop. Fixing some code formatting. Fixes #848 --- lib/Cake/Model/Behavior/TreeBehavior.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/Cake/Model/Behavior/TreeBehavior.php b/lib/Cake/Model/Behavior/TreeBehavior.php index ff14fc98d..be6825fb6 100644 --- a/lib/Cake/Model/Behavior/TreeBehavior.php +++ b/lib/Cake/Model/Behavior/TreeBehavior.php @@ -577,7 +577,6 @@ class TreeBehavior extends ModelBehavior { if ($missingParentAction == 'return') { foreach ($missingParents as $id => $display) { $this->errors[] = 'cannot find the parent for ' . $Model->alias . ' with id ' . $id . '(' . $display . ')'; - } return false; } elseif ($missingParentAction == 'delete') { @@ -588,13 +587,14 @@ class TreeBehavior extends ModelBehavior { } $count = 1; foreach ($Model->find('all', array('conditions' => $scope, 'fields' => array($Model->primaryKey), 'order' => $left)) as $array) { - $Model->id = $array[$Model->alias][$Model->primaryKey]; $lft = $count++; $rght = $count++; + $Model->create(false); + $Model->id = $array[$Model->alias][$Model->primaryKey]; $Model->save(array($left => $lft, $right => $rght), array('callbacks' => false)); } foreach ($Model->find('all', array('conditions' => $scope, 'fields' => array($Model->primaryKey, $parent), 'order' => $left)) as $array) { - $Model->create(); + $Model->create(false); $Model->id = $array[$Model->alias][$Model->primaryKey]; $this->_setParent($Model, $array[$Model->alias][$parent]); } @@ -846,11 +846,10 @@ class TreeBehavior extends ModelBehavior { if (($Model->id == $parentId)) { return false; - } elseif (($node[$left] < $parentNode[$left]) && ($parentNode[$right] < $node[$right])) { return false; } - if (empty ($node[$left]) && empty ($node[$right])) { + if (empty($node[$left]) && empty($node[$right])) { $this->_sync($Model, 2, '+', '>= ' . $parentNode[$right], $created); $result = $Model->save( array($left => $parentNode[$right], $right => $parentNode[$right] + 1, $parent => $parentId), From 1358af783bb685366f491845111354f581db77db Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 18 Dec 2011 15:04:26 +0530 Subject: [PATCH 15/20] Added test case for TreeBehavior::recover(). Refs #2392 --- .../Model/Behavior/TreeBehaviorNumberTest.php | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php b/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php index 22e6e8290..c536a98c0 100644 --- a/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php +++ b/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php @@ -173,6 +173,57 @@ class TreeBehaviorNumberTest extends CakeTestCase { $this->assertSame($result, true); } +/** + * testRecoverUsingParentMode method + * + * @return void + */ + public function testRecoverUsingParentMode() { + extract($this->settings); + $this->Tree = new $modelClass(); + $this->Tree->Behaviors->disable('Tree'); + + $this->Tree->save(array('parent_id' => null, 'name' => 'Main', $parentField => null, $leftField => 0, $rightField => 0)); + $node1 = $this->Tree->id; + + $this->Tree->create(); + $this->Tree->save(array('parent_id' => null, 'name' => 'About Us', $parentField => $node1, $leftField => 0, $rightField => 0)); + $node11 = $this->Tree->id; + $this->Tree->create(); + $this->Tree->save(array('parent_id' => null, 'name' => 'Programs', $parentField => $node1, $leftField => 0, $rightField => 0)); + $node12 = $this->Tree->id; + $this->Tree->create(); + $this->Tree->save(array('parent_id' => null, 'name' => 'Mission and History', $parentField => $node11, $leftField => 0, $rightField => 0)); + $this->Tree->create(); + $this->Tree->save(array('parent_id' => null, 'name' => 'Overview', $parentField => $node12, $leftField => 0, $rightField => 0)); + + $this->Tree->Behaviors->enable('Tree'); + + $result = $this->Tree->verify(); + $this->assertNotSame($result, true); + + $result = $this->Tree->recover(); + $this->assertTrue($result); + + $result = $this->Tree->verify(); + $this->assertTrue($result); + + $result = $this->Tree->find('first', array( + 'fields' => array('name', $parentField, $leftField, $rightField), + 'conditions' => array('name' => 'Main'), + 'recursive' => -1 + )); + $expected = array( + $modelClass => array( + 'name' => 'Main', + $parentField => null, + $leftField => 1, + $rightField => 10 + ) + ); + $this->assertEquals($expected, $result); + } + /** * testRecoverFromMissingParent method * From e7c913acba7cfff3dd17dd7270c5079dfdad300d Mon Sep 17 00:00:00 2001 From: Fitorec Date: Sun, 18 Dec 2011 10:37:16 -0500 Subject: [PATCH 16/20] Fix unreachable code in Model mergeVars Squashed commit of the following: commit c8326460a46e563816ebfe7d9a13c475c2f0be63 Author: Fitorec Date: Tue Dec 6 18:04:11 2011 -0600 add a space after the comma in the $merge array commit 22ad6cdca503a6bbd68851acb0458bb7ab3388f0 Author: Fitorec Date: Tue Dec 6 03:31:54 2011 -0600 removing the condition and adding actsAs to the default list of merged keys. commit afa4dd0dee55c8b0d9533b8dde3a65aae3e08a34 Author: Fitorec Date: Mon Dec 5 12:10:32 2011 -0600 Solving the small defect in the array of behaviors(actsAs) Signed-off-by: mark_story --- lib/Cake/Model/Model.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 3fdc303cf..5d52a8091 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -672,10 +672,7 @@ class Model extends Object { } if (is_subclass_of($this, 'AppModel')) { - $merge = array('findMethods'); - if ($this->actsAs !== null || $this->actsAs !== false) { - $merge[] = 'actsAs'; - } + $merge = array('actsAs', 'findMethods'); $parentClass = get_parent_class($this); if ($parentClass !== 'AppModel') { $this->_mergeVars($merge, $parentClass); From c34bf673d5eec7e133748deab89635973cffa28f Mon Sep 17 00:00:00 2001 From: Kyle Robinson Young Date: Sun, 18 Dec 2011 09:40:23 -0800 Subject: [PATCH 17/20] Remove extra space in HtmlHelper radio tag --- lib/Cake/View/Helper/CacheHelper.php | 2 +- lib/Cake/View/Helper/HtmlHelper.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Cake/View/Helper/CacheHelper.php b/lib/Cake/View/Helper/CacheHelper.php index 2f2e4a8a9..198c34188 100644 --- a/lib/Cake/View/Helper/CacheHelper.php +++ b/lib/Cake/View/Helper/CacheHelper.php @@ -281,7 +281,7 @@ class CacheHelper extends AppHelper { $controller = new ' . $this->_View->name . 'Controller($request, $response); $controller->plugin = $this->plugin = \'' . $this->_View->plugin . '\'; $controller->helpers = $this->helpers = unserialize(base64_decode(\'' . base64_encode(serialize($this->_View->helpers)) . '\')); - $controller->layout = $this->layout = \'' . $this->_View->layout. '\'; + $controller->layout = $this->layout = \'' . $this->_View->layout . '\'; $controller->theme = $this->theme = \'' . $this->_View->theme . '\'; $controller->viewVars = unserialize(base64_decode(\'' . base64_encode(serialize($this->_View->viewVars)) . '\')); Router::setRequestInfo($controller->request); diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index 34fced7b2..23a0d8b80 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -46,7 +46,7 @@ class HtmlHelper extends AppHelper { 'hidden' => '', 'checkbox' => '', 'checkboxmultiple' => '', - 'radio' => '%s', + 'radio' => '%s', 'selectstart' => '', 'selectempty' => '', @@ -235,9 +235,9 @@ class HtmlHelper extends AppHelper { if (!is_array($type)) { $types = array( - 'rss' => array('type' => 'application/rss+xml', 'rel' => 'alternate', 'title' => $type, 'link' => $url), - 'atom' => array('type' => 'application/atom+xml', 'title' => $type, 'link' => $url), - 'icon' => array('type' => 'image/x-icon', 'rel' => 'icon', 'link' => $url), + 'rss' => array('type' => 'application/rss+xml', 'rel' => 'alternate', 'title' => $type, 'link' => $url), + 'atom' => array('type' => 'application/atom+xml', 'title' => $type, 'link' => $url), + 'icon' => array('type' => 'image/x-icon', 'rel' => 'icon', 'link' => $url), 'keywords' => array('name' => 'keywords', 'content' => $url), 'description' => array('name' => 'description', 'content' => $url), ); From 866177f37d3d03be6fa557cc3633f75223bb4c7a Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 19 Dec 2011 20:49:01 -0500 Subject: [PATCH 18/20] Fix issue with link generation and no title. Fix urlencoded text from being displayed in text of links. Fixes #2387 --- lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php | 12 ++++++++++++ lib/Cake/View/Helper/HtmlHelper.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php index 70a98f421..5c3844eb3 100644 --- a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php @@ -185,12 +185,24 @@ class HtmlHelperTest extends CakeTestCase { * @return void */ public function testLink() { + Router::connect('/:controller/:action/*'); + $this->Html->request->webroot = ''; $result = $this->Html->link('/home'); $expected = array('a' => array('href' => '/home'), 'preg:/\/home/', '/a'); $this->assertTags($result, $expected); + $result = $this->Html->link(array('action' => 'login', '<[You]>')); + $expected = array( + 'a' => array('href' => '/login/%3C%5BYou%5D%3E'), + 'preg:/\/login\/<\[You\]>/', + '/a' + ); + $this->assertTags($result, $expected); + + Router::reload(); + $result = $this->Html->link('Posts', array('controller' => 'posts', 'action' => 'index', 'full_base' => true)); $expected = array('a' => array('href' => FULL_BASE_URL . '/posts'), 'Posts', '/a'); $this->assertTags($result, $expected); diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index 23a0d8b80..1396922e2 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -327,7 +327,7 @@ class HtmlHelper extends AppHelper { $url = $this->url($url); } else { $url = $this->url($title); - $title = $url; + $title = h(urldecode($url)); $escapeTitle = false; } From a41539dfa488f3859eefe52de74b9ceb0557b827 Mon Sep 17 00:00:00 2001 From: euromark Date: Mon, 19 Dec 2011 14:18:28 +0100 Subject: [PATCH 19/20] Indentation fix (tab instead of spaces) Fixes #2398 Conflicts: lib/Cake/Test/Case/Console/Command/ShellTest.php Signed-off-by: mark_story --- lib/Cake/Cache/Engine/FileEngine.php | 4 +- lib/Cake/Cache/Engine/MemcacheEngine.php | 2 +- lib/Cake/Model/Datasource/CakeSession.php | 4 +- lib/Cake/Model/Model.php | 2 +- lib/Cake/Routing/Dispatcher.php | 2 +- .../Case/Cache/Engine/MemcacheEngineTest.php | 12 +-- .../Behavior/ContainableBehaviorTest.php | 2 +- .../Test/Case/Model/ConnectionManagerTest.php | 2 +- lib/Cake/Test/Case/Model/ModelDeleteTest.php | 14 ++-- lib/Cake/Test/Case/Model/ModelReadTest.php | 6 +- .../Test/Case/Network/Email/CakeEmailTest.php | 10 +-- lib/Cake/Test/Case/Utility/DebuggerTest.php | 12 +-- lib/Cake/Test/Case/Utility/InflectorTest.php | 4 +- lib/Cake/Test/Case/Utility/SetTest.php | 84 +++++++++---------- .../Test/Case/View/Helper/JsHelperTest.php | 4 +- lib/Cake/TestSuite/CakeTestSuiteCommand.php | 4 +- lib/Cake/View/Helper/JsBaseEngineHelper.php | 18 ++-- 17 files changed, 93 insertions(+), 93 deletions(-) diff --git a/lib/Cake/Cache/Engine/FileEngine.php b/lib/Cake/Cache/Engine/FileEngine.php index b18766013..4a1993b92 100644 --- a/lib/Cake/Cache/Engine/FileEngine.php +++ b/lib/Cake/Cache/Engine/FileEngine.php @@ -129,14 +129,14 @@ class FileEngine extends CacheEngine { $contents = $expires . $lineBreak . $data . $lineBreak; if ($this->settings['lock']) { - $this->_File->flock(LOCK_EX); + $this->_File->flock(LOCK_EX); } $this->_File->rewind(); $success = $this->_File->ftruncate(0) && $this->_File->fwrite($contents) && $this->_File->fflush(); if ($this->settings['lock']) { - $this->_File->flock(LOCK_UN); + $this->_File->flock(LOCK_UN); } return $success; diff --git a/lib/Cake/Cache/Engine/MemcacheEngine.php b/lib/Cake/Cache/Engine/MemcacheEngine.php index db798e4b0..0cbc84902 100644 --- a/lib/Cake/Cache/Engine/MemcacheEngine.php +++ b/lib/Cake/Cache/Engine/MemcacheEngine.php @@ -104,7 +104,7 @@ class MemcacheEngine extends CacheEngine { $position++; } } else { - $position = strpos($server, ':'); + $position = strpos($server, ':'); } $port = 11211; $host = $server; diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index f261bb861..e0d89222f 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -158,10 +158,10 @@ class CakeSession { return; } if (strpos($base, 'index.php') !== false) { - $base = str_replace('index.php', '', $base); + $base = str_replace('index.php', '', $base); } if (strpos($base, '?') !== false) { - $base = str_replace('?', '', $base); + $base = str_replace('?', '', $base); } self::$path = $base; } diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 5d52a8091..85b5f739b 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -761,7 +761,7 @@ class Model extends Object { } } } - } + } if (!$className) { return false; diff --git a/lib/Cake/Routing/Dispatcher.php b/lib/Cake/Routing/Dispatcher.php index 4c4909d70..98af0e72b 100644 --- a/lib/Cake/Routing/Dispatcher.php +++ b/lib/Cake/Routing/Dispatcher.php @@ -313,7 +313,7 @@ class Dispatcher { $response->type($contentType); } if (!$compressionEnabled) { - $response->header('Content-Length', filesize($assetFile)); + $response->header('Content-Length', filesize($assetFile)); } $response->cache(filemtime($assetFile)); $response->send(); diff --git a/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php index 42a24c60a..1c6a3769e 100644 --- a/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php +++ b/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php @@ -311,14 +311,14 @@ class MemcacheEngineTest extends CakeTestCase { */ public function testConfigurationConflict() { Cache::config('long_memcache', array( - 'engine' => 'Memcache', - 'duration' => '+2 seconds', - 'servers' => array('127.0.0.1:11211'), + 'engine' => 'Memcache', + 'duration' => '+2 seconds', + 'servers' => array('127.0.0.1:11211'), )); Cache::config('short_memcache', array( - 'engine' => 'Memcache', - 'duration' => '+1 seconds', - 'servers' => array('127.0.0.1:11211'), + 'engine' => 'Memcache', + 'duration' => '+1 seconds', + 'servers' => array('127.0.0.1:11211'), )); Cache::config('some_file', array('engine' => 'File')); diff --git a/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php b/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php index 3d62813f7..2523a8c2b 100644 --- a/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php +++ b/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php @@ -3614,7 +3614,7 @@ class ContainableBehaviorTest extends CakeTestCase { } catch (Exception $e) { $exceptions = true; } - $this->assertTrue(empty($exceptions)); + $this->assertTrue(empty($exceptions)); } /** diff --git a/lib/Cake/Test/Case/Model/ConnectionManagerTest.php b/lib/Cake/Test/Case/Model/ConnectionManagerTest.php index 7407c1de9..bacd89ec4 100644 --- a/lib/Cake/Test/Case/Model/ConnectionManagerTest.php +++ b/lib/Cake/Test/Case/Model/ConnectionManagerTest.php @@ -277,7 +277,7 @@ class ConnectionManagerTest extends CakeTestCase { ), App::RESET); CakePlugin::loadAll(); $expected = array( - 'datasource' => 'Test2Source' + 'datasource' => 'Test2Source' ); ConnectionManager::create('connection1', array('datasource' => 'Test2Source')); diff --git a/lib/Cake/Test/Case/Model/ModelDeleteTest.php b/lib/Cake/Test/Case/Model/ModelDeleteTest.php index ed6473164..9ce2e0717 100644 --- a/lib/Cake/Test/Case/Model/ModelDeleteTest.php +++ b/lib/Cake/Test/Case/Model/ModelDeleteTest.php @@ -767,7 +767,7 @@ class ModelDeleteTest extends BaseModelTest { )), true); // Article 1 should have Tag.1 and Tag.2 - $before = $Article->find("all", array( + $before = $Article->find("all", array( "conditions" => array("Article.id" => 1), )); $this->assertEquals(count($before[0]['Tag']), 2, 'Tag count for Article.id = 1 is incorrect, should be 2 %s'); @@ -781,17 +781,17 @@ class ModelDeleteTest extends BaseModelTest { ); $Tag->save($submitted_data); - // One more submission (The other way around) to make sure the reverse save looks good. - $submitted_data = array( + // One more submission (The other way around) to make sure the reverse save looks good. + $submitted_data = array( "Article" => array("id" => 2, 'title' => 'second article'), "Tag" => array( "Tag" => array(2, 3) ) ); - // ERROR: - // Postgresql: DELETE FROM "articles_tags" WHERE tag_id IN ('1', '3') - // MySQL: DELETE `ArticlesTag` FROM `articles_tags` AS `ArticlesTag` WHERE `ArticlesTag`.`article_id` = 2 AND `ArticlesTag`.`tag_id` IN (1, 3) - $Article->save($submitted_data); + // ERROR: + // Postgresql: DELETE FROM "articles_tags" WHERE tag_id IN ('1', '3') + // MySQL: DELETE `ArticlesTag` FROM `articles_tags` AS `ArticlesTag` WHERE `ArticlesTag`.`article_id` = 2 AND `ArticlesTag`.`tag_id` IN (1, 3) + $Article->save($submitted_data); // Want to make sure Article #1 has Tag #1 and Tag #2 still. $after = $Article->find("all", array( diff --git a/lib/Cake/Test/Case/Model/ModelReadTest.php b/lib/Cake/Test/Case/Model/ModelReadTest.php index 979a17ab2..5005fd906 100644 --- a/lib/Cake/Test/Case/Model/ModelReadTest.php +++ b/lib/Cake/Test/Case/Model/ModelReadTest.php @@ -303,7 +303,7 @@ class ModelReadTest extends BaseModelTest { $result = $Article->query($query, $params, false); $this->assertTrue(is_array($result)); $this->assertTrue( - isset($result[0][$this->db->fullTableName('articles', false)]) + isset($result[0][$this->db->fullTableName('articles', false)]) || isset($result[0][0]) ); $result = $this->db->getQueryCache($query, $params); @@ -317,7 +317,7 @@ class ModelReadTest extends BaseModelTest { $result = $Article->query($query, $params); $this->assertTrue(is_array($result)); $this->assertTrue( - isset($result[0][$this->db->fullTableName('articles', false)]['title']) + isset($result[0][$this->db->fullTableName('articles', false)]['title']) || isset($result[0][0]['title']) ); @@ -7651,7 +7651,7 @@ class ModelReadTest extends BaseModelTest { $this->loadFixtures('Post', 'Author'); $Post = new Post(); $Post->virtualFields = array( - 'writer' => 'Author.user' + 'writer' => 'Author.user' ); $result = $Post->find('first'); $this->assertTrue(isset($result['Post']['writer']), 'virtual field not fetched %s'); diff --git a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php index ee5a1d415..29f4273a3 100644 --- a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php +++ b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php @@ -301,11 +301,11 @@ class CakeEmailTest extends CakeTestCase { $result = $this->CakeEmail->formatAddress(array('cake@cakephp.org' => '寿限無寿限無五劫の擦り切れ海砂利水魚の水行末雲来末風来末食う寝る処に住む処やぶら小路の藪柑子パイポパイポパイポのシューリンガンシューリンガンのグーリンダイグーリンダイのポンポコピーのポンポコナーの長久命の長助')); $expected = array("=?ISO-2022-JP?B?GyRCPHc4Qkw1PHc4Qkw1OF45ZSROOyQkakBaJGwzJDo9TXg/ZTV7GyhC?=\r\n" - ." =?ISO-2022-JP?B?GyRCJE4/ZTlUS3YxQE1oS3ZJd01oS3Y/KSQmPzIkaz1oJEs9OyRgGyhC?=\r\n" - ." =?ISO-2022-JP?B?GyRCPWgkZCRWJGk+Lk8pJE5pLjQ7O1IlUSUkJV0lUSUkJV0lUSUkGyhC?=\r\n" - ." =?ISO-2022-JP?B?GyRCJV0kTiU3JWUhPCVqJXMlLCVzJTclZSE8JWolcyUsJXMkTiUwGyhC?=\r\n" - ." =?ISO-2022-JP?B?GyRCITwlaiVzJUAlJCUwITwlaiVzJUAlJCROJV0lcyVdJTMlVCE8GyhC?=\r\n" - ." =?ISO-2022-JP?B?GyRCJE4lXSVzJV0lMyVKITwkTkQ5NVdMPyRORDk9dRsoQg==?= "); + ." =?ISO-2022-JP?B?GyRCJE4/ZTlUS3YxQE1oS3ZJd01oS3Y/KSQmPzIkaz1oJEs9OyRgGyhC?=\r\n" + ." =?ISO-2022-JP?B?GyRCPWgkZCRWJGk+Lk8pJE5pLjQ7O1IlUSUkJV0lUSUkJV0lUSUkGyhC?=\r\n" + ." =?ISO-2022-JP?B?GyRCJV0kTiU3JWUhPCVqJXMlLCVzJTclZSE8JWolcyUsJXMkTiUwGyhC?=\r\n" + ." =?ISO-2022-JP?B?GyRCITwlaiVzJUAlJCUwITwlaiVzJUAlJCROJV0lcyVdJTMlVCE8GyhC?=\r\n" + ." =?ISO-2022-JP?B?GyRCJE4lXSVzJV0lMyVKITwkTkQ5NVdMPyRORDk9dRsoQg==?= "); $this->assertSame($expected, $result); } diff --git a/lib/Cake/Test/Case/Utility/DebuggerTest.php b/lib/Cake/Test/Case/Utility/DebuggerTest.php index 920e5a6cb..7523cbf77 100644 --- a/lib/Cake/Test/Case/Utility/DebuggerTest.php +++ b/lib/Cake/Test/Case/Utility/DebuggerTest.php @@ -140,8 +140,8 @@ class DebuggerTest extends CakeTestCase { 'a' => array( 'href' => "javascript:void(0);", 'onclick' => "preg:/document\.getElementById\('cakeErr[a-z0-9]+\-trace'\)\.style\.display = " . - "\(document\.getElementById\('cakeErr[a-z0-9]+\-trace'\)\.style\.display == 'none'" . - " \? '' \: 'none'\);/" + "\(document\.getElementById\('cakeErr[a-z0-9]+\-trace'\)\.style\.display == 'none'" . + " \? '' \: 'none'\);/" ), 'b' => array(), 'Notice', '/b', ' (8)', )); @@ -162,14 +162,14 @@ class DebuggerTest extends CakeTestCase { Debugger::output('js', array( 'traceLine' => '{:reference} - {:path}, line {:line}' + '&line={:line}">{:path}, line {:line}' )); $result = Debugger::trace(); $this->assertRegExp('/' . preg_quote('txmt://open?url=file://', '/') . '(\/|[A-Z]:\\\\)' . '/', $result); Debugger::output('xml', array( 'error' => '{:code}{:file}{:line}' . - '{:description}', + '{:description}', 'context' => "{:context}", 'trace' => "{:trace}", )); @@ -221,7 +221,7 @@ class DebuggerTest extends CakeTestCase { Debugger::addFormat('js', array( 'traceLine' => '{:reference} - {:path}, line {:line}' + '&line={:line}">{:path}, line {:line}' )); Debugger::outputAs('js'); @@ -230,7 +230,7 @@ class DebuggerTest extends CakeTestCase { Debugger::addFormat('xml', array( 'error' => '{:code}{:file}{:line}' . - '{:description}', + '{:description}', )); Debugger::outputAs('xml'); diff --git a/lib/Cake/Test/Case/Utility/InflectorTest.php b/lib/Cake/Test/Case/Utility/InflectorTest.php index 758596fa0..32ab735db 100644 --- a/lib/Cake/Test/Case/Utility/InflectorTest.php +++ b/lib/Cake/Test/Case/Utility/InflectorTest.php @@ -230,7 +230,7 @@ class InflectorTest extends CakeTestCase { * @return void */ public function testInflectorSlugWithMap() { - Inflector::rules('transliteration', array('/r/' => '1')); + Inflector::rules('transliteration', array('/r/' => '1')); $result = Inflector::slug('replace every r'); $expected = '1eplace_eve1y_1'; $this->assertEquals($expected, $result); @@ -246,7 +246,7 @@ class InflectorTest extends CakeTestCase { * @return void */ public function testInflectorSlugWithMapOverridingDefault() { - Inflector::rules('transliteration', array('/å/' => 'aa', '/ø/' => 'oe')); + Inflector::rules('transliteration', array('/å/' => 'aa', '/ø/' => 'oe')); $result = Inflector::slug('Testing æ ø å', '-'); $expected = 'Testing-ae-oe-aa'; $this->assertEquals($expected, $result); diff --git a/lib/Cake/Test/Case/Utility/SetTest.php b/lib/Cake/Test/Case/Utility/SetTest.php index 183c7675a..b460da55b 100644 --- a/lib/Cake/Test/Case/Utility/SetTest.php +++ b/lib/Cake/Test/Case/Utility/SetTest.php @@ -2815,26 +2815,26 @@ class SetTest extends CakeTestCase { $string = ' - - Cake PHP Google Group - http://groups.google.com/group/cake-php - Search this group before posting anything. There are over 20,000 posts and it&#39;s very likely your question was answered before. Visit the IRC channel #cakephp at irc.freenode.net for live chat with users and developers of Cake. If you post, tell us the version of Cake, PHP, and database. - en - - constructng result array when using findall - http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f - i'm using cakephp to construct a logical data model array that will be <br> passed to a flex app. I have the following model association: <br> ServiceDay-&gt;(hasMany)ServiceTi me-&gt;(hasMany)ServiceTimePrice. So what <br> the current output from my findall is something like this example: <br> <p>Array( <br> [0] =&gt; Array( - http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f - bmil...@gmail.com(bpscrugs) - Fri, 28 Dec 2007 00:44:14 UT - - - Re: share views between actions? - http://groups.google.com/group/cake-php/msg/8b350d898707dad8 - Then perhaps you might do us all a favour and refrain from replying to <br> things you do not understand. That goes especially for asinine comments. <br> Indeed. <br> To sum up: <br> No comment. <br> In my day, a simple &quot;RTFM&quot; would suffice. I'll keep in mind to ignore any <br> further responses from you. <br> You (and I) were referring to the *online documentation*, not other - http://groups.google.com/group/cake-php/msg/8b350d898707dad8 - subtropolis.z...@gmail.com(subtropolis zijn) - Fri, 28 Dec 2007 00:45:01 UT + + Cake PHP Google Group + http://groups.google.com/group/cake-php + Search this group before posting anything. There are over 20,000 posts and it&#39;s very likely your question was answered before. Visit the IRC channel #cakephp at irc.freenode.net for live chat with users and developers of Cake. If you post, tell us the version of Cake, PHP, and database. + en + + constructng result array when using findall + http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f + i'm using cakephp to construct a logical data model array that will be <br> passed to a flex app. I have the following model association: <br> ServiceDay-&gt;(hasMany)ServiceTi me-&gt;(hasMany)ServiceTimePrice. So what <br> the current output from my findall is something like this example: <br> <p>Array( <br> [0] =&gt; Array( + http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f + bmil...@gmail.com(bpscrugs) + Fri, 28 Dec 2007 00:44:14 UT + + + Re: share views between actions? + http://groups.google.com/group/cake-php/msg/8b350d898707dad8 + Then perhaps you might do us all a favour and refrain from replying to <br> things you do not understand. That goes especially for asinine comments. <br> Indeed. <br> To sum up: <br> No comment. <br> In my day, a simple &quot;RTFM&quot; would suffice. I'll keep in mind to ignore any <br> further responses from you. <br> You (and I) were referring to the *online documentation*, not other + http://groups.google.com/group/cake-php/msg/8b350d898707dad8 + subtropolis.z...@gmail.com(subtropolis zijn) + Fri, 28 Dec 2007 00:45:01 UT '; @@ -2917,32 +2917,32 @@ class SetTest extends CakeTestCase { $string = ' - - Cake PHP Google Group - http://groups.google.com/group/cake-php - Search this group before posting anything. There are over 20,000 posts and it&#39;s very likely your question was answered before. Visit the IRC channel #cakephp at irc.freenode.net for live chat with users and developers of Cake. If you post, tell us the version of Cake, PHP, and database. - en - - constructng result array when using findall - http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f - i'm using cakephp to construct a logical data model array that will be <br> passed to a flex app. I have the following model association: <br> ServiceDay-&gt;(hasMany)ServiceTi me-&gt;(hasMany)ServiceTimePrice. So what <br> the current output from my findall is something like this example: <br> <p>Array( <br> [0] =&gt; Array( - cakephp + + Cake PHP Google Group + http://groups.google.com/group/cake-php + Search this group before posting anything. There are over 20,000 posts and it&#39;s very likely your question was answered before. Visit the IRC channel #cakephp at irc.freenode.net for live chat with users and developers of Cake. If you post, tell us the version of Cake, PHP, and database. + en + + constructng result array when using findall + http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f + i'm using cakephp to construct a logical data model array that will be <br> passed to a flex app. I have the following model association: <br> ServiceDay-&gt;(hasMany)ServiceTi me-&gt;(hasMany)ServiceTimePrice. So what <br> the current output from my findall is something like this example: <br> <p>Array( <br> [0] =&gt; Array( + cakephp - http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f - bmil...@gmail.com(bpscrugs) - Fri, 28 Dec 2007 00:44:14 UT - - - Re: share views between actions? - http://groups.google.com/group/cake-php/msg/8b350d898707dad8 - Then perhaps you might do us all a favour and refrain from replying to <br> things you do not understand. That goes especially for asinine comments. <br> Indeed. <br> To sum up: <br> No comment. <br> In my day, a simple &quot;RTFM&quot; would suffice. I'll keep in mind to ignore any <br> further responses from you. <br> You (and I) were referring to the *online documentation*, not other - cakephp + http://groups.google.com/group/cake-php/msg/49bc00f3bc651b4f + bmil...@gmail.com(bpscrugs) + Fri, 28 Dec 2007 00:44:14 UT + + + Re: share views between actions? + http://groups.google.com/group/cake-php/msg/8b350d898707dad8 + Then perhaps you might do us all a favour and refrain from replying to <br> things you do not understand. That goes especially for asinine comments. <br> Indeed. <br> To sum up: <br> No comment. <br> In my day, a simple &quot;RTFM&quot; would suffice. I'll keep in mind to ignore any <br> further responses from you. <br> You (and I) were referring to the *online documentation*, not other + cakephp - http://groups.google.com/group/cake-php/msg/8b350d898707dad8 - subtropolis.z...@gmail.com(subtropolis zijn) - Fri, 28 Dec 2007 00:45:01 UT + http://groups.google.com/group/cake-php/msg/8b350d898707dad8 + subtropolis.z...@gmail.com(subtropolis zijn) + Fri, 28 Dec 2007 00:45:01 UT '; diff --git a/lib/Cake/Test/Case/View/Helper/JsHelperTest.php b/lib/Cake/Test/Case/View/Helper/JsHelperTest.php index e1c1e5fd2..a8d3f4c78 100644 --- a/lib/Cake/Test/Case/View/Helper/JsHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/JsHelperTest.php @@ -839,10 +839,10 @@ class JsBaseEngineTest extends CakeTestCase { ), '2006' => array( 'Spring' => array( - '1' => array('id' => 1, 'name' => 'Josh'), '2' => array('id' => 2, 'name' => 'Becky') + '1' => array('id' => 1, 'name' => 'Josh'), '2' => array('id' => 2, 'name' => 'Becky') ), 'Fall' => array( - '1' => array('id' => 1, 'name' => 'Josh'), '2' => array('id' => 2, 'name' => 'Becky') + '1' => array('id' => 1, 'name' => 'Josh'), '2' => array('id' => 2, 'name' => 'Becky') ) ) )); diff --git a/lib/Cake/TestSuite/CakeTestSuiteCommand.php b/lib/Cake/TestSuite/CakeTestSuiteCommand.php index 5e7b78ef6..7dd7e351d 100644 --- a/lib/Cake/TestSuite/CakeTestSuiteCommand.php +++ b/lib/Cake/TestSuite/CakeTestSuiteCommand.php @@ -39,9 +39,9 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command { * @param array $params list of options to be used for this run */ public function __construct($loader, $params = array()) { - if ($loader && !class_exists($loader)) { + if ($loader && !class_exists($loader)) { throw new MissingTestLoaderException(array('class' => $loader)); - } + } $this->arguments['loader'] = $loader; $this->arguments['test'] = $params['case']; $this->arguments['testFile'] = $params; diff --git a/lib/Cake/View/Helper/JsBaseEngineHelper.php b/lib/Cake/View/Helper/JsBaseEngineHelper.php index 7cfa6b877..ab0e64698 100644 --- a/lib/Cake/View/Helper/JsBaseEngineHelper.php +++ b/lib/Cake/View/Helper/JsBaseEngineHelper.php @@ -259,9 +259,9 @@ abstract class JsBaseEngineHelper extends AppHelper { break; case (($ord & 0xF8) == 0xF0): if ($i + 3 >= $length) { - $i += 3; - $return .= '?'; - break; + $i += 3; + $return .= '?'; + break; } $charbits = $string{$i} . $string{$i + 1} . $string{$i + 2} . $string{$i + 3}; $char = Multibyte::utf8($charbits); @@ -270,9 +270,9 @@ abstract class JsBaseEngineHelper extends AppHelper { break; case (($ord & 0xFC) == 0xF8): if ($i + 4 >= $length) { - $i += 4; - $return .= '?'; - break; + $i += 4; + $return .= '?'; + break; } $charbits = $string{$i} . $string{$i + 1} . $string{$i + 2} . $string{$i + 3} . $string{$i + 4}; $char = Multibyte::utf8($charbits); @@ -281,9 +281,9 @@ abstract class JsBaseEngineHelper extends AppHelper { break; case (($ord & 0xFE) == 0xFC): if ($i + 5 >= $length) { - $i += 5; - $return .= '?'; - break; + $i += 5; + $return .= '?'; + break; } $charbits = $string{$i} . $string{$i + 1} . $string{$i + 2} . $string{$i + 3} . $string{$i + 4} . $string{$i + 5}; $char = Multibyte::utf8($charbits); From 7339640ef2eab44ad7379876495ecde402940f84 Mon Sep 17 00:00:00 2001 From: ADmad Date: Thu, 22 Dec 2011 02:55:24 +0530 Subject: [PATCH 20/20] Fixed files inside dot folder showing up even when hiding dot files/folder in Folder::tree(). Closes #2395 --- lib/Cake/Test/Case/Utility/FolderTest.php | 1 - lib/Cake/Utility/Folder.php | 28 ++++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/Cake/Test/Case/Utility/FolderTest.php b/lib/Cake/Test/Case/Utility/FolderTest.php index 95b03d68b..5fb73ad41 100644 --- a/lib/Cake/Test/Case/Utility/FolderTest.php +++ b/lib/Cake/Test/Case/Utility/FolderTest.php @@ -431,7 +431,6 @@ class FolderTest extends CakeTestCase { ), array( $Folder->path . DS . 'not_hidden.txt', - $Folder->path . DS . '.svn' . DS . 'InHiddenFolder.php', ), ); diff --git a/lib/Cake/Utility/Folder.php b/lib/Cake/Utility/Folder.php index 509b34e17..2b9ebcbbb 100644 --- a/lib/Cake/Utility/Folder.php +++ b/lib/Cake/Utility/Folder.php @@ -398,7 +398,7 @@ class Folder { * Returns an array of nested directories and files in each directory * * @param string $path the directory path to build the tree from - * @param mixed $exceptions Array of files to exclude, defaults to excluding hidden files. + * @param mixed $exceptions Array of files to exclude, false to exclude dot files. * @param string $type either file or dir. null returns both files and directories * @return mixed array of nested directories and files in each directory * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::tree @@ -416,10 +416,14 @@ class Folder { } if (is_array($exceptions)) { $exceptions = array_flip($exceptions); + if (isset($exceptions['.'])) { + $skipHidden = true; + unset($exceptions['.']); + } } try { - $directory = new RecursiveDirectoryIterator($path); + $directory = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_PATHNAME | RecursiveDirectoryIterator::CURRENT_AS_SELF | RecursiveDirectoryIterator::SKIP_DOTS); $iterator = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST); } catch (UnexpectedValueException $e) { if ($type === null) { @@ -427,15 +431,23 @@ class Folder { } return array(); } - foreach ($iterator as $item) { - $name = $item->getFileName(); - if ($skipHidden && $name[0] === '.' || isset($exceptions[$name])) { + $pathLength = strlen($path); + foreach ($iterator as $itemPath => $fsIterator) { + if ($skipHidden) { + $subPathName = $fsIterator->getSubPathname(); + if ($subPathName{0} == '.' || strpos($subPathName, DS . '.') !== false) { + continue; + } + } + $item = $fsIterator->current(); + if (!empty($exceptions) && isset($exceptions[$item->getFilename()])) { continue; } + if ($item->isFile()) { - $files[] = $item->getPathName(); - } else if ($item->isDir() && !in_array($name, array('.', '..'))) { - $directories[] = $item->getPathName(); + $files[] = $itemPath; + } elseif ($item->isDir()) { + $directories[] = $itemPath; } } if ($type === null) {