mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Updating FileEngine test to use new Cache api methods.
This commit is contained in:
parent
e3e02bfcee
commit
4b184ceccb
1 changed files with 37 additions and 40 deletions
77
cake/tests/cases/libs/cache/file.test.php
vendored
77
cake/tests/cases/libs/cache/file.test.php
vendored
|
@ -2,8 +2,6 @@
|
||||||
/**
|
/**
|
||||||
* FileEngineTest file
|
* FileEngineTest file
|
||||||
*
|
*
|
||||||
* Long description for file
|
|
||||||
*
|
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||||
|
@ -22,9 +20,6 @@
|
||||||
if (!class_exists('Cache')) {
|
if (!class_exists('Cache')) {
|
||||||
require LIBS . 'cache.php';
|
require LIBS . 'cache.php';
|
||||||
}
|
}
|
||||||
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
|
|
||||||
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FileEngineTest class
|
* FileEngineTest class
|
||||||
|
@ -74,12 +69,11 @@ class FileEngineTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
function testCacheDirChange() {
|
function testCacheDirChange() {
|
||||||
$result = Cache::config('sessions', array('engine'=> 'File', 'path' => TMP . 'sessions'));
|
$result = Cache::config('sessions', array('engine'=> 'File', 'path' => TMP . 'sessions'));
|
||||||
$this->assertEqual($result['settings'], Cache::settings('File'));
|
$this->assertEqual($result['settings'], Cache::settings('sessions'));
|
||||||
$this->assertNotEqual($result, Cache::settings('File'));
|
|
||||||
|
|
||||||
$result = Cache::config('tests', array('engine'=> 'File', 'path' => TMP . 'tests'));
|
$result = Cache::config('sessions', array('engine'=> 'File', 'path' => TMP . 'tests'));
|
||||||
$this->assertEqual($result['settings'], Cache::settings('File'));
|
$this->assertEqual($result['settings'], Cache::settings('sessions'));
|
||||||
$this->assertNotEqual($result, Cache::settings('File'));
|
$this->assertNotEqual($result['settings'], Cache::settings('default'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,40 +300,43 @@ class FileEngineTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function testRemoveWindowsSlashesFromCache() {
|
function testRemoveWindowsSlashesFromCache() {
|
||||||
Cache::config('default', array('engine' => 'File', 'isWindows' => true, 'prefix' => null, 'path' => TMP));
|
Cache::config('windows_test', array('engine' => 'File', 'isWindows' => true, 'prefix' => null, 'path' => TMP));
|
||||||
|
|
||||||
$expected = array (
|
$expected = array (
|
||||||
'C:\dev\prj2\sites\cake\libs' => array(
|
'C:\dev\prj2\sites\cake\libs' => array(
|
||||||
0 => 'C:\dev\prj2\sites\cake\libs', 1 => 'C:\dev\prj2\sites\cake\libs\view',
|
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',
|
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',
|
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',
|
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',
|
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',
|
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',
|
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',
|
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',
|
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',
|
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',
|
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'),
|
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(
|
'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',
|
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',
|
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',
|
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'),
|
6 => 'C:\dev\prj2\sites\main_site\vendors\css'),
|
||||||
'C:\dev\prj2\sites\vendors' => array(
|
'C:\dev\prj2\sites\vendors' => array(
|
||||||
0 => 'C:\dev\prj2\sites\vendors', 1 => 'C:\dev\prj2\sites\vendors\simpletest',
|
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',
|
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',
|
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',
|
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'),
|
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(
|
'C:\dev\prj2\sites\main_site\views\helpers' => array(
|
||||||
0 => 'C:\dev\prj2\sites\main_site\views\helpers'));
|
0 => 'C:\dev\prj2\sites\main_site\views\helpers')
|
||||||
|
);
|
||||||
|
|
||||||
$data = Cache::write('test_dir_map', $expected);
|
Cache::write('test_dir_map', $expected, 'windows_test');
|
||||||
$data = Cache::read('test_dir_map');
|
$data = Cache::read('test_dir_map', 'windows_test');
|
||||||
Cache::delete('test_dir_map');
|
Cache::delete('test_dir_map', 'windows_test');
|
||||||
$this->assertEqual($expected, $data);
|
$this->assertEqual($expected, $data);
|
||||||
|
|
||||||
|
Cache::drop('windows_test');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue