Skip to content

Commit

Permalink
Replacing test case compatibility functions
Browse files Browse the repository at this point in the history
  • Loading branch information
shama authored and markstory committed Nov 17, 2011
1 parent 2c5350b commit 98f03dc
Show file tree
Hide file tree
Showing 107 changed files with 6,361 additions and 6,361 deletions.
208 changes: 104 additions & 104 deletions lib/Cake/Test/Case/BasicsTest.php

Large diffs are not rendered by default.

40 changes: 20 additions & 20 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->assertEqual($results, Cache::config('new'));
$this->assertEquals($results, Cache::config('new'));
$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->assertEqual($result, Cache::config('libEngine'));
$this->assertEquals($result, Cache::config('libEngine'));

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

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

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

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

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

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

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

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

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

Cache::delete('value_one', 'test_name');
Cache::delete('value_one', 'default');
Expand All @@ -205,7 +205,7 @@ public function testWritingWithConfig() {
'isWindows' => DIRECTORY_SEPARATOR == '\\',
'mask' => 0664
);
$this->assertEqual($expected, Cache::settings('sessions'));
$this->assertEquals($expected, Cache::settings('sessions'));

Cache::config('sessions', $_cacheConfigSessions['settings']);
}
Expand Down Expand Up @@ -234,7 +234,7 @@ public function testInitSettings() {

$settings = Cache::settings();
$expecting = $override + $initial;
$this->assertEqual($settings, $expecting);
$this->assertEquals($settings, $expecting);
}

/**
Expand Down Expand Up @@ -275,19 +275,19 @@ public function testDrop() {
*/
public function testWriteEmptyValues() {
Cache::write('App.falseTest', false);
$this->assertIdentical(Cache::read('App.falseTest'), false);
$this->assertSame(Cache::read('App.falseTest'), false);

Cache::write('App.trueTest', true);
$this->assertIdentical(Cache::read('App.trueTest'), true);
$this->assertSame(Cache::read('App.trueTest'), true);

Cache::write('App.nullTest', null);
$this->assertIdentical(Cache::read('App.nullTest'), null);
$this->assertSame(Cache::read('App.nullTest'), null);

Cache::write('App.zeroTest', 0);
$this->assertIdentical(Cache::read('App.zeroTest'), 0);
$this->assertSame(Cache::read('App.zeroTest'), 0);

Cache::write('App.zeroTest2', '0');
$this->assertIdentical(Cache::read('App.zeroTest2'), '0');
$this->assertSame(Cache::read('App.zeroTest2'), '0');
}

/**
Expand Down Expand Up @@ -325,7 +325,7 @@ public function testCacheDisable() {
Cache::config('test_cache_disable_1', array('engine'=> 'File', 'path' => TMP . 'tests'));

$this->assertTrue(Cache::write('key_1', 'hello', 'test_cache_disable_1'));
$this->assertIdentical(Cache::read('key_1', 'test_cache_disable_1'), 'hello');
$this->assertSame(Cache::read('key_1', 'test_cache_disable_1'), 'hello');

Configure::write('Cache.disable', true);

Expand All @@ -335,7 +335,7 @@ public function testCacheDisable() {
Configure::write('Cache.disable', false);

$this->assertTrue(Cache::write('key_3', 'hello', 'test_cache_disable_1'));
$this->assertIdentical(Cache::read('key_3', 'test_cache_disable_1'), 'hello');
$this->assertSame(Cache::read('key_3', 'test_cache_disable_1'), 'hello');

Configure::write('Cache.disable', true);
Cache::config('test_cache_disable_2', array('engine'=> 'File', 'path' => TMP . 'tests'));
Expand All @@ -346,7 +346,7 @@ public function testCacheDisable() {
Configure::write('Cache.disable', false);

$this->assertTrue(Cache::write('key_5', 'hello', 'test_cache_disable_2'));
$this->assertIdentical(Cache::read('key_5', 'test_cache_disable_2'), 'hello');
$this->assertSame(Cache::read('key_5', 'test_cache_disable_2'), 'hello');

Configure::write('Cache.disable', true);

Expand All @@ -372,7 +372,7 @@ public function testSet() {

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

Cache::delete('test_cache');

Expand Down
22 changes: 11 additions & 11 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->assertEqual($result, $expecting);
$this->assertEquals($result, $expecting);

$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->assertEqual($result, $expecting);
$this->assertEquals($result, $expecting);

Cache::delete('test', 'apc');
}
Expand All @@ -84,7 +84,7 @@ function testReadWriteDurationZero() {
sleep(1);

$result = Cache::read('zero', 'apc');
$this->assertEqual('Should save', $result);
$this->assertEquals('Should save', $result);
}

/**
Expand Down Expand Up @@ -147,16 +147,16 @@ public function testDecrement() {
$this->assertTrue($result);

$result = Cache::decrement('test_decrement', 1, 'apc');
$this->assertEqual(4, $result);
$this->assertEquals(4, $result);

$result = Cache::read('test_decrement', 'apc');
$this->assertEqual(4, $result);
$this->assertEquals(4, $result);

$result = Cache::decrement('test_decrement', 2, 'apc');
$this->assertEqual(2, $result);
$this->assertEquals(2, $result);

$result = Cache::read('test_decrement', 'apc');
$this->assertEqual(2, $result);
$this->assertEquals(2, $result);

}

Expand All @@ -172,16 +172,16 @@ public function testIncrement() {
$this->assertTrue($result);

$result = Cache::increment('test_increment', 1, 'apc');
$this->assertEqual(6, $result);
$this->assertEquals(6, $result);

$result = Cache::read('test_increment', 'apc');
$this->assertEqual(6, $result);
$this->assertEquals(6, $result);

$result = Cache::increment('test_increment', 2, 'apc');
$this->assertEqual(8, $result);
$this->assertEquals(8, $result);

$result = Cache::read('test_increment', 'apc');
$this->assertEqual(8, $result);
$this->assertEquals(8, $result);
}

/**
Expand Down
40 changes: 20 additions & 20 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->assertEqual($result['settings'], Cache::settings('sessions'));
$this->assertEquals($result['settings'], Cache::settings('sessions'));

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

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

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

$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->assertEqual($result, $expecting);
$this->assertEquals($result, $expecting);

Cache::delete('test', 'file_test');
}
Expand Down Expand Up @@ -180,9 +180,9 @@ public function testSerialize() {

$delete = Cache::delete('serialize_test', 'file_test');

$this->assertIdentical($read, serialize($data));
$this->assertSame($read, serialize($data));

$this->assertIdentical(unserialize($newread), $data);
$this->assertSame(unserialize($newread), $data);
}

/**
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->assertEqual($FileOne->read('prefix_one_key_one'), $expected);
$this->assertEqual($FileTwo->read('prefix_two_key_two'), $expected);
$this->assertEquals($FileOne->read('prefix_one_key_one'), $expected);
$this->assertEquals($FileTwo->read('prefix_two_key_two'), $expected);

$FileOne->clear(false);
$this->assertEqual($FileTwo->read('prefix_two_key_two'), $expected, 'secondary config was cleared by accident.');
$this->assertEquals($FileTwo->read('prefix_two_key_two'), $expected, '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->assertEqual($result, 'here');
$this->assertEquals($result, 'here');

$result = Cache::clear(false, 'file_test');
$this->assertTrue($result);
Expand Down Expand Up @@ -308,7 +308,7 @@ public function testRemoveWindowsSlashesFromCache() {
Cache::write('test_dir_map', $expected, 'windows_test');
$data = Cache::read('test_dir_map', 'windows_test');
Cache::delete('test_dir_map', 'windows_test');
$this->assertEqual($expected, $data);
$this->assertEquals($expected, $data);

Cache::drop('windows_test');
}
Expand All @@ -321,14 +321,14 @@ public function testRemoveWindowsSlashesFromCache() {
public function testWriteQuotedString() {
Cache::config('file_test', array('engine' => 'File', 'path' => TMP . 'tests'));
Cache::write('App.doubleQuoteTest', '"this is a quoted string"', 'file_test');
$this->assertIdentical(Cache::read('App.doubleQuoteTest', 'file_test'), '"this is a quoted string"');
$this->assertSame(Cache::read('App.doubleQuoteTest', 'file_test'), '"this is a quoted string"');
Cache::write('App.singleQuoteTest', "'this is a quoted string'", 'file_test');
$this->assertIdentical(Cache::read('App.singleQuoteTest', 'file_test'), "'this is a quoted string'");
$this->assertSame(Cache::read('App.singleQuoteTest', 'file_test'), "'this is a quoted string'");

Cache::config('file_test', array('isWindows' => true, 'path' => TMP . 'tests'));
$this->assertIdentical(Cache::read('App.doubleQuoteTest', 'file_test'), '"this is a quoted string"');
$this->assertSame(Cache::read('App.doubleQuoteTest', 'file_test'), '"this is a quoted string"');
Cache::write('App.singleQuoteTest', "'this is a quoted string'", 'file_test');
$this->assertIdentical(Cache::read('App.singleQuoteTest', 'file_test'), "'this is a quoted string'");
$this->assertSame(Cache::read('App.singleQuoteTest', 'file_test'), "'this is a quoted string'");
Cache::delete('App.singleQuoteTest', 'file_test');
Cache::delete('App.doubleQuoteTest', 'file_test');
}
Expand Down Expand Up @@ -361,31 +361,31 @@ public function testMaskSetting() {
$write = Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o',fileperms(TMP . 'tests' . DS .'cake_masking_test')), -4);
$expected = '0664';
$this->assertEqual($result, $expected);
$this->assertEquals($result, $expected);
Cache::delete('masking_test', 'mask_test');
Cache::drop('mask_test');

Cache::config('mask_test', array('engine' => 'File', 'mask' => 0666, 'path' => TMP . 'tests'));
$write = Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o',fileperms(TMP . 'tests' . DS .'cake_masking_test')), -4);
$expected = '0666';
$this->assertEqual($result, $expected);
$this->assertEquals($result, $expected);
Cache::delete('masking_test', 'mask_test');
Cache::drop('mask_test');

Cache::config('mask_test', array('engine' => 'File', 'mask' => 0644, 'path' => TMP . 'tests'));
$write = Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o',fileperms(TMP . 'tests' . DS .'cake_masking_test')), -4);
$expected = '0644';
$this->assertEqual($result, $expected);
$this->assertEquals($result, $expected);
Cache::delete('masking_test', 'mask_test');
Cache::drop('mask_test');

Cache::config('mask_test', array('engine' => 'File', 'mask' => 0640, 'path' => TMP . 'tests'));
$write = Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o',fileperms(TMP . 'tests' . DS .'cake_masking_test')), -4);
$expected = '0640';
$this->assertEqual($result, $expected);
$this->assertEquals($result, $expected);
Cache::delete('masking_test', 'mask_test');
Cache::drop('mask_test');
}
Expand Down

0 comments on commit 98f03dc

Please sign in to comment.