a grand renaming so that the most significant portion of the name comes first
This commit is contained in:
196
php-practice/web-cake/html/cake/tests/cases/libs/cache/apc.test.php
vendored
Normal file
196
php-practice/web-cake/html/cake/tests/cases/libs/cache/apc.test.php
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
/**
|
||||
* ApcEngineTest file
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.cache
|
||||
* @since CakePHP(tm) v 1.2.0.5434
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
if (!class_exists('Cache')) {
|
||||
require LIBS . 'cache.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* ApcEngineTest class
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.cache
|
||||
*/
|
||||
class ApcEngineTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* skip method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function skip() {
|
||||
$skip = true;
|
||||
if (function_exists('apc_store')) {
|
||||
$skip = false;
|
||||
}
|
||||
$this->skipIf($skip, '%s Apc is not installed or configured properly');
|
||||
}
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setUp() {
|
||||
$this->_cacheDisable = Configure::read('Cache.disable');
|
||||
Configure::write('Cache.disable', false);
|
||||
Cache::config('apc', array('engine' => 'Apc', 'prefix' => 'cake_'));
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
Configure::write('Cache.disable', $this->_cacheDisable);
|
||||
Cache::drop('apc');
|
||||
Cache::config('default');
|
||||
}
|
||||
|
||||
/**
|
||||
* testReadAndWriteCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testReadAndWriteCache() {
|
||||
Cache::set(array('duration' => 1));
|
||||
|
||||
$result = Cache::read('test');
|
||||
$expecting = '';
|
||||
$this->assertEqual($result, $expecting);
|
||||
|
||||
$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->assertEqual($result, $expecting);
|
||||
|
||||
Cache::delete('test');
|
||||
}
|
||||
|
||||
/**
|
||||
* testExpiry method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testExpiry() {
|
||||
Cache::set(array('duration' => 1));
|
||||
|
||||
$result = Cache::read('test');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('other_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
sleep(2);
|
||||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
|
||||
Cache::set(array('duration' => 1));
|
||||
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('other_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
sleep(2);
|
||||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
|
||||
sleep(2);
|
||||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDeleteCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDeleteCache() {
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('delete_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = Cache::delete('delete_test');
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDecrement method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDecrement() {
|
||||
if ($this->skipIf(!function_exists('apc_dec'), 'No apc_dec() function, cannot test decrement() %s')) {
|
||||
return;
|
||||
}
|
||||
$result = Cache::write('test_decrement', 5);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = Cache::decrement('test_decrement');
|
||||
$this->assertEqual(4, $result);
|
||||
|
||||
$result = Cache::read('test_decrement');
|
||||
$this->assertEqual(4, $result);
|
||||
|
||||
$result = Cache::decrement('test_decrement', 2);
|
||||
$this->assertEqual(2, $result);
|
||||
|
||||
$result = Cache::read('test_decrement');
|
||||
$this->assertEqual(2, $result);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testIncrement method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testIncrement() {
|
||||
if ($this->skipIf(!function_exists('apc_inc'), 'No apc_inc() function, cannot test increment() %s')) {
|
||||
return;
|
||||
}
|
||||
$result = Cache::write('test_increment', 5);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = Cache::increment('test_increment');
|
||||
$this->assertEqual(6, $result);
|
||||
|
||||
$result = Cache::read('test_increment');
|
||||
$this->assertEqual(6, $result);
|
||||
|
||||
$result = Cache::increment('test_increment', 2);
|
||||
$this->assertEqual(8, $result);
|
||||
|
||||
$result = Cache::read('test_increment');
|
||||
$this->assertEqual(8, $result);
|
||||
}
|
||||
}
|
404
php-practice/web-cake/html/cake/tests/cases/libs/cache/file.test.php
vendored
Normal file
404
php-practice/web-cake/html/cake/tests/cases/libs/cache/file.test.php
vendored
Normal file
@@ -0,0 +1,404 @@
|
||||
<?php
|
||||
/**
|
||||
* FileEngineTest file
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.cache
|
||||
* @since CakePHP(tm) v 1.2.0.5434
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
if (!class_exists('Cache')) {
|
||||
require LIBS . 'cache.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* FileEngineTest class
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.cache
|
||||
*/
|
||||
class FileEngineTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* config property
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $config = array();
|
||||
|
||||
/**
|
||||
* startCase method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function startCase() {
|
||||
$this->_cacheDisable = Configure::read('Cache.disable');
|
||||
$this->_cacheConfig = Cache::config('default');
|
||||
Configure::write('Cache.disable', false);
|
||||
Cache::config('default', array('engine' => 'File', 'path' => CACHE));
|
||||
}
|
||||
|
||||
/**
|
||||
* endCase method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function endCase() {
|
||||
Configure::write('Cache.disable', $this->_cacheDisable);
|
||||
Cache::config('default', $this->_cacheConfig['settings']);
|
||||
}
|
||||
|
||||
/**
|
||||
* testCacheDirChange method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testCacheDirChange() {
|
||||
$result = Cache::config('sessions', array('engine'=> 'File', 'path' => TMP . 'sessions'));
|
||||
$this->assertEqual($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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testReadAndWriteCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testReadAndWriteCache() {
|
||||
Cache::config('default');
|
||||
|
||||
$result = Cache::write(null, 'here');
|
||||
$this->assertFalse($result);
|
||||
|
||||
Cache::set(array('duration' => 1));
|
||||
|
||||
$result = Cache::read('test');
|
||||
$expecting = '';
|
||||
$this->assertEqual($result, $expecting);
|
||||
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('test', $data);
|
||||
$this->assertTrue(file_exists(CACHE . 'cake_test'));
|
||||
|
||||
$result = Cache::read('test');
|
||||
$expecting = $data;
|
||||
$this->assertEqual($result, $expecting);
|
||||
|
||||
Cache::delete('test');
|
||||
}
|
||||
|
||||
/**
|
||||
* testExpiry method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testExpiry() {
|
||||
Cache::set(array('duration' => 1));
|
||||
|
||||
$result = Cache::read('test');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('other_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
sleep(2);
|
||||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
|
||||
Cache::set(array('duration' => "+1 second"));
|
||||
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('other_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
sleep(2);
|
||||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDeleteCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDeleteCache() {
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('delete_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = Cache::delete('delete_test');
|
||||
$this->assertTrue($result);
|
||||
$this->assertFalse(file_exists(TMP . 'tests' . DS . 'delete_test'));
|
||||
|
||||
$result = Cache::delete('delete_test');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSerialize method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSerialize() {
|
||||
Cache::config('default', array('engine' => 'File', 'serialize' => true));
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$write = Cache::write('serialize_test', $data);
|
||||
$this->assertTrue($write);
|
||||
|
||||
Cache::config('default', array('serialize' => false));
|
||||
$read = Cache::read('serialize_test');
|
||||
|
||||
$newread = Cache::read('serialize_test');
|
||||
|
||||
$delete = Cache::delete('serialize_test');
|
||||
|
||||
$this->assertIdentical($read, serialize($data));
|
||||
|
||||
$this->assertIdentical(unserialize($newread), $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* testClear method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testClear() {
|
||||
Cache::config('default', array('engine' => 'File', 'duration' => 1));
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$write = Cache::write('serialize_test1', $data);
|
||||
$write = Cache::write('serialize_test2', $data);
|
||||
$write = Cache::write('serialize_test3', $data);
|
||||
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test1'));
|
||||
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test2'));
|
||||
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test3'));
|
||||
sleep(2);
|
||||
$result = Cache::clear(true);
|
||||
$this->assertTrue($result);
|
||||
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test1'));
|
||||
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test2'));
|
||||
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test3'));
|
||||
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$write = Cache::write('serialize_test1', $data);
|
||||
$write = Cache::write('serialize_test2', $data);
|
||||
$write = Cache::write('serialize_test3', $data);
|
||||
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test1'));
|
||||
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test2'));
|
||||
$this->assertTrue(file_exists(CACHE . 'cake_serialize_test3'));
|
||||
|
||||
$result = Cache::clear();
|
||||
$this->assertTrue($result);
|
||||
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test1'));
|
||||
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test2'));
|
||||
$this->assertFalse(file_exists(CACHE . 'cake_serialize_test3'));
|
||||
|
||||
Cache::config('default', array('engine' => 'File', 'path' => CACHE . 'views'));
|
||||
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$write = Cache::write('controller_view_1', $data);
|
||||
$write = Cache::write('controller_view_2', $data);
|
||||
$write = Cache::write('controller_view_3', $data);
|
||||
$write = Cache::write('controller_view_10', $data);
|
||||
$write = Cache::write('controller_view_11', $data);
|
||||
$write = Cache::write('controller_view_12', $data);
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));
|
||||
|
||||
clearCache('controller_view_1', 'views', '');
|
||||
$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));
|
||||
|
||||
clearCache('controller_view', 'views', '');
|
||||
$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));
|
||||
$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));
|
||||
$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));
|
||||
$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));
|
||||
$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));
|
||||
$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));
|
||||
|
||||
$write = Cache::write('controller_view_1', $data);
|
||||
$write = Cache::write('controller_view_2', $data);
|
||||
$write = Cache::write('controller_view_3', $data);
|
||||
$write = Cache::write('controller_view_10', $data);
|
||||
$write = Cache::write('controller_view_11', $data);
|
||||
$write = Cache::write('controller_view_12', $data);
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));
|
||||
|
||||
clearCache(array('controller_view_2', 'controller_view_11', 'controller_view_12'), 'views', '');
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_1'));
|
||||
$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_2'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_3'));
|
||||
$this->assertTrue(file_exists(CACHE . 'views'. DS . 'cake_controller_view_10'));
|
||||
$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_11'));
|
||||
$this->assertFalse(file_exists(CACHE . 'views'. DS . 'cake_controller_view_12'));
|
||||
|
||||
clearCache('controller_view');
|
||||
|
||||
Cache::config('default', array('engine' => 'File', 'path' => CACHE));
|
||||
}
|
||||
|
||||
/**
|
||||
* test that clear() doesn't wipe files not in the current engine's prefix.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testClearWithPrefixes() {
|
||||
$FileOne =& new FileEngine();
|
||||
$FileOne->init(array(
|
||||
'prefix' => 'prefix_one_',
|
||||
'duration' => DAY
|
||||
));
|
||||
$FileTwo =& new FileEngine();
|
||||
$FileTwo->init(array(
|
||||
'prefix' => 'prefix_two_',
|
||||
'duration' => DAY
|
||||
));
|
||||
|
||||
$data1 = $data2 = $expected = 'content to cache';
|
||||
$FileOne->write('key_one', $data1, DAY);
|
||||
$FileTwo->write('key_two', $data2, DAY);
|
||||
|
||||
$this->assertEqual($FileOne->read('key_one'), $expected);
|
||||
$this->assertEqual($FileTwo->read('key_two'), $expected);
|
||||
|
||||
$FileOne->clear(false);
|
||||
$this->assertEqual($FileTwo->read('key_two'), $expected, 'secondary config was cleared by accident.');
|
||||
}
|
||||
|
||||
/**
|
||||
* testKeyPath method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testKeyPath() {
|
||||
$result = Cache::write('views.countries.something', 'here');
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue(file_exists(CACHE . 'cake_views_countries_something'));
|
||||
|
||||
$result = Cache::read('views.countries.something');
|
||||
$this->assertEqual($result, 'here');
|
||||
|
||||
$result = Cache::clear();
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testRemoveWindowsSlashesFromCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRemoveWindowsSlashesFromCache() {
|
||||
Cache::config('windows_test', array('engine' => 'File', 'isWindows' => true, 'prefix' => null, 'path' => TMP));
|
||||
|
||||
$expected = array (
|
||||
'C:\dev\prj2\sites\cake\libs' => array(
|
||||
0 => 'C:\dev\prj2\sites\cake\libs', 1 => 'C:\dev\prj2\sites\cake\libs\view',
|
||||
2 => 'C:\dev\prj2\sites\cake\libs\view\scaffolds', 3 => 'C:\dev\prj2\sites\cake\libs\view\pages',
|
||||
4 => 'C:\dev\prj2\sites\cake\libs\view\layouts', 5 => 'C:\dev\prj2\sites\cake\libs\view\layouts\xml',
|
||||
6 => 'C:\dev\prj2\sites\cake\libs\view\layouts\rss', 7 => 'C:\dev\prj2\sites\cake\libs\view\layouts\js',
|
||||
8 => 'C:\dev\prj2\sites\cake\libs\view\layouts\email', 9 => 'C:\dev\prj2\sites\cake\libs\view\layouts\email\text',
|
||||
10 => 'C:\dev\prj2\sites\cake\libs\view\layouts\email\html', 11 => 'C:\dev\prj2\sites\cake\libs\view\helpers',
|
||||
12 => 'C:\dev\prj2\sites\cake\libs\view\errors', 13 => 'C:\dev\prj2\sites\cake\libs\view\elements',
|
||||
14 => 'C:\dev\prj2\sites\cake\libs\view\elements\email', 15 => 'C:\dev\prj2\sites\cake\libs\view\elements\email\text',
|
||||
16 => 'C:\dev\prj2\sites\cake\libs\view\elements\email\html', 17 => 'C:\dev\prj2\sites\cake\libs\model',
|
||||
18 => 'C:\dev\prj2\sites\cake\libs\model\datasources', 19 => 'C:\dev\prj2\sites\cake\libs\model\datasources\dbo',
|
||||
20 => 'C:\dev\prj2\sites\cake\libs\model\behaviors', 21 => 'C:\dev\prj2\sites\cake\libs\controller',
|
||||
22 => 'C:\dev\prj2\sites\cake\libs\controller\components', 23 => 'C:\dev\prj2\sites\cake\libs\cache'),
|
||||
'C:\dev\prj2\sites\main_site\vendors' => array(
|
||||
0 => 'C:\dev\prj2\sites\main_site\vendors', 1 => 'C:\dev\prj2\sites\main_site\vendors\shells',
|
||||
2 => 'C:\dev\prj2\sites\main_site\vendors\shells\templates', 3 => 'C:\dev\prj2\sites\main_site\vendors\shells\templates\cdc_project',
|
||||
4 => 'C:\dev\prj2\sites\main_site\vendors\shells\tasks', 5 => 'C:\dev\prj2\sites\main_site\vendors\js',
|
||||
6 => 'C:\dev\prj2\sites\main_site\vendors\css'),
|
||||
'C:\dev\prj2\sites\vendors' => array(
|
||||
0 => 'C:\dev\prj2\sites\vendors', 1 => 'C:\dev\prj2\sites\vendors\simpletest',
|
||||
2 => 'C:\dev\prj2\sites\vendors\simpletest\test', 3 => 'C:\dev\prj2\sites\vendors\simpletest\test\support',
|
||||
4 => 'C:\dev\prj2\sites\vendors\simpletest\test\support\collector', 5 => 'C:\dev\prj2\sites\vendors\simpletest\extensions',
|
||||
6 => 'C:\dev\prj2\sites\vendors\simpletest\extensions\testdox', 7 => 'C:\dev\prj2\sites\vendors\simpletest\docs',
|
||||
8 => 'C:\dev\prj2\sites\vendors\simpletest\docs\fr', 9 => 'C:\dev\prj2\sites\vendors\simpletest\docs\en'),
|
||||
'C:\dev\prj2\sites\main_site\views\helpers' => array(
|
||||
0 => 'C:\dev\prj2\sites\main_site\views\helpers')
|
||||
);
|
||||
|
||||
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);
|
||||
|
||||
Cache::drop('windows_test');
|
||||
}
|
||||
|
||||
/**
|
||||
* testWriteQuotedString method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testWriteQuotedString() {
|
||||
Cache::config('default', array('engine' => 'File', 'path' => TMP . 'tests'));
|
||||
Cache::write('App.doubleQuoteTest', '"this is a quoted string"');
|
||||
$this->assertIdentical(Cache::read('App.doubleQuoteTest'), '"this is a quoted string"');
|
||||
Cache::write('App.singleQuoteTest', "'this is a quoted string'");
|
||||
$this->assertIdentical(Cache::read('App.singleQuoteTest'), "'this is a quoted string'");
|
||||
|
||||
Cache::config('default', array('isWindows' => true, 'path' => TMP . 'tests'));
|
||||
$this->assertIdentical(Cache::read('App.doubleQuoteTest'), '"this is a quoted string"');
|
||||
Cache::write('App.singleQuoteTest', "'this is a quoted string'");
|
||||
$this->assertIdentical(Cache::read('App.singleQuoteTest'), "'this is a quoted string'");
|
||||
}
|
||||
|
||||
/**
|
||||
* check that FileEngine generates an error when a configured Path does not exist.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testErrorWhenPathDoesNotExist() {
|
||||
if ($this->skipIf(is_dir(TMP . 'tests' . DS . 'file_failure'), 'Cannot run test directory exists. %s')) {
|
||||
return;
|
||||
}
|
||||
$this->expectError();
|
||||
Cache::config('failure', array(
|
||||
'engine' => 'File',
|
||||
'path' => TMP . 'tests' . DS . 'file_failure'
|
||||
));
|
||||
|
||||
Cache::drop('failure');
|
||||
}
|
||||
}
|
367
php-practice/web-cake/html/cake/tests/cases/libs/cache/memcache.test.php
vendored
Normal file
367
php-practice/web-cake/html/cake/tests/cases/libs/cache/memcache.test.php
vendored
Normal file
@@ -0,0 +1,367 @@
|
||||
<?php
|
||||
/**
|
||||
* MemcacheEngineTest file
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.cache
|
||||
* @since CakePHP(tm) v 1.2.0.5434
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
if (!class_exists('Cache')) {
|
||||
require LIBS . 'cache.php';
|
||||
}
|
||||
App::import('Core', 'cache/Memcache');
|
||||
|
||||
|
||||
class TestMemcacheEngine extends MemcacheEngine {
|
||||
/**
|
||||
* public accessor to _parseServerString
|
||||
*
|
||||
* @param string $server
|
||||
* @return array
|
||||
*/
|
||||
function parseServerString($server) {
|
||||
return $this->_parseServerString($server);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* MemcacheEngineTest class
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.cache
|
||||
*/
|
||||
class MemcacheEngineTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* skip method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function skip() {
|
||||
$skip = true;
|
||||
if (class_exists('Memcache')) {
|
||||
$skip = false;
|
||||
}
|
||||
$this->skipIf($skip, '%s Memcache is not installed or configured properly.');
|
||||
}
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setUp() {
|
||||
$this->_cacheDisable = Configure::read('Cache.disable');
|
||||
Configure::write('Cache.disable', false);
|
||||
Cache::config('memcache', array(
|
||||
'engine' => 'Memcache',
|
||||
'prefix' => 'cake_',
|
||||
'duration' => 3600
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
Configure::write('Cache.disable', $this->_cacheDisable);
|
||||
Cache::drop('memcache');
|
||||
Cache::config('default');
|
||||
}
|
||||
|
||||
/**
|
||||
* testSettings method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSettings() {
|
||||
$settings = Cache::settings();
|
||||
unset($settings['serialize'], $settings['path']);
|
||||
$expecting = array(
|
||||
'prefix' => 'cake_',
|
||||
'duration'=> 3600,
|
||||
'probability' => 100,
|
||||
'servers' => array('127.0.0.1'),
|
||||
'compress' => false,
|
||||
'engine' => 'Memcache'
|
||||
);
|
||||
$this->assertEqual($settings, $expecting);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSettings method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMultipleServers() {
|
||||
$servers = array('127.0.0.1:11211', '127.0.0.1:11222');
|
||||
$available = true;
|
||||
$Memcache =& new Memcache();
|
||||
|
||||
foreach($servers as $server) {
|
||||
list($host, $port) = explode(':', $server);
|
||||
if (!@$Memcache->connect($host, $port)) {
|
||||
$available = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->skipIf(!$available, '%s Need memcache servers at ' . implode(', ', $servers) . ' to run this test')) {
|
||||
return;
|
||||
}
|
||||
$Memcache =& new MemcacheEngine();
|
||||
$Memcache->init(array('engine' => 'Memcache', 'servers' => $servers));
|
||||
|
||||
$servers = array_keys($Memcache->__Memcache->getExtendedStats());
|
||||
$settings = $Memcache->settings();
|
||||
$this->assertEqual($servers, $settings['servers']);
|
||||
Cache::drop('dual_server');
|
||||
}
|
||||
|
||||
/**
|
||||
* testConnect method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testConnect() {
|
||||
$Memcache =& new MemcacheEngine();
|
||||
$Memcache->init(Cache::settings('memcache'));
|
||||
$result = $Memcache->connect('127.0.0.1');
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* test connecting to an ipv6 server.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testConnectIpv6() {
|
||||
$Memcache =& new MemcacheEngine();
|
||||
$result = $Memcache->init(array(
|
||||
'prefix' => 'cake_',
|
||||
'duration' => 200,
|
||||
'engine' => 'Memcache',
|
||||
'servers' => array(
|
||||
'[::1]:11211'
|
||||
)
|
||||
));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* test non latin domains.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testParseServerStringNonLatin() {
|
||||
$Memcache =& new TestMemcacheEngine();
|
||||
$result = $Memcache->parseServerString('schülervz.net:13211');
|
||||
$this->assertEqual($result, array('schülervz.net', '13211'));
|
||||
|
||||
$result = $Memcache->parseServerString('sülül:1111');
|
||||
$this->assertEqual($result, array('sülül', '1111'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testReadAndWriteCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testReadAndWriteCache() {
|
||||
Cache::set(array('duration' => 1));
|
||||
|
||||
$result = Cache::read('test');
|
||||
$expecting = '';
|
||||
$this->assertEqual($result, $expecting);
|
||||
|
||||
$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->assertEqual($result, $expecting);
|
||||
|
||||
Cache::delete('test');
|
||||
}
|
||||
|
||||
/**
|
||||
* testExpiry method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testExpiry() {
|
||||
Cache::set(array('duration' => 1));
|
||||
|
||||
$result = Cache::read('test');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('other_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
sleep(2);
|
||||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
|
||||
Cache::set(array('duration' => "+1 second"));
|
||||
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('other_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
sleep(2);
|
||||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
|
||||
Cache::config('memcache', array('duration' => '+1 second'));
|
||||
sleep(2);
|
||||
|
||||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
|
||||
Cache::config('memcache', array('duration' => '+29 days'));
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('long_expiry_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
sleep(2);
|
||||
$result = Cache::read('long_expiry_test');
|
||||
$expecting = $data;
|
||||
$this->assertEqual($result, $expecting);
|
||||
|
||||
Cache::config('memcache', array('duration' => 3600));
|
||||
}
|
||||
|
||||
/**
|
||||
* testDeleteCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDeleteCache() {
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('delete_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = Cache::delete('delete_test');
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDecrement method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDecrement() {
|
||||
$result = Cache::write('test_decrement', 5);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = Cache::decrement('test_decrement');
|
||||
$this->assertEqual(4, $result);
|
||||
|
||||
$result = Cache::read('test_decrement');
|
||||
$this->assertEqual(4, $result);
|
||||
|
||||
$result = Cache::decrement('test_decrement', 2);
|
||||
$this->assertEqual(2, $result);
|
||||
|
||||
$result = Cache::read('test_decrement');
|
||||
$this->assertEqual(2, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testIncrement method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testIncrement() {
|
||||
$result = Cache::write('test_increment', 5);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = Cache::increment('test_increment');
|
||||
$this->assertEqual(6, $result);
|
||||
|
||||
$result = Cache::read('test_increment');
|
||||
$this->assertEqual(6, $result);
|
||||
|
||||
$result = Cache::increment('test_increment', 2);
|
||||
$this->assertEqual(8, $result);
|
||||
|
||||
$result = Cache::read('test_increment');
|
||||
$this->assertEqual(8, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* test that configurations don't conflict, when a file engine is declared after a memcache one.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testConfigurationConflict() {
|
||||
Cache::config('long_memcache', array(
|
||||
'engine' => 'Memcache',
|
||||
'duration'=> '+2 seconds',
|
||||
'servers' => array('127.0.0.1:11211'),
|
||||
));
|
||||
Cache::config('short_memcache', array(
|
||||
'engine' => 'Memcache',
|
||||
'duration'=> '+1 seconds',
|
||||
'servers' => array('127.0.0.1:11211'),
|
||||
));
|
||||
Cache::config('some_file', array('engine' => 'File'));
|
||||
|
||||
$this->assertTrue(Cache::write('duration_test', 'yay', 'long_memcache'));
|
||||
$this->assertTrue(Cache::write('short_duration_test', 'boo', 'short_memcache'));
|
||||
|
||||
$this->assertEqual(Cache::read('duration_test', 'long_memcache'), 'yay', 'Value was not read %s');
|
||||
$this->assertEqual(Cache::read('short_duration_test', 'short_memcache'), 'boo', 'Value was not read %s');
|
||||
|
||||
sleep(1);
|
||||
$this->assertEqual(Cache::read('duration_test', 'long_memcache'), 'yay', 'Value was not read %s');
|
||||
|
||||
sleep(2);
|
||||
$this->assertFalse(Cache::read('short_duration_test', 'short_memcache'), 'Cache was not invalidated %s');
|
||||
$this->assertFalse(Cache::read('duration_test', 'long_memcache'), 'Value did not expire %s');
|
||||
|
||||
Cache::delete('duration_test', 'long_memcache');
|
||||
Cache::delete('short_duration_test', 'short_memcache');
|
||||
}
|
||||
|
||||
/**
|
||||
* test that a 0 duration can succesfully write.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testZeroDuration() {
|
||||
Cache::config('memcache', array('duration' => 0));
|
||||
$result = Cache::write('test_key', 'written!', 'memcache');
|
||||
|
||||
$this->assertTrue($result, 'Could not write with duration 0');
|
||||
$result = Cache::read('test_key', 'memcache');
|
||||
$this->assertEqual($result, 'written!');
|
||||
|
||||
}
|
||||
|
||||
}
|
222
php-practice/web-cake/html/cake/tests/cases/libs/cache/xcache.test.php
vendored
Normal file
222
php-practice/web-cake/html/cake/tests/cases/libs/cache/xcache.test.php
vendored
Normal file
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
/**
|
||||
* XcacheEngineTest file
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.cache
|
||||
* @since CakePHP(tm) v 1.2.0.5434
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
if (!class_exists('Cache')) {
|
||||
require LIBS . 'cache.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* XcacheEngineTest class
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.cache
|
||||
*/
|
||||
class XcacheEngineTest extends UnitTestCase {
|
||||
|
||||
/**
|
||||
* skip method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function skip() {
|
||||
$skip = true;
|
||||
if (function_exists('xcache_set')) {
|
||||
$skip = false;
|
||||
}
|
||||
$this->skipIf($skip, '%s Xcache is not installed or configured properly');
|
||||
}
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setUp() {
|
||||
$this->_cacheDisable = Configure::read('Cache.disable');
|
||||
Configure::write('Cache.disable', false);
|
||||
Cache::config('xcache', array('engine' => 'Xcache', 'prefix' => 'cake_'));
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
Configure::write('Cache.disable', $this->_cacheDisable);
|
||||
Cache::config('default');
|
||||
}
|
||||
|
||||
/**
|
||||
* testSettings method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSettings() {
|
||||
$settings = Cache::settings();
|
||||
$expecting = array(
|
||||
'prefix' => 'cake_',
|
||||
'duration'=> 3600,
|
||||
'probability' => 100,
|
||||
'engine' => 'Xcache',
|
||||
);
|
||||
$this->assertTrue(isset($settings['PHP_AUTH_USER']));
|
||||
$this->assertTrue(isset($settings['PHP_AUTH_PW']));
|
||||
|
||||
unset($settings['PHP_AUTH_USER'], $settings['PHP_AUTH_PW']);
|
||||
$this->assertEqual($settings, $expecting);
|
||||
}
|
||||
|
||||
/**
|
||||
* testReadAndWriteCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testReadAndWriteCache() {
|
||||
Cache::set(array('duration' => 1));
|
||||
|
||||
$result = Cache::read('test');
|
||||
$expecting = '';
|
||||
$this->assertEqual($result, $expecting);
|
||||
|
||||
$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->assertEqual($result, $expecting);
|
||||
|
||||
Cache::delete('test');
|
||||
}
|
||||
|
||||
/**
|
||||
* testExpiry method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testExpiry() {
|
||||
Cache::set(array('duration' => 1));
|
||||
$result = Cache::read('test');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('other_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
sleep(2);
|
||||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
|
||||
Cache::set(array('duration' => "+1 second"));
|
||||
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('other_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
sleep(2);
|
||||
$result = Cache::read('other_test');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDeleteCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDeleteCache() {
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('delete_test', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = Cache::delete('delete_test');
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testClearCache method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testClearCache() {
|
||||
$data = 'this is a test of the emergency broadcasting system';
|
||||
$result = Cache::write('clear_test_1', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = Cache::write('clear_test_2', $data);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = Cache::clear();
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testDecrement method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testDecrement() {
|
||||
$result = Cache::write('test_decrement', 5);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = Cache::decrement('test_decrement');
|
||||
$this->assertEqual(4, $result);
|
||||
|
||||
$result = Cache::read('test_decrement');
|
||||
$this->assertEqual(4, $result);
|
||||
|
||||
$result = Cache::decrement('test_decrement', 2);
|
||||
$this->assertEqual(2, $result);
|
||||
|
||||
$result = Cache::read('test_decrement');
|
||||
$this->assertEqual(2, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testIncrement method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testIncrement() {
|
||||
$result = Cache::write('test_increment', 5);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = Cache::increment('test_increment');
|
||||
$this->assertEqual(6, $result);
|
||||
|
||||
$result = Cache::read('test_increment');
|
||||
$this->assertEqual(6, $result);
|
||||
|
||||
$result = Cache::increment('test_increment', 2);
|
||||
$this->assertEqual(8, $result);
|
||||
|
||||
$result = Cache::read('test_increment');
|
||||
$this->assertEqual(8, $result);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user