From 16be9d499094b1effad9ab61a80c28fa06438587 Mon Sep 17 00:00:00 2001 From: Ceeram Date: Wed, 23 Jan 2013 13:45:50 +0100 Subject: [PATCH] remove unused local vars --- lib/Cake/Console/Command/Task/TestTask.php | 4 ++-- lib/Cake/Model/Datasource/DboSource.php | 2 +- lib/Cake/Model/Model.php | 2 +- lib/Cake/Test/Case/Cache/CacheTest.php | 4 ++-- .../Test/Case/Cache/Engine/FileEngineTest.php | 2 +- .../Case/Console/Command/AclShellTest.php | 1 + .../Case/Console/Command/SchemaShellTest.php | 2 +- .../Console/Command/Task/DbConfigTaskTest.php | 2 +- .../Console/Command/Task/ExtractTaskTest.php | 2 +- .../Console/Command/Task/FixtureTaskTest.php | 2 +- .../Console/Command/Task/ModelTaskTest.php | 2 +- .../Console/Command/Task/TestTaskTest.php | 2 +- .../Case/Console/ConsoleOptionParserTest.php | 4 ++-- lib/Cake/Test/Case/Console/ShellTest.php | 11 ++++----- .../Test/Case/Console/TaskCollectionTest.php | 2 +- .../Controller/Component/Acl/DbAclTest.php | 2 +- .../Controller/Component/Acl/PhpAclTest.php | 1 - .../Controller/Component/AclComponentTest.php | 2 +- .../Component/RequestHandlerComponentTest.php | 2 +- .../Component/SecurityComponentTest.php | 4 ++-- .../Test/Case/Controller/ScaffoldTest.php | 2 +- lib/Cake/Test/Case/Core/ConfigureTest.php | 2 +- lib/Cake/Test/Case/Core/ObjectTest.php | 2 +- .../Test/Case/Error/ExceptionRendererTest.php | 2 +- lib/Cake/Test/Case/Log/CakeLogTest.php | 2 +- .../Behavior/ContainableBehaviorTest.php | 8 +++---- .../Case/Model/BehaviorCollectionTest.php | 23 +++---------------- lib/Cake/Test/Case/Model/CakeSchemaTest.php | 4 +--- .../Test/Case/Model/ConnectionManagerTest.php | 5 ++-- .../Model/Datasource/Database/MysqlTest.php | 6 ++--- .../Datasource/Database/PostgresTest.php | 1 - .../Model/Datasource/Database/SqliteTest.php | 20 ++++++++-------- .../Case/Model/Datasource/DboSourceTest.php | 9 ++++++-- .../Session/DatabaseSessionTest.php | 2 +- .../Test/Case/Model/ModelIntegrationTest.php | 2 -- lib/Cake/Test/Case/Model/ModelReadTest.php | 5 ++-- .../Test/Case/Model/ModelValidationTest.php | 2 +- lib/Cake/Test/Case/Model/ModelWriteTest.php | 10 ++------ .../Model/Validator/CakeValidationSetTest.php | 5 ---- .../Test/Case/Network/Email/CakeEmailTest.php | 7 +++--- .../Case/Network/Http/HttpResponseTest.php | 2 +- .../Test/Case/Network/Http/HttpSocketTest.php | 16 ++++++------- lib/Cake/Test/Case/Routing/DispatcherTest.php | 2 +- lib/Cake/Test/Case/Routing/RouterTest.php | 2 +- .../Case/TestSuite/ControllerTestCaseTest.php | 6 ++--- lib/Cake/Test/Case/Utility/CakeNumberTest.php | 2 +- .../Test/Case/Utility/ClassRegistryTest.php | 2 +- lib/Cake/Test/Case/Utility/DebuggerTest.php | 2 +- lib/Cake/Test/Case/Utility/FileTest.php | 2 -- .../Case/Utility/ObjectCollectionTest.php | 4 ++-- lib/Cake/Test/Case/Utility/SecurityTest.php | 12 +++++----- lib/Cake/Test/Case/Utility/XmlTest.php | 2 +- .../Test/Case/View/Helper/CacheHelperTest.php | 4 ++-- .../Test/Case/View/Helper/FormHelperTest.php | 4 ++-- .../Test/Case/View/Helper/HtmlHelperTest.php | 8 +++---- .../Test/Case/View/Helper/JsHelperTest.php | 4 ++-- .../Case/View/Helper/PaginatorHelperTest.php | 6 ++--- .../Test/Case/View/HelperCollectionTest.php | 4 ++-- lib/Cake/Test/Case/View/ScaffoldViewTest.php | 6 ++--- lib/Cake/Test/Case/View/ThemeViewTest.php | 4 ++-- lib/Cake/Test/Case/View/ViewTest.php | 8 +++---- lib/Cake/TestSuite/CakeTestSuite.php | 2 +- lib/Cake/TestSuite/CakeTestSuiteCommand.php | 1 - .../TestSuite/CakeTestSuiteDispatcher.php | 2 +- .../TestSuite/Fixture/CakeFixtureManager.php | 2 +- .../TestSuite/Fixture/CakeTestFixture.php | 2 +- .../TestSuite/Reporter/CakeHtmlReporter.php | 2 +- .../TestSuite/Reporter/CakeTextReporter.php | 2 +- lib/Cake/Utility/ClassRegistry.php | 2 +- lib/Cake/Utility/String.php | 10 ++++---- 70 files changed, 132 insertions(+), 169 deletions(-) diff --git a/lib/Cake/Console/Command/Task/TestTask.php b/lib/Cake/Console/Command/Task/TestTask.php index e1da43c79b6..ead89df2697 100644 --- a/lib/Cake/Console/Command/Task/TestTask.php +++ b/lib/Cake/Console/Command/Task/TestTask.php @@ -398,7 +398,7 @@ protected function _processModel($subject) { } if ($type == 'hasAndBelongsToMany') { if (!empty($subject->hasAndBelongsToMany[$alias]['with'])) { - list($plugin, $joinModel) = pluginSplit($subject->hasAndBelongsToMany[$alias]['with']); + list(, $joinModel) = pluginSplit($subject->hasAndBelongsToMany[$alias]['with']); } else { $joinModel = Inflector::classify($subject->hasAndBelongsToMany[$alias]['joinTable']); } @@ -423,7 +423,7 @@ protected function _processController($subject) { $models = $subject->uses; } foreach ($models as $model) { - list($plugin, $model) = pluginSplit($model); + list(, $model) = pluginSplit($model); $this->_processModel($subject->{$model}); } } diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 192f2156caa..a80cc2e4c6a 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -2448,7 +2448,7 @@ public function conditionKeysToString($conditions, $quoteValues = true, $model = if (is_numeric($key) && empty($value)) { continue; } elseif (is_numeric($key) && is_string($value)) { - $out[] = $not . $this->_quoteFields($value); + $out[] = $this->_quoteFields($value); } elseif ((is_numeric($key) && is_array($value)) || in_array(strtolower(trim($key)), $bool)) { if (in_array(strtolower(trim($key)), $bool)) { $join = ' ' . strtoupper($key) . ' '; diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 47827af2426..f5d3ea12de5 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -1609,7 +1609,7 @@ public function save($data = null, $validate = true, $fieldList = array()) { $fields = array(); if (!is_array($validate)) { - $options = array_merge($defaults, compact('validate', 'fieldList', 'callbacks')); + $options = array_merge($defaults, compact('validate', 'fieldList')); } else { $options = array_merge($defaults, $validate); } diff --git a/lib/Cake/Test/Case/Cache/CacheTest.php b/lib/Cake/Test/Case/Cache/CacheTest.php index 1c348d7e3ac..c76c98eecd1 100644 --- a/lib/Cake/Test/Case/Cache/CacheTest.php +++ b/lib/Cake/Test/Case/Cache/CacheTest.php @@ -136,7 +136,7 @@ public function testInvalidConfig() { 'serialize' => true, 'random' => 'wii' )); - $read = Cache::read('Test', 'invalid'); + Cache::read('Test', 'invalid'); } /** @@ -402,7 +402,7 @@ public function testSet() { Cache::delete('test_cache'); - $global = Cache::settings(); + Cache::settings(); Cache::set($_cacheSet); } diff --git a/lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php index 01744caf6d9..248175b0baf 100644 --- a/lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php +++ b/lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php @@ -181,7 +181,7 @@ public function testSerialize() { $newread = Cache::read('serialize_test', 'file_test'); - $delete = Cache::delete('serialize_test', 'file_test'); + Cache::delete('serialize_test', 'file_test'); $this->assertSame($read, serialize($data)); diff --git a/lib/Cake/Test/Case/Console/Command/AclShellTest.php b/lib/Cake/Test/Case/Console/Command/AclShellTest.php index cf98cabf5d1..9b56bf5e9bf 100644 --- a/lib/Cake/Test/Case/Console/Command/AclShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/AclShellTest.php @@ -115,6 +115,7 @@ public function testViewWithArgument() { public function testParsingModelAndForeignKey() { $result = $this->Task->parseIdentifier('Model.foreignKey'); $expected = array('model' => 'Model', 'foreign_key' => 'foreignKey'); + $this->assertEquals($expected, $result); $result = $this->Task->parseIdentifier('mySuperUser'); $this->assertEquals('mySuperUser', $result); diff --git a/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php b/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php index 34441aa7ac7..a31a9178891 100644 --- a/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php @@ -294,7 +294,7 @@ public function testGenerateNoOverwrite() { $this->Shell->Schema->path = TMP; $this->Shell->Schema->expects($this->never())->method('read'); - $result = $this->Shell->generate(); + $this->Shell->generate(); unlink(TMP . 'schema.php'); } diff --git a/lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php index b831c95907e..ef0860a914e 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php @@ -128,6 +128,6 @@ public function testExecuteIntoInteractive() { ) )); - $result = $this->Task->execute(); + $this->Task->execute(); } } diff --git a/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php index 02b6b049f6b..74d7bf5357d 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php @@ -49,7 +49,7 @@ public function setUp() { array($out, $out, $in) ); $this->path = TMP . 'tests' . DS . 'extract_task_test'; - $Folder = new Folder($this->path . DS . 'locale', true); + new Folder($this->path . DS . 'locale', true); } /** diff --git a/lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php index 9f2cbd0bd17..73a4a71687f 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php @@ -381,7 +381,7 @@ public function testGeneratePluginFixtureFile() { $this->Task->expects($this->at(0))->method('createFile') ->with($filename, $this->stringContains('class Article')); - $result = $this->Task->generateFixtureFile('Article', array()); + $this->Task->generateFixtureFile('Article', array()); CakePlugin::unload(); } diff --git a/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php index 6f6610b8137..b13efddc8bf 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php @@ -173,7 +173,7 @@ public function testGetNameWithOutOfBoundsOption() { $this->Task->expects($this->any())->method('in')->will($this->onConsecutiveCalls(99, 1)); $this->Task->expects($this->once())->method('err'); - $result = $this->Task->getName('test'); + $this->Task->getName('test'); } /** diff --git a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php index e852fdcaf39..30d31f3d96f 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php @@ -349,7 +349,7 @@ public function testRegistryClearWhenBuildingTestObjects() { )); $keys = ClassRegistry::keys(); $this->assertTrue(in_array('test_task_comment', $keys)); - $object = $this->Task->buildTestSubject('Model', 'TestTaskComment'); + $this->Task->buildTestSubject('Model', 'TestTaskComment'); $keys = ClassRegistry::keys(); $this->assertFalse(in_array('random', $keys)); diff --git a/lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php b/lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php index 7d3a23ec12c..0d14a115d70 100644 --- a/lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php +++ b/lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php @@ -259,7 +259,7 @@ public function testOptionThatDoesNotExist() { $parser = new ConsoleOptionParser('test', false); $parser->addOption('no-commit', array('boolean' => true)); - $result = $parser->parse(array('--fail', 'other')); + $parser->parse(array('--fail', 'other')); } /** @@ -271,7 +271,7 @@ public function testShortOptionThatDoesNotExist() { $parser = new ConsoleOptionParser('test', false); $parser->addOption('no-commit', array('boolean' => true)); - $result = $parser->parse(array('-f')); + $parser->parse(array('-f')); } /** diff --git a/lib/Cake/Test/Case/Console/ShellTest.php b/lib/Cake/Test/Case/Console/ShellTest.php index a33f6fa1056..bbc833c4d2c 100644 --- a/lib/Cake/Test/Case/Console/ShellTest.php +++ b/lib/Cake/Test/Case/Console/ShellTest.php @@ -545,7 +545,7 @@ public function testCreateFileNonInteractive() { $path = TMP . 'shell_test'; $file = $path . DS . 'file1.php'; - $Folder = new Folder($path, true); + new Folder($path, true); $this->Shell->interactive = false; @@ -572,7 +572,7 @@ public function testCreateFileInteractive() { $path = TMP . 'shell_test'; $file = $path . DS . 'file1.php'; - $Folder = new Folder($path, true); + new Folder($path, true); $this->Shell->interactive = true; @@ -663,7 +663,6 @@ public function testHasMethod() { * @return void */ public function testRunCommandMain() { - $methods = get_class_methods('Shell'); $Mock = $this->getMock('Shell', array('main', 'startup'), array(), '', false); $Mock->expects($this->once())->method('main')->will($this->returnValue(true)); @@ -677,7 +676,6 @@ public function testRunCommandMain() { * @return void */ public function testRunCommandWithMethod() { - $methods = get_class_methods('Shell'); $Mock = $this->getMock('Shell', array('hit_me', 'startup'), array(), '', false); $Mock->expects($this->once())->method('hit_me')->will($this->returnValue(true)); @@ -700,7 +698,7 @@ public function testRunCommandBaseclassMethod() { $Mock->expects($this->never())->method('hr'); $Mock->expects($this->once())->method('out'); - $result = $Mock->runCommand('hr', array()); + $Mock->runCommand('hr', array()); } /** @@ -709,7 +707,6 @@ public function testRunCommandBaseclassMethod() { * @return void */ public function testRunCommandMissingMethod() { - $methods = get_class_methods('Shell'); $Mock = $this->getMock('Shell', array('startup', 'getOptionParser', 'out'), array(), '', false); $Parser = $this->getMock('ConsoleOptionParser', array(), array(), '', false); @@ -762,7 +759,7 @@ public function testRunCommandHittingTask() { $Shell->RunCommand = $task; - $result = $Shell->runCommand('run_command', array('run_command', 'one', 'value')); + $Shell->runCommand('run_command', array('run_command', 'one', 'value')); } /** diff --git a/lib/Cake/Test/Case/Console/TaskCollectionTest.php b/lib/Cake/Test/Case/Console/TaskCollectionTest.php index 265fe3f8d86..539d01af037 100644 --- a/lib/Cake/Test/Case/Console/TaskCollectionTest.php +++ b/lib/Cake/Test/Case/Console/TaskCollectionTest.php @@ -78,7 +78,7 @@ public function testLoadWithEnableFalse() { * @return void */ public function testLoadMissingTask() { - $result = $this->Tasks->load('ThisTaskShouldAlwaysBeMissing'); + $this->Tasks->load('ThisTaskShouldAlwaysBeMissing'); } /** diff --git a/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php b/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php index c0964ccb004..57419fdb79a 100644 --- a/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php @@ -521,7 +521,7 @@ protected function _debug($printTreesToo = false) { $values = array_map(array(&$this, '_pad'), $values); $permissions[$key] = implode (' ', $values); } - $permisssions = array_map(array(&$this, '_pad'), $permissions); + $permissions = array_map(array(&$this, '_pad'), $permissions); array_unshift($permissions, 'Current Permissions :'); if ($printTreesToo) { debug(array('aros' => $this->Acl->Aro->generateTreeList(), 'acos' => $this->Acl->Aco->generateTreeList())); diff --git a/lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php b/lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php index 00f74bcf51c..24af044f98c 100644 --- a/lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php @@ -59,7 +59,6 @@ public function testAddRole() { } public function testAroResolve() { - $map = $this->Acl->Aro->map; $this->Acl->Aro->map = array( 'User' => 'FooModel/nickname', 'Role' => 'FooModel/role', diff --git a/lib/Cake/Test/Case/Controller/Component/AclComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AclComponentTest.php index b16d7af7131..b95e5472316 100644 --- a/lib/Cake/Test/Case/Controller/Component/AclComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/AclComponentTest.php @@ -61,7 +61,7 @@ public function tearDown() { public function testConstrutorException() { Configure::write('Acl.classname', 'AclClassNameThatDoesNotExist'); $Collection = new ComponentCollection(); - $acl = new AclComponent($Collection); + new AclComponent($Collection); } /** diff --git a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php index 38b19ccb983..5e57810f7e2 100644 --- a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php @@ -848,7 +848,7 @@ public function testBeforeRedirectCallingHeader() { ob_start(); $RequestHandler->beforeRedirect($controller, 'request_handler_test/param_method/first/second', 403); - $result = ob_get_clean(); + ob_get_clean(); } /** diff --git a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php index 13d684a75ec..55dc911325f 100644 --- a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php @@ -732,7 +732,7 @@ public function testValidatePostCheckbox() { $this->Controller->Security->startup($this->Controller); $key = $this->Controller->request->params['_Token']['key']; - $this->Controller->request->data = $data = array( + $this->Controller->request->data = array( 'Model' => array('username' => '', 'password' => '', 'valid' => '0'), '_Token' => compact('key', 'fields', 'unlocked') ); @@ -1174,7 +1174,7 @@ public function testCsrfSettingMultipleNonces() { $token = $this->Security->Session->read('_Token'); $this->assertEquals(2, count($token['csrfTokens']), 'Missing the csrf token.'); - foreach ($token['csrfTokens'] as $key => $expires) { + foreach ($token['csrfTokens'] as $expires) { $diff = $csrfExpires - $expires; $this->assertTrue($diff === 0 || $diff === 1, 'Token expiry does not match'); } diff --git a/lib/Cake/Test/Case/Controller/ScaffoldTest.php b/lib/Cake/Test/Case/Controller/ScaffoldTest.php index 63bc445c94b..d722389a65e 100644 --- a/lib/Cake/Test/Case/Controller/ScaffoldTest.php +++ b/lib/Cake/Test/Case/Controller/ScaffoldTest.php @@ -230,7 +230,7 @@ public function testScaffoldChangingViewProperty() { $this->Controller->theme = 'TestTheme'; $this->Controller->viewClass = 'Theme'; $this->Controller->constructClasses(); - $Scaffold = new TestScaffoldMock($this->Controller, $this->Controller->request); + new TestScaffoldMock($this->Controller, $this->Controller->request); $this->assertEquals('Scaffold', $this->Controller->viewClass); } diff --git a/lib/Cake/Test/Case/Core/ConfigureTest.php b/lib/Cake/Test/Case/Core/ConfigureTest.php index e1d3c9f0749..ffba30a0858 100644 --- a/lib/Cake/Test/Case/Core/ConfigureTest.php +++ b/lib/Cake/Test/Case/Core/ConfigureTest.php @@ -239,7 +239,7 @@ public function testCheckEmpty() { */ public function testLoadExceptionOnNonExistantFile() { Configure::config('test', new PhpReader()); - $result = Configure::load('non_existing_configuration_file', 'test'); + Configure::load('non_existing_configuration_file', 'test'); } /** diff --git a/lib/Cake/Test/Case/Core/ObjectTest.php b/lib/Cake/Test/Case/Core/ObjectTest.php index 5738e201c11..e81cd80cea0 100644 --- a/lib/Cake/Test/Case/Core/ObjectTest.php +++ b/lib/Cake/Test/Case/Core/ObjectTest.php @@ -105,7 +105,7 @@ public function return_here() { * @return void */ public function paginate_request_action() { - $data = $this->paginate(); + $this->paginate(); return true; } diff --git a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php index 253e7536a5b..91d82b40bda 100644 --- a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php +++ b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php @@ -497,7 +497,7 @@ public function testExceptionResponseHeader() { $ExceptionRenderer->controller->response->expects($this->at(1))->method('_sendHeader')->with('Allow', 'POST, DELETE'); ob_start(); $ExceptionRenderer->render(); - $result = ob_get_clean(); + ob_get_clean(); } /** diff --git a/lib/Cake/Test/Case/Log/CakeLogTest.php b/lib/Cake/Test/Case/Log/CakeLogTest.php index bd402606c5a..292c25dbaad 100644 --- a/lib/Cake/Test/Case/Log/CakeLogTest.php +++ b/lib/Cake/Test/Case/Log/CakeLogTest.php @@ -654,7 +654,7 @@ public function testCustomLevelWrites() { $this->_deleteLogs(); $this->_resetLogConfig(); - $levels = CakeLog::levels(array('spam', 'eggs')); + CakeLog::levels(array('spam', 'eggs')); $testMessage = 'error message'; CakeLog::write('error', $testMessage); diff --git a/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php b/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php index 40d3c37a328..0c6ad4670cf 100644 --- a/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php +++ b/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php @@ -152,7 +152,7 @@ public function testContainments() { * @return void */ public function testInvalidContainments() { - $r = $this->_containments($this->Article, array('Comment', 'InvalidBinding')); + $this->_containments($this->Article, array('Comment', 'InvalidBinding')); } /** @@ -162,7 +162,7 @@ public function testInvalidContainments() { */ public function testInvalidContainmentsNoNotices() { $this->Article->Behaviors->attach('Containable', array('notices' => false)); - $r = $this->_containments($this->Article, array('Comment', 'InvalidBinding')); + $this->_containments($this->Article, array('Comment', 'InvalidBinding')); } /** @@ -243,7 +243,7 @@ public function testBeforeFind() { * @return void */ public function testBeforeFindWithNonExistingBinding() { - $r = $this->Article->find('all', array('contain' => array('Comment' => 'NonExistingBinding'))); + $this->Article->find('all', array('contain' => array('Comment' => 'NonExistingBinding'))); } /** @@ -3252,7 +3252,7 @@ public function testOriginalAssociations() { $firstResult = $this->Article->Comment->find('all', $options); - $dummyResult = $this->Article->Comment->find('all', array( + $this->Article->Comment->find('all', array( 'conditions' => array( 'User.user' => 'mariano' ), diff --git a/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php b/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php index 0fc2c45a18a..9bf796ea973 100644 --- a/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php +++ b/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php @@ -579,7 +579,6 @@ public function testInvalidBehaviorCausingCakeError() { */ public function testBehaviorToggling() { $Apple = new Apple(); - $expected = $Apple->find('all'); $this->assertSame($Apple->Behaviors->enabled(), array()); $Apple->Behaviors->init('Apple', array('Test' => array('key' => 'value'))); @@ -687,22 +686,6 @@ public function testBehaviorHasManyFindCallbacks() { $Apple->Child->Behaviors->attach('Test', array('before' => 'test')); $this->assertSame($expected, $Apple->find('all')); - $expected2 = array( - array( - 'Apple' => array('id' => 1), - 'Child' => array( - array('id' => 2, 'name' => 'Bright Red Apple', 'mytime' => '22:57:17'))), - array( - 'Apple' => array('id' => 2), - 'Child' => array( - array('id' => 1, 'name' => 'Red Apple 1', 'mytime' => '22:57:17'), - array('id' => 3, 'name' => 'green blue', 'mytime' => '22:57:17'), - array('id' => 4, 'name' => 'Test Name', 'mytime' => '22:57:17'))), - array( - 'Apple' => array('id' => 3), - 'Child' => array()) - ); - $Apple->Child->Behaviors->attach('Test', array('before' => 'modify')); $result = $Apple->find('all', array('fields' => array('Apple.id'), 'conditions' => array('Apple.id <' => '4'))); @@ -1118,7 +1101,7 @@ public function testBehaviorAttachAndDetach() { * @return void */ public function testHasMethodBasic() { - $Sample = new Sample(); + new Sample(); $Collection = new BehaviorCollection(); $Collection->init('Sample', array('Test', 'Test2')); @@ -1134,7 +1117,7 @@ public function testHasMethodBasic() { * @return void */ public function testHasMethodMappedMethods() { - $Sample = new Sample(); + new Sample(); $Collection = new BehaviorCollection(); $Collection->init('Sample', array('Test', 'Test2')); @@ -1148,7 +1131,7 @@ public function testHasMethodMappedMethods() { * @return void */ public function testHasMethodAsCallback() { - $Sample = new Sample(); + new Sample(); $Collection = new BehaviorCollection(); $Collection->init('Sample', array('Test', 'Test2')); diff --git a/lib/Cake/Test/Case/Model/CakeSchemaTest.php b/lib/Cake/Test/Case/Model/CakeSchemaTest.php index 7863af19a0b..c49b92c5cfb 100644 --- a/lib/Cake/Test/Case/Model/CakeSchemaTest.php +++ b/lib/Cake/Test/Case/Model/CakeSchemaTest.php @@ -596,7 +596,7 @@ public function testSchemaReadWithAppModel() { ConnectionManager::drop('default'); ConnectionManager::create('default', $connections['test']); try { - $read = $this->Schema->read(array( + $this->Schema->read(array( 'connection' => 'default', 'name' => 'TestApp', 'models' => array('AppModel') @@ -638,8 +638,6 @@ public function testSchemaReadWithTablePrefix() { $config = ConnectionManager::getDataSource('test')->config; $this->skipIf(!empty($config['prefix']), 'This test can not be executed with datasource prefix set.'); - $model = new SchemaPrefixAuthUser(); - $Schema = new CakeSchema(); $read = $Schema->read(array( 'connection' => 'test', diff --git a/lib/Cake/Test/Case/Model/ConnectionManagerTest.php b/lib/Cake/Test/Case/Model/ConnectionManagerTest.php index a35d06b20d8..27fe1bb23db 100644 --- a/lib/Cake/Test/Case/Model/ConnectionManagerTest.php +++ b/lib/Cake/Test/Case/Model/ConnectionManagerTest.php @@ -62,7 +62,7 @@ public function testGetDataSource() { $name = 'test_get_datasource'; $config = array('datasource' => 'Test2Source'); - $connection = ConnectionManager::create($name, $config); + ConnectionManager::create($name, $config); $connections = ConnectionManager::enumConnectionObjects(); $this->assertTrue((bool)(count(array_keys($connections) >= 1))); @@ -190,7 +190,6 @@ public function testSourceList() { * @return void */ public function testGetSourceName() { - $connections = ConnectionManager::enumConnectionObjects(); $source = ConnectionManager::getDataSource('test'); $result = ConnectionManager::getSourceName($source); @@ -228,7 +227,7 @@ public function testLoadDataSource() { */ public function testLoadDataSourceException() { $connection = array('classname' => 'NonExistentDataSource', 'filename' => 'non_existent'); - $loaded = ConnectionManager::loadDataSource($connection); + ConnectionManager::loadDataSource($connection); } /** diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php index 7c4f8dcefbe..9561025aee6 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php @@ -1210,7 +1210,7 @@ public function testGenerateAssociationQuerySelfJoin() { */ protected function _buildRelatedModels(Model $model) { foreach ($model->associations() as $type) { - foreach ($model->{$type} as $assoc => $assocData) { + foreach ($model->{$type} as $assocData) { if (is_string($assocData)) { $className = $assocData; } elseif (isset($assocData['className'])) { @@ -2779,7 +2779,7 @@ public function testSchema() { * @return void */ public function testDropSchemaNoSchema() { - $result = $this->Dbo->dropSchema(null); + $this->Dbo->dropSchema(null); } /** @@ -3674,7 +3674,7 @@ public function testRealQueries() { * @return void */ public function testExceptionOnBrokenConnection() { - $dbo = new Mysql(array( + new Mysql(array( 'driver' => 'mysql', 'host' => 'imaginary_host', 'login' => 'mark', diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php index 7015750d3f2..324b9dcc8dc 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php @@ -540,7 +540,6 @@ public function testCakeSchema() { CONSTRAINT test_data_types_pkey PRIMARY KEY (id) )'); - $model = new Model(array('name' => 'DatatypeTest', 'ds' => 'test')); $schema = new CakeSchema(array('connection' => 'test')); $result = $schema->read(array( 'connection' => 'test', diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php index 007f2a883e7..187b7101c65 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php @@ -164,7 +164,6 @@ public function testCacheKeyName() { $dbName = 'db' . rand() . '$(*%&).db'; $this->assertFalse(file_exists(TMP . $dbName)); - $config = $this->Dbo->config; $db = new Sqlite(array_merge($this->Dbo->config, array('database' => TMP . $dbName))); $this->assertTrue(file_exists(TMP . $dbName)); @@ -341,27 +340,30 @@ public function testDatatypes() { 'id' => array( 'type' => 'integer', 'null' => false, - 'default' => 0, - 'key' => 'primary' + 'default' => '', + 'length' => 11, + 'key' => 'primary', ), 'float_field' => array( 'type' => 'float', - 'length' => '5,2', 'null' => false, - 'default' => null + 'default' => '', + 'length' => '5,2', ), 'huge_int' => array( - 'type' => 'bigint', - 'length' => '20', + 'type' => 'biginteger', 'null' => true, - 'default' => null + 'default' => null, + 'length' => 20, ), 'bool' => array( 'type' => 'boolean', 'null' => false, - 'default' => false + 'default' => '0', + 'length' => null ), ); + $this->assertSame($expected, $result); } /** diff --git a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php index 63df4241727..b297bcad468 100644 --- a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php @@ -525,7 +525,7 @@ public function testMagicMethodQuerying() { * @return void */ public function testDirectCallThrowsException() { - $result = $this->db->query('directCall', array(), $this->Model); + $this->db->query('directCall', array(), $this->Model); } /** @@ -1062,7 +1062,10 @@ protected function _runTransactions($db) { * @return void */ public function testBuildStatementDefaults() { - $conn = $this->getMock('MockPDO'); + $conn = $this->getMock('MockPDO', array('quote')); + $conn->expects($this->at(0)) + ->method('quote') + ->will($this->returnValue('foo bar')); $db = new DboTestSource; $db->setConnection($conn); $subQuery = $db->buildStatement( @@ -1076,6 +1079,8 @@ public function testBuildStatementDefaults() { ), $this->Model ); + $expected = 'SELECT DISTINCT(AssetsTag.asset_id) FROM assets_tags AS AssetsTag WHERE Tag.name = foo bar GROUP BY AssetsTag.asset_id '; + $this->assertEquals($expected, $subQuery); } /** diff --git a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php index 2f6a2ab6758..974ba054e61 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php @@ -96,7 +96,7 @@ public function tearDown() { */ public function testConstructionSettings() { ClassRegistry::flush(); - $storage = new DatabaseSession(); + new DatabaseSession(); $session = ClassRegistry::getObject('session'); $this->assertInstanceOf('SessionTestModel', $session); diff --git a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php index 47336bcc1d2..3984c323468 100644 --- a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php +++ b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php @@ -857,8 +857,6 @@ public function testHABTMKeepExistingWithThreeDbs() { $larrysArmor = Hash::extract($larry, 'Armor.{n}.ArmorsPlayer'); $this->assertEquals(2 , count($larrysArmor)); - $larrysArmorsPlayersIds = Hash::extract($larry, 'Armor.{n}.ArmorsPlayer.id'); - $Player->ArmorsPlayer->id = 3; $Player->ArmorsPlayer->saveField('broken', true); // larry's cloak broke diff --git a/lib/Cake/Test/Case/Model/ModelReadTest.php b/lib/Cake/Test/Case/Model/ModelReadTest.php index a91c93d5222..414b726b7cf 100644 --- a/lib/Cake/Test/Case/Model/ModelReadTest.php +++ b/lib/Cake/Test/Case/Model/ModelReadTest.php @@ -364,7 +364,7 @@ public function testParameterMismatch() { $query .= '.published = ? AND ' . $this->db->fullTableName('articles') . '.user_id = ?'; $params = array('Y'); - $result = $Article->query($query, $params); + $Article->query($query, $params); } /** @@ -384,7 +384,7 @@ public function testVeryStrangeUseCase() { $this->db->fullTableName('articles') . '.published', 'Y' ); - $result = $Article->query($query, $param); + $Article->query($query, $param); } /** @@ -2996,7 +2996,6 @@ public function testSelfAssociationAfterFind() { $duplicateModel = new NodeAfterFind(); $duplicateModel->recursive = 3; - $duplicateModelData = $duplicateModel->find('all'); $noAfterFindModel = new NodeNoAfterFind(); $noAfterFindModel->recursive = 3; diff --git a/lib/Cake/Test/Case/Model/ModelValidationTest.php b/lib/Cake/Test/Case/Model/ModelValidationTest.php index 6bddcb86ee6..bcd2cad2f56 100644 --- a/lib/Cake/Test/Case/Model/ModelValidationTest.php +++ b/lib/Cake/Test/Case/Model/ModelValidationTest.php @@ -2139,7 +2139,7 @@ public function testValidatorOverride() { * @return void */ public function testValidatorTypehintException() { - $Validator = new ModelValidator('asdasds'); + new ModelValidator('asdasds'); } /** diff --git a/lib/Cake/Test/Case/Model/ModelWriteTest.php b/lib/Cake/Test/Case/Model/ModelWriteTest.php index 05d9a1db40e..68baa08d733 100644 --- a/lib/Cake/Test/Case/Model/ModelWriteTest.php +++ b/lib/Cake/Test/Case/Model/ModelWriteTest.php @@ -499,10 +499,6 @@ public function testCounterCacheMultipleCaches() { ), false); // Count Increase - $user = $User->find('first', array( - 'conditions' => array('id' => 66), - 'recursive' => -1 - )); $data = array('Post' => array( 'id' => 22, 'title' => 'New Post', @@ -2219,7 +2215,6 @@ public function testCreationWithMultipleData() { public function testCreationWithMultipleDataSameModel() { $this->loadFixtures('Article'); $Article = new Article(); - $SecondaryArticle = new Article(); $result = $Article->field('title', array('id' => 1)); $this->assertEquals('First Article', $result); @@ -2279,7 +2274,6 @@ public function testCreationWithMultipleDataSameModel() { public function testCreationWithMultipleDataSameModelManualInstances() { $this->loadFixtures('PrimaryModel'); $Primary = new PrimaryModel(); - $Secondary = new PrimaryModel(); $result = $Primary->field('primary_name', array('id' => 1)); $this->assertEquals('Primary Name Existing', $result); @@ -4028,7 +4022,7 @@ public function testSaveAllManyRowsTransactionNoRollback() { public function testSaveAllAssociatedTransactionNoRollback() { $testDb = ConnectionManager::getDataSource('test'); - $mock = $this->getMock( + $this->getMock( 'DboSource', array('connect', 'rollback', 'describe', 'create', 'update', 'begin'), array(), @@ -5455,7 +5449,7 @@ public function testSaveManyTransactionNoRollback() { public function testSaveAssociatedTransactionNoRollback() { $testDb = ConnectionManager::getDataSource('test'); - $mock = $this->getMock( + $this->getMock( 'DboSource', array('connect', 'rollback', 'describe', 'create', 'begin'), array(), diff --git a/lib/Cake/Test/Case/Model/Validator/CakeValidationSetTest.php b/lib/Cake/Test/Case/Model/Validator/CakeValidationSetTest.php index e2aad21a92d..6c995d7a077 100644 --- a/lib/Cake/Test/Case/Model/Validator/CakeValidationSetTest.php +++ b/lib/Cake/Test/Case/Model/Validator/CakeValidationSetTest.php @@ -76,11 +76,6 @@ public function testValidate() { public function testGetRule() { $rules = array('notEmpty' => array('rule' => 'notEmpty', 'message' => 'Can not be empty')); $Field = new CakeValidationSet('title', $rules); - $data = array( - 'title' => '', - 'body' => 'a body' - ); - $result = $Field->getRule('notEmpty'); $this->assertInstanceOf('CakeValidationRule', $result); $this->assertEquals('notEmpty', $result->rule); diff --git a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php index 5924374bfb6..44116c25e2c 100644 --- a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php +++ b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php @@ -699,7 +699,7 @@ public function testTransport() { public function testExtendTransport() { $this->setExpectedException('SocketException'); $this->CakeEmail->transport('Extend'); - $result = $this->CakeEmail->transportClass(); + $this->CakeEmail->transportClass(); } /** @@ -991,7 +991,6 @@ public function testSendWithNoContentDispositionAttachments() { * @return void */ public function testSendWithLog() { - $path = CAKE . 'Test' . DS . 'test_app' . DS . 'tmp' . DS; CakeLog::config('email', array( 'engine' => 'FileLog', 'path' => TMP @@ -1238,7 +1237,7 @@ public function testSendMultipleMIME() { $this->CakeEmail->config(array()); $this->CakeEmail->viewVars(array('value' => 12345)); $this->CakeEmail->emailFormat('both'); - $result = $this->CakeEmail->send(); + $this->CakeEmail->send(); $message = $this->CakeEmail->message(); $boundary = $this->CakeEmail->getBoundary(); @@ -1338,7 +1337,7 @@ public function testMessage() { $this->CakeEmail->config(array('empty')); $this->CakeEmail->template('default', 'default'); $this->CakeEmail->emailFormat('both'); - $result = $this->CakeEmail->send(); + $this->CakeEmail->send(); $expected = '

This email was sent using the CakePHP Framework

'; $this->assertContains($expected, $this->CakeEmail->message(CakeEmail::MESSAGE_HTML)); diff --git a/lib/Cake/Test/Case/Network/Http/HttpResponseTest.php b/lib/Cake/Test/Case/Network/Http/HttpResponseTest.php index 495a70a8b09..f8e1b3e5c22 100644 --- a/lib/Cake/Test/Case/Network/Http/HttpResponseTest.php +++ b/lib/Cake/Test/Case/Network/Http/HttpResponseTest.php @@ -458,7 +458,7 @@ public function testDecodeChunkedBody() { */ public function testDecodeChunkedBodyError() { $encoded = "19\r\nThis is a chunked message\r\nE\r\n\nThat is cool\n\r\n"; - $r = $this->HttpResponse->decodeChunkedBody($encoded); + $this->HttpResponse->decodeChunkedBody($encoded); } /** diff --git a/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php b/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php index d9d6f3ffd1d..ac421cce801 100644 --- a/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php +++ b/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php @@ -561,7 +561,7 @@ public function testRequest() { $expectation['request']['raw'] = $expectation['request']['line'] . $expectation['request']['header'] . "\r\n" . $raw; $r = array('config' => $this->Socket->config, 'request' => $this->Socket->request); - $v = $this->assertEquals($r, $expectation, 'Failed test #' . $i . ' '); + $this->assertEquals($r, $expectation, 'Failed test #' . $i . ' '); $expectation['request']['raw'] = $raw; } @@ -587,7 +587,7 @@ public function testGetWithSchemeAndPort() { ), 'method' => 'GET' ); - $response = $this->Socket->request($request); + $this->Socket->request($request); $this->assertContains('Host: cakephp.org:8080', $this->Socket->request['header']); } @@ -607,7 +607,7 @@ public function testRequestWithStringQuery() { ), 'method' => 'GET' ); - $response = $this->Socket->request($request); + $this->Socket->request($request); $this->assertContains("GET /index.php?somestring HTTP/1.1", $this->Socket->request['line']); } @@ -620,7 +620,7 @@ public function testRequestWithStringQuery() { public function testRequestNotAllowedUri() { $this->Socket->reset(); $request = array('uri' => '*', 'method' => 'GET'); - $response = $this->Socket->request($request); + $this->Socket->request($request); } /** @@ -844,7 +844,7 @@ public function testRequestWithRedirectAsInt() { $this->Socket->expects($this->at(1))->method('read')->will($this->returnValue($serverResponse1)); $this->Socket->expects($this->at(4))->method('read')->will($this->returnValue($serverResponse2)); - $response = $this->Socket->request($request); + $this->Socket->request($request); $this->assertEquals(1, $this->Socket->request['redirect']); } @@ -1216,7 +1216,7 @@ public function testBuildRequestLine() { * @return void */ public function testBadBuildRequestLine() { - $r = $this->Socket->buildRequestLine('Foo'); + $this->Socket->buildRequestLine('Foo'); } /** @@ -1226,7 +1226,7 @@ public function testBadBuildRequestLine() { * @return void */ public function testBadBuildRequestLine2() { - $r = $this->Socket->buildRequestLine("GET * HTTP/1.1\r\n"); + $this->Socket->buildRequestLine("GET * HTTP/1.1\r\n"); } /** @@ -1709,7 +1709,7 @@ public function testVerifyPeer() { $this->skipIf(!extension_loaded('openssl'), 'OpenSSL is not enabled cannot test SSL.'); $socket = new HttpSocket(); try { - $result = $socket->get('https://typography.com'); + $socket->get('https://typography.com'); $this->markTestSkipped('Found valid certificate, was expecting invalid certificate.'); } catch (SocketException $e) { $message = $e->getMessage(); diff --git a/lib/Cake/Test/Case/Routing/DispatcherTest.php b/lib/Cake/Test/Case/Routing/DispatcherTest.php index 7552671d3b9..fcadb2ddd6c 100644 --- a/lib/Cake/Test/Case/Routing/DispatcherTest.php +++ b/lib/Cake/Test/Case/Routing/DispatcherTest.php @@ -617,7 +617,7 @@ public function testParseParamsReturnsPostedData() { $request = new CakeRequest("/"); $event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $request)); $Dispatcher->parseParams($event); - $test = $Dispatcher->parseParams($event); + $Dispatcher->parseParams($event); $this->assertEquals("My Posted Content", $request['data']['testdata']); } diff --git a/lib/Cake/Test/Case/Routing/RouterTest.php b/lib/Cake/Test/Case/Routing/RouterTest.php index a3ebbdd2257..acad11f4a64 100644 --- a/lib/Cake/Test/Case/Routing/RouterTest.php +++ b/lib/Cake/Test/Case/Routing/RouterTest.php @@ -2290,7 +2290,7 @@ public function testConnectDefaultRoutes() { * @return void */ public function testUsingCustomRouteClass() { - $mock = $this->getMock('CakeRoute', array(), array(), 'MockConnectedRoute', false); + $this->getMock('CakeRoute', array(), array(), 'MockConnectedRoute', false); $routes = Router::connect( '/:slug', array('controller' => 'posts', 'action' => 'view'), diff --git a/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php b/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php index cf6bbb85ad9..a9b2542f87d 100644 --- a/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php +++ b/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php @@ -276,7 +276,7 @@ public function testTestAction() { * @return void */ public function testTestActionWithPlugin() { - $Controller = $this->Case->generate('TestPlugin.Tests'); + $this->Case->generate('TestPlugin.Tests'); $this->Case->testAction('/test_plugin/tests/index'); $this->assertEquals('It is a variable', $this->Case->controller->viewVars['test_value']); } @@ -312,7 +312,7 @@ public function testSkipRoutes() { include CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS . 'routes.php'; $this->Case->loadRoutes = false; - $result = $this->Case->testAction('/tests_apps/missing_action.json', array('return' => 'view')); + $this->Case->testAction('/tests_apps/missing_action.json', array('return' => 'view')); } /** @@ -520,7 +520,7 @@ public function testNoControllerReuse() { * @return void */ public function testTestActionWithMultipleRedirect() { - $Controller = $this->Case->generate('TestsApps'); + $this->Case->generate('TestsApps'); $options = array('method' => 'get'); $this->Case->testAction('/tests_apps/redirect_to', $options); diff --git a/lib/Cake/Test/Case/Utility/CakeNumberTest.php b/lib/Cake/Test/Case/Utility/CakeNumberTest.php index 34ebcbf2e23..ce4ddb33931 100644 --- a/lib/Cake/Test/Case/Utility/CakeNumberTest.php +++ b/lib/Cake/Test/Case/Utility/CakeNumberTest.php @@ -636,7 +636,7 @@ public function testFromReadableSize($params, $expected) { * @return void */ public function testFromReadableSizeException() { - $result = $this->Number->fromReadableSize('bogus', false); + $this->Number->fromReadableSize('bogus', false); } /** diff --git a/lib/Cake/Test/Case/Utility/ClassRegistryTest.php b/lib/Cake/Test/Case/Utility/ClassRegistryTest.php index eb20fceade8..dc827bcd563 100644 --- a/lib/Cake/Test/Case/Utility/ClassRegistryTest.php +++ b/lib/Cake/Test/Case/Utility/ClassRegistryTest.php @@ -223,7 +223,7 @@ public function testAddModel() { * @return void */ public function testClassRegistryFlush() { - $Tag = ClassRegistry::init('RegisterArticleTag'); + ClassRegistry::init('RegisterArticleTag'); $ArticleTag = ClassRegistry::getObject('RegisterArticleTag'); $this->assertTrue(is_a($ArticleTag, 'RegisterArticleTag')); diff --git a/lib/Cake/Test/Case/Utility/DebuggerTest.php b/lib/Cake/Test/Case/Utility/DebuggerTest.php index 348459db420..dc4ad819efd 100644 --- a/lib/Cake/Test/Case/Utility/DebuggerTest.php +++ b/lib/Cake/Test/Case/Utility/DebuggerTest.php @@ -65,7 +65,7 @@ public function tearDown() { public function testDocRef() { ini_set('docref_root', ''); $this->assertEquals(ini_get('docref_root'), ''); - $debugger = new Debugger(); + new Debugger(); $this->assertEquals(ini_get('docref_root'), 'http://php.net/'); } diff --git a/lib/Cake/Test/Case/Utility/FileTest.php b/lib/Cake/Test/Case/Utility/FileTest.php index 01799519d90..6a2a3c3cd17 100644 --- a/lib/Cake/Test/Case/Utility/FileTest.php +++ b/lib/Cake/Test/Case/Utility/FileTest.php @@ -130,8 +130,6 @@ public function testPermission() { $this->skipIf(DIRECTORY_SEPARATOR === '\\', 'File permissions tests not supported on Windows.'); $dir = TMP . 'tests' . DS . 'permissions' . DS; - $Folder = new Folder($dir); - $old = umask(); umask(0002); diff --git a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php index ae54c0fe0d5..dc78984b0ef 100644 --- a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php +++ b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php @@ -84,7 +84,7 @@ class GenericObjectCollection extends ObjectCollection { * @return array List of loaded objects */ public function load($object, $settings = array()) { - list($plugin, $name) = pluginSplit($object); + list(, $name) = pluginSplit($object); if (isset($this->_loaded[$name])) { return $this->_loaded[$name]; } @@ -354,7 +354,7 @@ public function testTriggerModParamsInvalidIndex() { $this->Objects->TriggerMockSecond->expects($this->never()) ->method('callback'); - $result = $this->Objects->trigger( + $this->Objects->trigger( 'callback', array(array('value')), array('modParams' => 2) diff --git a/lib/Cake/Test/Case/Utility/SecurityTest.php b/lib/Cake/Test/Case/Utility/SecurityTest.php index 5c349adf542..77ba518086c 100644 --- a/lib/Cake/Test/Case/Utility/SecurityTest.php +++ b/lib/Cake/Test/Case/Utility/SecurityTest.php @@ -69,7 +69,7 @@ public function testValidateAuthKey() { * @return void */ public function testHashInvalidSalt() { - $result = Security::hash('someKey', 'blowfish', true); + Security::hash('someKey', 'blowfish', true); } /** @@ -79,7 +79,7 @@ public function testHashInvalidSalt() { * @return void */ public function testHashAnotherInvalidSalt() { - $result = Security::hash('someKey', 'blowfish', '$1$lksdjoijfaoijs'); + Security::hash('someKey', 'blowfish', '$1$lksdjoijfaoijs'); } /** @@ -89,7 +89,7 @@ public function testHashAnotherInvalidSalt() { * @return void */ public function testHashYetAnotherInvalidSalt() { - $result = Security::hash('someKey', 'blowfish', '$2a$10$123'); + Security::hash('someKey', 'blowfish', '$2a$10$123'); } /** @@ -233,7 +233,7 @@ public function testCipher() { public function testCipherEmptyKey() { $txt = 'some_text'; $key = ''; - $result = Security::cipher($txt, $key); + Security::cipher($txt, $key); } /** @@ -268,7 +268,7 @@ public function testRijndael() { public function testRijndaelInvalidOperation() { $txt = 'The quick brown fox jumped over the lazy dog.'; $key = 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi'; - $result = Security::rijndael($txt, $key, 'foo'); + Security::rijndael($txt, $key, 'foo'); } /** @@ -280,7 +280,7 @@ public function testRijndaelInvalidOperation() { public function testRijndaelInvalidKey() { $txt = 'The quick brown fox jumped over the lazy dog.'; $key = 'too small'; - $result = Security::rijndael($txt, $key, 'encrypt'); + Security::rijndael($txt, $key, 'encrypt'); } } diff --git a/lib/Cake/Test/Case/Utility/XmlTest.php b/lib/Cake/Test/Case/Utility/XmlTest.php index e90217d9330..3748f5e9b17 100644 --- a/lib/Cake/Test/Case/Utility/XmlTest.php +++ b/lib/Cake/Test/Case/Utility/XmlTest.php @@ -1020,7 +1020,7 @@ public function testWithModel() { XML; - $result = $obj->asXML(); + $obj->asXML(); $this->assertXmlStringEqualsXmlString($expected, $obj->asXML()); } diff --git a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php index 8a4bd5567f5..ad9a4a6f348 100644 --- a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php @@ -151,7 +151,7 @@ public function testCacheNonLatinCharactersInRoute() { $this->Controller->action = 'view'; $View = new View($this->Controller); - $result = $View->render('index'); + $View->render('index'); $filename = CACHE . 'views' . DS . 'posts_view_風街ろまん.php'; $this->assertTrue(file_exists($filename)); @@ -338,7 +338,7 @@ public function testCacheCallbacks() { $this->Controller->cache_parsing(); $View = new View($this->Controller); - $result = $View->render('index'); + $View->render('index'); $filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php'; $this->assertTrue(file_exists($filename)); diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index b090adcd3de..8febebf10bf 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -1364,7 +1364,7 @@ public function testFormSecuredFileInput() { $this->Form->request['_Token'] = array('key' => 'testKey'); $this->assertEquals(array(), $this->Form->fields); - $result = $this->Form->file('Attachment.file'); + $this->Form->file('Attachment.file'); $expected = array( 'Attachment.file.name', 'Attachment.file.type', 'Attachment.file.tmp_name', 'Attachment.file.error', 'Attachment.file.size' @@ -4477,7 +4477,7 @@ public function testSelectMultipleSecureWithNoOptions() { $this->Form->request['_Token'] = array('key' => 'testkey'); $this->assertEquals(array(), $this->Form->fields); - $result = $this->Form->select( + $this->Form->select( 'Model.select', array(), array('multiple' => true) diff --git a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php index 5a94ab63663..d28e074502e 100644 --- a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php @@ -449,7 +449,7 @@ public function testImageTagWithTheme() { App::uses('File', 'Utility'); $testfile = WWW_ROOT . 'theme' . DS . 'test_theme' . DS . 'img' . DS . '__cake_test_image.gif'; - $File = new File($testfile, true); + new File($testfile, true); App::build(array( 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) @@ -987,7 +987,7 @@ public function testScriptInTheme() { App::uses('File', 'Utility'); $testfile = WWW_ROOT . 'theme' . DS . 'test_theme' . DS . 'js' . DS . '__test_js.js'; - $File = new File($testfile, true); + new File($testfile, true); App::build(array( 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) @@ -1955,7 +1955,7 @@ public function testLoadConfig() { * @expectedException ConfigureException */ public function testLoadConfigWrongFile() { - $result = $this->Html->loadConfig('wrong_file'); + $this->Html->loadConfig('wrong_file'); } /** @@ -1966,7 +1966,7 @@ public function testLoadConfigWrongFile() { */ public function testLoadConfigWrongReader() { $path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS; - $result = $this->Html->loadConfig(array('htmlhelper_tags', 'wrong_reader'), $path); + $this->Html->loadConfig(array('htmlhelper_tags', 'wrong_reader'), $path); } /** diff --git a/lib/Cake/Test/Case/View/Helper/JsHelperTest.php b/lib/Cake/Test/Case/View/Helper/JsHelperTest.php index 53b8cce9708..9b5b93ad38d 100644 --- a/lib/Cake/Test/Case/View/Helper/JsHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/JsHelperTest.php @@ -319,7 +319,7 @@ public function testWriteBufferNotInline() { ->method('append') ->with('script', $this->matchesRegularExpression('#