Skip to content

Commit

Permalink
Correct parameter order of assertEquals and assertNotEquals
Browse files Browse the repository at this point in the history
  • Loading branch information
shama committed Mar 23, 2012
1 parent 3851ad0 commit 90e7afb
Show file tree
Hide file tree
Showing 97 changed files with 1,815 additions and 1,815 deletions.
22 changes: 11 additions & 11 deletions lib/Cake/Test/Case/BasicsTest.php
Expand Up @@ -77,7 +77,7 @@ public function testArrayDiffKey() {
$one = array('minYear' => null, 'maxYear' => null, 'separator' => '-', 'interval' => 1, 'monthNames' => true);
$two = array('minYear' => null, 'maxYear' => null, 'separator' => '-', 'interval' => 1, 'monthNames' => true);
$result = array_diff_key($one, $two);
$this->assertEquals($result, array());
$this->assertEquals(array(), $result);
}

/**
Expand Down Expand Up @@ -282,7 +282,7 @@ public function testCache() {
$this->assertTrue(file_exists(CACHE . 'basics_test'));

$result = cache('basics_test');
$this->assertEquals($result, 'simple cache write');
$this->assertEquals('simple cache write', $result);
@unlink(CACHE . 'basics_test');

cache('basics_test', 'expired', '+1 second');
Expand Down Expand Up @@ -874,7 +874,7 @@ public function testStripslashesDeep() {
),
'g' => 'test'
);
$this->assertEquals(stripslashes_deep($nested), $expected);
$this->assertEquals($expected, stripslashes_deep($nested));
}

/**
Expand Down Expand Up @@ -909,7 +909,7 @@ public function testStripslashesDeepSybase() {
),
'g' => "te'''st"
);
$this->assertEquals(stripslashes_deep($nested), $expected);
$this->assertEquals($expected, stripslashes_deep($nested));
}

/**
Expand All @@ -919,24 +919,24 @@ public function testStripslashesDeepSybase() {
*/
public function testPluginSplit() {
$result = pluginSplit('Something.else');
$this->assertEquals($result, array('Something', 'else'));
$this->assertEquals(array('Something', 'else'), $result);

$result = pluginSplit('Something.else.more.dots');
$this->assertEquals($result, array('Something', 'else.more.dots'));
$this->assertEquals(array('Something', 'else.more.dots'), $result);

$result = pluginSplit('Somethingelse');
$this->assertEquals($result, array(null, 'Somethingelse'));
$this->assertEquals(array(null, 'Somethingelse'), $result);

$result = pluginSplit('Something.else', true);
$this->assertEquals($result, array('Something.', 'else'));
$this->assertEquals(array('Something.', 'else'), $result);

$result = pluginSplit('Something.else.more.dots', true);
$this->assertEquals($result, array('Something.', 'else.more.dots'));
$this->assertEquals(array('Something.', 'else.more.dots'), $result);

$result = pluginSplit('Post', false, 'Blog');
$this->assertEquals($result, array('Blog', 'Post'));
$this->assertEquals(array('Blog', 'Post'), $result);

$result = pluginSplit('Blog.Post', false, 'Ultimate');
$this->assertEquals($result, array('Blog', 'Post'));
$this->assertEquals(array('Blog', 'Post'), $result);
}
}
20 changes: 10 additions & 10 deletions lib/Cake/Test/Case/Cache/CacheTest.php
Expand Up @@ -57,7 +57,7 @@ public function tearDown() {
public function testConfig() {
$settings = array('engine' => 'File', 'path' => TMP . 'tests', 'prefix' => 'cake_test_');
$results = Cache::config('new', $settings);
$this->assertEquals($results, Cache::config('new'));
$this->assertEquals(Cache::config('new'), $results);
$this->assertTrue(isset($results['engine']));
$this->assertTrue(isset($results['settings']));
}
Expand Down Expand Up @@ -93,11 +93,11 @@ public function testConfigWithLibAndPluginEngines() {

$settings = array('engine' => 'TestAppCache', 'path' => TMP, 'prefix' => 'cake_test_');
$result = Cache::config('libEngine', $settings);
$this->assertEquals($result, Cache::config('libEngine'));
$this->assertEquals(Cache::config('libEngine'), $result);

$settings = array('engine' => 'TestPlugin.TestPluginCache', 'path' => TMP, 'prefix' => 'cake_test_');
$result = Cache::config('pluginLibEngine', $settings);
$this->assertEquals($result, Cache::config('pluginLibEngine'));
$this->assertEquals(Cache::config('pluginLibEngine'), $result);

Cache::drop('libEngine');
Cache::drop('pluginLibEngine');
Expand Down Expand Up @@ -161,10 +161,10 @@ public function testConfigChange() {
$_cacheConfigTests = Cache::config('tests');

$result = Cache::config('sessions', array('engine' => 'File', 'path' => TMP . 'sessions'));
$this->assertEquals($result['settings'], Cache::settings('sessions'));
$this->assertEquals(Cache::settings('sessions'), $result['settings']);

$result = Cache::config('tests', array('engine' => 'File', 'path' => TMP . 'tests'));
$this->assertEquals($result['settings'], Cache::settings('tests'));
$this->assertEquals(Cache::settings('tests'), $result['settings']);

Cache::config('sessions', $_cacheConfigSessions['settings']);
Cache::config('tests', $_cacheConfigTests['settings']);
Expand All @@ -180,17 +180,17 @@ public function testConfigSettingDefaultConfigKey() {

Cache::write('value_one', 'I am cached', 'test_name');
$result = Cache::read('value_one', 'test_name');
$this->assertEquals($result, 'I am cached');
$this->assertEquals('I am cached', $result);

$result = Cache::read('value_one');
$this->assertEquals($result, null);
$this->assertEquals(null, $result);

Cache::write('value_one', 'I am in default config!');
$result = Cache::read('value_one');
$this->assertEquals($result, 'I am in default config!');
$this->assertEquals('I am in default config!', $result);

$result = Cache::read('value_one', 'test_name');
$this->assertEquals($result, 'I am cached');
$this->assertEquals('I am cached', $result);

Cache::delete('value_one', 'test_name');
Cache::delete('value_one', 'default');
Expand Down Expand Up @@ -384,7 +384,7 @@ public function testSet() {

Cache::set(array('duration' => '+1 year'));
$data = Cache::read('test_cache');
$this->assertEquals($data, 'this is just a simple test of the cache system');
$this->assertEquals('this is just a simple test of the cache system', $data);

Cache::delete('test_cache');

Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/Case/Cache/Engine/ApcEngineTest.php
Expand Up @@ -60,15 +60,15 @@ public function testReadAndWriteCache() {

$result = Cache::read('test', 'apc');
$expecting = '';
$this->assertEquals($result, $expecting);
$this->assertEquals($expecting, $result);

$data = 'this is a test of the emergency broadcasting system';
$result = Cache::write('test', $data, 'apc');
$this->assertTrue($result);

$result = Cache::read('test', 'apc');
$expecting = $data;
$this->assertEquals($result, $expecting);
$this->assertEquals($expecting, $result);

Cache::delete('test', 'apc');
}
Expand Down
18 changes: 9 additions & 9 deletions lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
Expand Up @@ -62,11 +62,11 @@ public function tearDown() {
*/
public function testCacheDirChange() {
$result = Cache::config('sessions', array('engine' => 'File', 'path' => TMP . 'sessions'));
$this->assertEquals($result['settings'], Cache::settings('sessions'));
$this->assertEquals(Cache::settings('sessions'), $result['settings']);

$result = Cache::config('sessions', array('engine' => 'File', 'path' => TMP . 'tests'));
$this->assertEquals($result['settings'], Cache::settings('sessions'));
$this->assertNotEquals($result['settings'], Cache::settings('default'));
$this->assertEquals(Cache::settings('sessions'), $result['settings']);
$this->assertNotEquals(Cache::settings('default'), $result['settings']);
}

/**
Expand All @@ -84,15 +84,15 @@ public function testReadAndWriteCache() {

$result = Cache::read('test', 'file_test');
$expecting = '';
$this->assertEquals($result, $expecting);
$this->assertEquals($expecting, $result);

$data = 'this is a test of the emergency broadcasting system';
$result = Cache::write('test', $data, 'file_test');
$this->assertTrue(file_exists(CACHE . 'cake_test'));

$result = Cache::read('test', 'file_test');
$expecting = $data;
$this->assertEquals($result, $expecting);
$this->assertEquals($expecting, $result);

Cache::delete('test', 'file_test');
}
Expand Down Expand Up @@ -243,11 +243,11 @@ public function testClearWithPrefixes() {
$FileOne->write('prefix_one_key_one', $data1, DAY);
$FileTwo->write('prefix_two_key_two', $data2, DAY);

$this->assertEquals($FileOne->read('prefix_one_key_one'), $expected);
$this->assertEquals($FileTwo->read('prefix_two_key_two'), $expected);
$this->assertEquals($expected, $FileOne->read('prefix_one_key_one'));
$this->assertEquals($expected, $FileTwo->read('prefix_two_key_two'));

$FileOne->clear(false);
$this->assertEquals($FileTwo->read('prefix_two_key_two'), $expected, 'secondary config was cleared by accident.');
$this->assertEquals($expected, $FileTwo->read('prefix_two_key_two'), 'secondary config was cleared by accident.');
$FileTwo->clear(false);
}

Expand All @@ -262,7 +262,7 @@ public function testKeyPath() {
$this->assertTrue(file_exists(CACHE . 'cake_views_countries_something'));

$result = Cache::read('views.countries.something', 'file_test');
$this->assertEquals($result, 'here');
$this->assertEquals('here', $result);

$result = Cache::clear(false, 'file_test');
$this->assertTrue($result);
Expand Down
26 changes: 13 additions & 13 deletions lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php
Expand Up @@ -91,7 +91,7 @@ public function testSettings() {
'engine' => 'Memcache',
'persistent' => true,
);
$this->assertEquals($settings, $expecting);
$this->assertEquals($expecting, $settings);
}

/**
Expand All @@ -118,7 +118,7 @@ public function testMultipleServers() {

$servers = array_keys($Memcache->__Memcache->getExtendedStats());
$settings = $Memcache->settings();
$this->assertEquals($servers, $settings['servers']);
$this->assertEquals($settings['servers'], $servers);
Cache::drop('dual_server');
}

Expand Down Expand Up @@ -160,10 +160,10 @@ public function testConnectIpv6() {
public function testParseServerStringNonLatin() {
$Memcache = new TestMemcacheEngine();
$result = $Memcache->parseServerString('schülervz.net:13211');
$this->assertEquals($result, array('schülervz.net', '13211'));
$this->assertEquals(array('schülervz.net', '13211'), $result);

$result = $Memcache->parseServerString('sülül:1111');
$this->assertEquals($result, array('sülül', '1111'));
$this->assertEquals(array('sülül', '1111'), $result);
}

/**
Expand All @@ -174,7 +174,7 @@ public function testParseServerStringNonLatin() {
public function testParseServerStringUnix() {
$Memcache = new TestMemcacheEngine();
$result = $Memcache->parseServerString('unix:///path/to/memcached.sock');
$this->assertEquals($result, array('unix:///path/to/memcached.sock', 0));
$this->assertEquals(array('unix:///path/to/memcached.sock', 0), $result);
}

/**
Expand All @@ -187,15 +187,15 @@ public function testReadAndWriteCache() {

$result = Cache::read('test', 'memcache');
$expecting = '';
$this->assertEquals($result, $expecting);
$this->assertEquals($expecting, $result);

$data = 'this is a test of the emergency broadcasting system';
$result = Cache::write('test', $data, 'memcache');
$this->assertTrue($result);

$result = Cache::read('test', 'memcache');
$expecting = $data;
$this->assertEquals($result, $expecting);
$this->assertEquals($expecting, $result);

Cache::delete('test', 'memcache');
}
Expand Down Expand Up @@ -243,7 +243,7 @@ public function testExpiry() {
sleep(2);
$result = Cache::read('long_expiry_test', 'memcache');
$expecting = $data;
$this->assertEquals($result, $expecting);
$this->assertEquals($expecting, $result);

Cache::config('memcache', array('duration' => 3600));
}
Expand Down Expand Up @@ -327,11 +327,11 @@ public function testConfigurationConflict() {
$this->assertTrue(Cache::write('duration_test', 'yay', 'long_memcache'));
$this->assertTrue(Cache::write('short_duration_test', 'boo', 'short_memcache'));

$this->assertEquals(Cache::read('duration_test', 'long_memcache'), 'yay', 'Value was not read %s');
$this->assertEquals(Cache::read('short_duration_test', 'short_memcache'), 'boo', 'Value was not read %s');
$this->assertEquals('yay', Cache::read('duration_test', 'long_memcache'), 'Value was not read %s');
$this->assertEquals('boo', Cache::read('short_duration_test', 'short_memcache'), 'Value was not read %s');

sleep(1);
$this->assertEquals(Cache::read('duration_test', 'long_memcache'), 'yay', 'Value was not read %s');
$this->assertEquals('yay', Cache::read('duration_test', 'long_memcache'), 'Value was not read %s');

sleep(2);
$this->assertFalse(Cache::read('short_duration_test', 'short_memcache'), 'Cache was not invalidated %s');
Expand Down Expand Up @@ -376,9 +376,9 @@ public function testZeroDuration() {
Cache::config('memcache', array('duration' => 0));
$result = Cache::write('test_key', 'written!', 'memcache');

$this->assertTrue($result, 'Could not write with duration 0');
$this->assertTrue('Could not write with duration 0', $result);
$result = Cache::read('test_key', 'memcache');
$this->assertEquals($result, 'written!');
$this->assertEquals('written!', $result);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/Case/Cache/Engine/WincacheEngineTest.php
Expand Up @@ -59,15 +59,15 @@ public function testReadAndWriteCache() {

$result = Cache::read('test', 'wincache');
$expecting = '';
$this->assertEquals($result, $expecting);
$this->assertEquals($expecting, $result);

$data = 'this is a test of the emergency broadcasting system';
$result = Cache::write('test', $data, 'wincache');
$this->assertTrue($result);

$result = Cache::read('test', 'wincache');
$expecting = $data;
$this->assertEquals($result, $expecting);
$this->assertEquals($expecting, $result);

Cache::delete('test', 'wincache');
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/Case/Cache/Engine/XcacheEngineTest.php
Expand Up @@ -80,15 +80,15 @@ public function testReadAndWriteCache() {

$result = Cache::read('test');
$expecting = '';
$this->assertEquals($result, $expecting);
$this->assertEquals($expecting, $result);

$data = 'this is a test of the emergency broadcasting system';
$result = Cache::write('test', $data);
$this->assertTrue($result);

$result = Cache::read('test');
$expecting = $data;
$this->assertEquals($result, $expecting);
$this->assertEquals($expecting, $result);

Cache::delete('test');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Configure/IniReaderTest.php
Expand Up @@ -77,7 +77,7 @@ public function testReadingWithoutSection() {
'some_key' => 'some_value',
'bool_key' => true
);
$this->assertEquals($config, $expected);
$this->assertEquals($expected, $config);
}

/**
Expand Down

0 comments on commit 90e7afb

Please sign in to comment.