mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Split up tests.
Fix API usage in tests.
This commit is contained in:
parent
cbd6cafed7
commit
0faaedfff5
1 changed files with 24 additions and 36 deletions
|
@ -291,15 +291,14 @@ class CacheHelperTest extends CakeTestCase {
|
|||
*/
|
||||
public function testCacheViewVars() {
|
||||
$this->Controller->cache_parsing();
|
||||
$this->Controller->params = array(
|
||||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
);
|
||||
));
|
||||
$this->Controller->request->here = '/cacheTest/cache_parsing';
|
||||
$this->Controller->cacheAction = 21600;
|
||||
$this->Controller->here = '/cacheTest/cache_parsing';
|
||||
$this->Controller->action = 'cache_parsing';
|
||||
|
||||
$View = new View($this->Controller);
|
||||
$result = $View->render('index');
|
||||
|
@ -323,21 +322,20 @@ class CacheHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCacheCallbacks() {
|
||||
$this->Controller->cache_parsing();
|
||||
$this->Controller->params = array(
|
||||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
);
|
||||
));
|
||||
$this->Controller->cacheAction = array(
|
||||
'cache_parsing' => array(
|
||||
'duration' => 21600,
|
||||
'callbacks' => true
|
||||
)
|
||||
);
|
||||
$this->Controller->here = '/cacheTest/cache_parsing';
|
||||
$this->Controller->action = 'cache_parsing';
|
||||
$this->Controller->request->here = '/cacheTest/cache_parsing';
|
||||
$this->Controller->cache_parsing();
|
||||
|
||||
$View = new View($this->Controller);
|
||||
$result = $View->render('index');
|
||||
|
@ -358,18 +356,18 @@ class CacheHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCacheActionArray() {
|
||||
$this->Controller->cache_parsing();
|
||||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
));
|
||||
$this->Controller->request->here = '/cache_test/cache_parsing';
|
||||
$this->Controller->cacheAction = array(
|
||||
'cache_parsing' => 21600
|
||||
);
|
||||
$this->Controller->request->here = '/cache_test/cache_parsing';
|
||||
$this->Controller->action = 'cache_parsing';
|
||||
|
||||
$this->Controller->cache_parsing();
|
||||
|
||||
$View = new View($this->Controller);
|
||||
$result = $View->render('index');
|
||||
|
@ -380,13 +378,25 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$filename = CACHE . 'views' . DS . 'cache_test_cache_parsing.php';
|
||||
$this->assertTrue(file_exists($filename));
|
||||
@unlink($filename);
|
||||
}
|
||||
|
||||
$this->Controller->cache_parsing();
|
||||
/**
|
||||
* Test that cacheAction works with camelcased controller names.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCacheActionArrayCamelCase() {
|
||||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
));
|
||||
$this->Controller->cacheAction = array(
|
||||
'cache_parsing' => 21600
|
||||
);
|
||||
$this->Controller->request->here = '/cacheTest/cache_parsing';
|
||||
$this->Controller->action = 'cache_parsing';
|
||||
$this->Controller->cache_parsing();
|
||||
|
||||
$View = new View($this->Controller);
|
||||
$result = $View->render('index');
|
||||
|
@ -397,28 +407,6 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php';
|
||||
$this->assertTrue(file_exists($filename));
|
||||
@unlink($filename);
|
||||
|
||||
$this->Controller->cache_parsing();
|
||||
$this->Controller->request->addParams(array(
|
||||
'controller' => 'cache_test',
|
||||
'action' => 'cache_parsing',
|
||||
'pass' => array(),
|
||||
'named' => array()
|
||||
));
|
||||
$this->Controller->cacheAction = array(
|
||||
'some_other_action' => 21600
|
||||
);
|
||||
$this->Controller->request->here = '/cacheTest/cache_parsing';
|
||||
$this->Controller->action = 'cache_parsing';
|
||||
|
||||
$View = new View($this->Controller);
|
||||
$result = $View->render('index');
|
||||
|
||||
$this->assertNotRegExp('/cake:nocache/', $result);
|
||||
$this->assertNotRegExp('/php echo/', $result);
|
||||
|
||||
$filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php';
|
||||
$this->assertFalse(file_exists($filename));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue