Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1083 from ceeram/2.3-pmdvars

Remove unused local vars.
  • Loading branch information...
commit 6ade91e83b6c63e6cafb42dc71fca3a4a883a1bf 2 parents a03cbdd + 16be9d4
Mark Story markstory authored
Showing with 132 additions and 169 deletions.
  1. +2 −2 lib/Cake/Console/Command/Task/TestTask.php
  2. +1 −1  lib/Cake/Model/Datasource/DboSource.php
  3. +1 −1  lib/Cake/Model/Model.php
  4. +2 −2 lib/Cake/Test/Case/Cache/CacheTest.php
  5. +1 −1  lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
  6. +1 −0  lib/Cake/Test/Case/Console/Command/AclShellTest.php
  7. +1 −1  lib/Cake/Test/Case/Console/Command/SchemaShellTest.php
  8. +1 −1  lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php
  9. +1 −1  lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php
  10. +1 −1  lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php
  11. +1 −1  lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php
  12. +1 −1  lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
  13. +2 −2 lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php
  14. +4 −7 lib/Cake/Test/Case/Console/ShellTest.php
  15. +1 −1  lib/Cake/Test/Case/Console/TaskCollectionTest.php
  16. +1 −1  lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
  17. +0 −1  lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php
  18. +1 −1  lib/Cake/Test/Case/Controller/Component/AclComponentTest.php
  19. +1 −1  lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php
  20. +2 −2 lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php
  21. +1 −1  lib/Cake/Test/Case/Controller/ScaffoldTest.php
  22. +1 −1  lib/Cake/Test/Case/Core/ConfigureTest.php
  23. +1 −1  lib/Cake/Test/Case/Core/ObjectTest.php
  24. +1 −1  lib/Cake/Test/Case/Error/ExceptionRendererTest.php
  25. +1 −1  lib/Cake/Test/Case/Log/CakeLogTest.php
  26. +4 −4 lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
  27. +3 −20 lib/Cake/Test/Case/Model/BehaviorCollectionTest.php
  28. +1 −3 lib/Cake/Test/Case/Model/CakeSchemaTest.php
  29. +2 −3 lib/Cake/Test/Case/Model/ConnectionManagerTest.php
  30. +3 −3 lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
  31. +0 −1  lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
  32. +11 −9 lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php
  33. +7 −2 lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
  34. +1 −1  lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php
  35. +0 −2  lib/Cake/Test/Case/Model/ModelIntegrationTest.php
  36. +2 −3 lib/Cake/Test/Case/Model/ModelReadTest.php
  37. +1 −1  lib/Cake/Test/Case/Model/ModelValidationTest.php
  38. +2 −8 lib/Cake/Test/Case/Model/ModelWriteTest.php
  39. +0 −5 lib/Cake/Test/Case/Model/Validator/CakeValidationSetTest.php
  40. +3 −4 lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
  41. +1 −1  lib/Cake/Test/Case/Network/Http/HttpResponseTest.php
  42. +8 −8 lib/Cake/Test/Case/Network/Http/HttpSocketTest.php
  43. +1 −1  lib/Cake/Test/Case/Routing/DispatcherTest.php
  44. +1 −1  lib/Cake/Test/Case/Routing/RouterTest.php
  45. +3 −3 lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
  46. +1 −1  lib/Cake/Test/Case/Utility/CakeNumberTest.php
  47. +1 −1  lib/Cake/Test/Case/Utility/ClassRegistryTest.php
  48. +1 −1  lib/Cake/Test/Case/Utility/DebuggerTest.php
  49. +0 −2  lib/Cake/Test/Case/Utility/FileTest.php
  50. +2 −2 lib/Cake/Test/Case/Utility/ObjectCollectionTest.php
  51. +6 −6 lib/Cake/Test/Case/Utility/SecurityTest.php
  52. +1 −1  lib/Cake/Test/Case/Utility/XmlTest.php
  53. +2 −2 lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
  54. +2 −2 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
  55. +4 −4 lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
  56. +2 −2 lib/Cake/Test/Case/View/Helper/JsHelperTest.php
  57. +3 −3 lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php
  58. +2 −2 lib/Cake/Test/Case/View/HelperCollectionTest.php
  59. +3 −3 lib/Cake/Test/Case/View/ScaffoldViewTest.php
  60. +2 −2 lib/Cake/Test/Case/View/ThemeViewTest.php
  61. +4 −4 lib/Cake/Test/Case/View/ViewTest.php
  62. +1 −1  lib/Cake/TestSuite/CakeTestSuite.php
  63. +0 −1  lib/Cake/TestSuite/CakeTestSuiteCommand.php
  64. +1 −1  lib/Cake/TestSuite/CakeTestSuiteDispatcher.php
  65. +1 −1  lib/Cake/TestSuite/Fixture/CakeFixtureManager.php
  66. +1 −1  lib/Cake/TestSuite/Fixture/CakeTestFixture.php
  67. +1 −1  lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php
  68. +1 −1  lib/Cake/TestSuite/Reporter/CakeTextReporter.php
  69. +1 −1  lib/Cake/Utility/ClassRegistry.php
  70. +4 −6 lib/Cake/Utility/String.php
4 lib/Cake/Console/Command/Task/TestTask.php
View
@@ -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});
}
}
2  lib/Cake/Model/Datasource/DboSource.php
View
@@ -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) . ' ';
2  lib/Cake/Model/Model.php
View
@@ -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);
}
4 lib/Cake/Test/Case/Cache/CacheTest.php
View
@@ -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);
}
2  lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
View
@@ -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));
1  lib/Cake/Test/Case/Console/Command/AclShellTest.php
View
@@ -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);
2  lib/Cake/Test/Case/Console/Command/SchemaShellTest.php
View
@@ -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');
}
2  lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php
View
@@ -128,6 +128,6 @@ public function testExecuteIntoInteractive() {
)
));
- $result = $this->Task->execute();
+ $this->Task->execute();
}
}
2  lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php
View
@@ -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);
}
/**
2  lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php
View
@@ -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();
}
2  lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php
View
@@ -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');
}
/**
2  lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
View
@@ -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));
4 lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php
View
@@ -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'));
}
/**
11 lib/Cake/Test/Case/Console/ShellTest.php
View
@@ -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'));
}
/**
2  lib/Cake/Test/Case/Console/TaskCollectionTest.php
View
@@ -78,7 +78,7 @@ public function testLoadWithEnableFalse() {
* @return void
*/
public function testLoadMissingTask() {
- $result = $this->Tasks->load('ThisTaskShouldAlwaysBeMissing');
+ $this->Tasks->load('ThisTaskShouldAlwaysBeMissing');
}
/**
2  lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
View
@@ -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()));
1  lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php
View
@@ -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',
2  lib/Cake/Test/Case/Controller/Component/AclComponentTest.php
View
@@ -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);
}
/**
2  lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php
View
@@ -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();
}
/**
4 lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php
View
@@ -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');
}
2  lib/Cake/Test/Case/Controller/ScaffoldTest.php
View
@@ -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);
}
2  lib/Cake/Test/Case/Core/ConfigureTest.php
View
@@ -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');
}
/**
2  lib/Cake/Test/Case/Core/ObjectTest.php
View
@@ -105,7 +105,7 @@ public function return_here() {
* @return void
*/
public function paginate_request_action() {
- $data = $this->paginate();
+ $this->paginate();
return true;
}
2  lib/Cake/Test/Case/Error/ExceptionRendererTest.php
View
@@ -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();
}
/**
2  lib/Cake/Test/Case/Log/CakeLogTest.php
View
@@ -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);
8 lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
View
@@ -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'
),
23 lib/Cake/Test/Case/Model/BehaviorCollectionTest.php
View
@@ -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'));
4 lib/Cake/Test/Case/Model/CakeSchemaTest.php
View
@@ -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',
5 lib/Cake/Test/Case/Model/ConnectionManagerTest.php
View
@@ -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);
}
/**
6 lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
View
@@ -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',
1  lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
View
@@ -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',
20 lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php
View
@@ -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);
}
/**
9 lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
View
@@ -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);
}
/**
2  lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php
View
@@ -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);
2  lib/Cake/Test/Case/Model/ModelIntegrationTest.php
View
@@ -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
5 lib/Cake/Test/Case/Model/ModelReadTest.php
View
@@ -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;
2  lib/Cake/Test/Case/Model/ModelValidationTest.php
View
@@ -2139,7 +2139,7 @@ public function testValidatorOverride() {
* @return void
*/
public function testValidatorTypehintException() {
- $Validator = new ModelValidator('asdasds');
+ new ModelValidator('asdasds');
}
/**
10 lib/Cake/Test/Case/Model/ModelWriteTest.php
View
@@ -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(),
5 lib/Cake/Test/Case/Model/Validator/CakeValidationSetTest.php
View
@@ -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);
7 lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
View
@@ -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 = '<p>This email was sent using the <a href="http://cakephp.org">CakePHP Framework</a></p>';
$this->assertContains($expected, $this->CakeEmail->message(CakeEmail::MESSAGE_HTML));
2  lib/Cake/Test/Case/Network/Http/HttpResponseTest.php
View
@@ -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);
}
/**
16 lib/Cake/Test/Case/Network/Http/HttpSocketTest.php
View
@@ -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();
2  lib/Cake/Test/Case/Routing/DispatcherTest.php
View
@@ -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']);
}
2  lib/Cake/Test/Case/Routing/RouterTest.php
View
@@ -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'),
6 lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
View
@@ -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);
2  lib/Cake/Test/Case/Utility/CakeNumberTest.php
View
@@ -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);
}
/**
2  lib/Cake/Test/Case/Utility/ClassRegistryTest.php
View
@@ -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'));
2  lib/Cake/Test/Case/Utility/DebuggerTest.php
View
@@ -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/');
}
2  lib/Cake/Test/Case/Utility/FileTest.php
View
@@ -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);
4 lib/Cake/Test/Case/Utility/ObjectCollectionTest.php
View
@@ -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)
12 lib/Cake/Test/Case/Utility/SecurityTest.php
View
@@ -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');
}
}
2  lib/Cake/Test/Case/Utility/XmlTest.php
View
@@ -1020,7 +1020,7 @@ public function testWithModel() {
</records>
</data>
XML;
- $result = $obj->asXML();
+ $obj->asXML();
$this->assertXmlStringEqualsXmlString($expected, $obj->asXML());
}
4 lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
View
@@ -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));
4 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
View
@@ -1365,7 +1365,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'
@@ -4478,7 +4478,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)
8 lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
View
@@ -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);
}
/**
4 lib/Cake/Test/Case/View/Helper/JsHelperTest.php
View
@@ -319,7 +319,7 @@ public function testWriteBufferNotInline() {
->method('append')
->with('script', $this->matchesRegularExpression('#<script type="text\/javascript">window.app \= \{"foo"\:1\}\;<\/script>#'));
- $result = $this->Js->writeBuffer(array('onDomReady' => false, 'inline' => false, 'safe' => false));
+ $this->Js->writeBuffer(array('onDomReady' => false, 'inline' => false, 'safe' => false));
}
/**
@@ -338,7 +338,7 @@ public function testWriteBufferAndXhr() {
$this->Js->buffer('alert("test");');
$this->Js->TestJsEngine->expects($this->never())->method('domReady');
- $result = $this->Js->writeBuffer();
+ $this->Js->writeBuffer();
unset($_SERVER['HTTP_X_REQUESTED_WITH']);
if ($requestWith !== null) {
6 lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php
View
@@ -2426,7 +2426,7 @@ public function testNextLinkUsingDotNotation() {
*/
public function testAjaxLinkGenerationNumbers() {
$this->Paginator->Js->expectCallCount('link', 2);
- $result = $this->Paginator->numbers(array(
+ $this->Paginator->numbers(array(
'modulus' => '2',
'url' => array('controller' => 'projects', 'action' => 'sort'),
'update' => 'list'
@@ -2470,9 +2470,9 @@ public function testMockAjaxProviderClassInjection() {
);
$Paginator->PaginatorMockJs = $mock;
$Paginator->PaginatorMockJs->expects($this->once())->method('link');
- $result = $Paginator->link('Page 2', array('page' => 2), array('update' => '#content'));
+ $Paginator->link('Page 2', array('page' => 2), array('update' => '#content'));
- $Paginator = new PaginatorHelper($this->View, array('ajax' => 'Form'));
+ new PaginatorHelper($this->View, array('ajax' => 'Form'));
}
/**
4 lib/Cake/Test/Case/View/HelperCollectionTest.php
View
@@ -93,7 +93,7 @@ public function testLazyLoad() {
* @return void
*/
public function testLazyLoadException() {
- $result = $this->Helpers->NotAHelper;
+ $this->Helpers->NotAHelper;
}
/**
@@ -145,7 +145,7 @@ public function testLoadWithEnabledFalse() {
* @return void
*/
public function testLoadMissingHelper() {
- $result = $this->Helpers->load('ThisHelperShouldAlwaysBeMissing');
+ $this->Helpers->load('ThisHelperShouldAlwaysBeMissing');
}
/**
6 lib/Cake/Test/Case/View/ScaffoldViewTest.php
View
@@ -364,7 +364,7 @@ public function testAdminIndexScaffold() {
$this->Controller->constructClasses();
ob_start();
- $Scaffold = new Scaffold($this->Controller, $this->Controller->request);
+ new Scaffold($this->Controller, $this->Controller->request);
$this->Controller->response->send();
$result = ob_get_clean();
@@ -407,7 +407,7 @@ public function testAdminEditScaffold() {
$this->Controller->constructClasses();
ob_start();
- $Scaffold = new Scaffold($this->Controller, $this->Controller->request);
+ new Scaffold($this->Controller, $this->Controller->request);
$this->Controller->response->send();
$result = ob_get_clean();
@@ -448,7 +448,7 @@ public function testMultiplePrefixScaffold() {
$this->Controller->constructClasses();
ob_start();
- $Scaffold = new Scaffold($this->Controller, $this->Controller->request);
+ new Scaffold($this->Controller, $this->Controller->request);
$this->Controller->response->send();
$result = ob_get_clean();
4 lib/Cake/Test/Case/View/ThemeViewTest.php
View
@@ -213,7 +213,7 @@ public function testMissingView() {
$View = new TestTheme2View($this->Controller);
ob_start();
- $result = $View->getViewFileName('does_not_exist');
+ $View->getViewFileName('does_not_exist');
$expected = ob_get_clean();
$this->assertRegExp("/PagesController::/", $expected);
$this->assertRegExp("/views(\/|\\\)themed(\/|\\\)my_theme(\/|\\\)pages(\/|\\\)does_not_exist.ctp/", $expected);
@@ -234,7 +234,7 @@ public function testMissingLayout() {
$View = new TestTheme2View($this->Controller);
ob_start();
- $result = $View->getLayoutFileName();
+ $View->getLayoutFileName();
$expected = ob_get_clean();
$this->assertRegExp("/Missing Layout/", $expected);
$this->assertRegExp("/views(\/|\\\)themed(\/|\\\)my_theme(\/|\\\)layouts(\/|\\\)whatever.ctp/", $expected);
8 lib/Cake/Test/Case/View/ViewTest.php
View
@@ -668,7 +668,7 @@ public function testElement() {
* @return void
*/
public function testElementInexistent() {
- $result = $this->View->element('non_existent_element');
+ $this->View->element('non_existent_element');
}
/**
@@ -678,7 +678,7 @@ public function testElementInexistent() {
* @return void
*/
public function testElementInexistent2() {
- $result = $this->View->element('TestPlugin.plugin_element', array(), array('plugin' => 'test_plugin'));
+ $this->View->element('TestPlugin.plugin_element', array(), array('plugin' => 'test_plugin'));
}
/**
@@ -688,7 +688,7 @@ public function testElementInexistent2() {
* @return void
*/
public function testElementInexistent3() {
- $result = $this->View->element('test_plugin.plugin_element');
+ $this->View->element('test_plugin.plugin_element');
}
/**
@@ -733,7 +733,7 @@ public function testElementParamsDontOverwriteHelpers() {
public function testElementCacheHelperNoCache() {
$Controller = new ViewPostsController();
$View = new TestView($Controller);
- $helpers = $View->loadHelpers();
+ $View->loadHelpers();
$result = $View->element('test_element', array('ram' => 'val', 'test' => array('foo', 'bar')));
$this->assertEquals('this is the test element', $result);
}
2  lib/Cake/TestSuite/CakeTestSuite.php
View
@@ -34,7 +34,7 @@ class CakeTestSuite extends PHPUnit_Framework_TestSuite {
*/
public function addTestDirectory($directory = '.') {
$Folder = new Folder($directory);
- list($dirs, $files) = $Folder->read(true, true, true);
+ list(, $files) = $Folder->read(true, true, true);
foreach ($files as $file) {
if (substr($file, -4) === '.php') {
1  lib/Cake/TestSuite/CakeTestSuiteCommand.php
View
@@ -156,7 +156,6 @@ public function handleFixture($class) {
public function handleReporter($reporter) {
$object = null;
- $type = strtolower($reporter);
$reporter = ucwords($reporter);
$coreClass = 'Cake' . $reporter . 'Reporter';
App::uses($coreClass, 'TestSuite/Reporter');
2  lib/Cake/TestSuite/CakeTestSuiteDispatcher.php
View
@@ -239,7 +239,7 @@ protected function _runTestCase() {
try {
self::time();
$command = new CakeTestSuiteCommand('CakeTestLoader', $commandArgs);
- $result = $command->run($options);
+ $command->run($options);
} catch (MissingConnectionException $exception) {
ob_end_clean();
$baseDir = $this->_baseDir;
2  lib/Cake/TestSuite/Fixture/CakeFixtureManager.php
View
@@ -104,7 +104,7 @@ protected function _initDb() {
* @throws UnexpectedValueException when a referenced fixture does not exist.
*/
protected function _loadFixtures($fixtures) {
- foreach ($fixtures as $index => $fixture) {
+ foreach ($fixtures as $fixture) {
$fixtureFile = null;
$fixtureIndex = $fixture;
if (isset($this->_loaded[$fixture])) {
2  lib/Cake/TestSuite/Fixture/CakeTestFixture.php
View
@@ -199,7 +199,7 @@ public function create($db) {
if (empty($this->fields['tableParameters']['engine'])) {
$canUseMemory = true;
- foreach ($this->fields as $field => $args) {
+ foreach ($this->fields as $args) {
if (is_string($args)) {
$type = $args;
2  lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php
View
@@ -99,7 +99,7 @@ public function testCaseList() {
$buffer .= "<strong>EMPTY</strong>";
}
- foreach ($testCases as $testCaseFile => $testCase) {
+ foreach ($testCases as $testCase) {
$title = explode(DS, str_replace('.test.php', '', $testCase));
$title[count($title) - 1] = Inflector::camelize($title[count($title) - 1]);
$title = implode(' / ', $title);
2  lib/Cake/TestSuite/Reporter/CakeTextReporter.php
View
@@ -164,7 +164,7 @@ public function testCaseList() {
echo $buffer;
}
- foreach ($testCases as $testCaseFile => $testCase) {
+ foreach ($testCases as $testCase) {
$buffer .= $_SERVER['SERVER_NAME'] . $this->baseUrl() . "?case=" . $testCase . "&output=text\n";
}
2  lib/Cake/Utility/ClassRegistry.php
View
@@ -182,7 +182,7 @@ public static function init($class, $strict = false) {
}
if (!isset($instance)) {
- trigger_error(__d('cake_dev', '(ClassRegistry::init() could not create instance of %1$s class %2$s ', $class, $type), E_USER_WARNING);
+ trigger_error(__d('cake_dev', '(ClassRegistry::init() could not create instance of %s', $class), E_USER_WARNING);
return false;
}
}
10 lib/Cake/Utility/String.php
View
@@ -227,13 +227,11 @@ public static function insert($str, $data, $options = array()) {
asort($data);
- $hashKeys = array();
- foreach ($data as $key => $value) {
- $hashKeys[] = crc32($key);
- }
-
- $tempData = array_combine(array_keys($data), array_values($hashKeys));
+ $dataKeys = array_keys($data);
+ $hashKeys = array_map('crc32', $dataKeys);
+ $tempData = array_combine($dataKeys, $hashKeys);
krsort($tempData);
+
foreach ($tempData as $key => $hashVal) {
$key = sprintf($format, preg_quote($key, '/'));
$str = preg_replace($key, $hashVal, $str);
Please sign in to comment.
Something went wrong with that request. Please try again.