mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +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() {
|
public function testCacheViewVars() {
|
||||||
$this->Controller->cache_parsing();
|
$this->Controller->cache_parsing();
|
||||||
$this->Controller->params = array(
|
$this->Controller->request->addParams(array(
|
||||||
'controller' => 'cache_test',
|
'controller' => 'cache_test',
|
||||||
'action' => 'cache_parsing',
|
'action' => 'cache_parsing',
|
||||||
'pass' => array(),
|
'pass' => array(),
|
||||||
'named' => array()
|
'named' => array()
|
||||||
);
|
));
|
||||||
|
$this->Controller->request->here = '/cacheTest/cache_parsing';
|
||||||
$this->Controller->cacheAction = 21600;
|
$this->Controller->cacheAction = 21600;
|
||||||
$this->Controller->here = '/cacheTest/cache_parsing';
|
|
||||||
$this->Controller->action = 'cache_parsing';
|
|
||||||
|
|
||||||
$View = new View($this->Controller);
|
$View = new View($this->Controller);
|
||||||
$result = $View->render('index');
|
$result = $View->render('index');
|
||||||
|
@ -323,21 +322,20 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testCacheCallbacks() {
|
public function testCacheCallbacks() {
|
||||||
$this->Controller->cache_parsing();
|
$this->Controller->request->addParams(array(
|
||||||
$this->Controller->params = array(
|
|
||||||
'controller' => 'cache_test',
|
'controller' => 'cache_test',
|
||||||
'action' => 'cache_parsing',
|
'action' => 'cache_parsing',
|
||||||
'pass' => array(),
|
'pass' => array(),
|
||||||
'named' => array()
|
'named' => array()
|
||||||
);
|
));
|
||||||
$this->Controller->cacheAction = array(
|
$this->Controller->cacheAction = array(
|
||||||
'cache_parsing' => array(
|
'cache_parsing' => array(
|
||||||
'duration' => 21600,
|
'duration' => 21600,
|
||||||
'callbacks' => true
|
'callbacks' => true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->Controller->here = '/cacheTest/cache_parsing';
|
$this->Controller->request->here = '/cacheTest/cache_parsing';
|
||||||
$this->Controller->action = 'cache_parsing';
|
$this->Controller->cache_parsing();
|
||||||
|
|
||||||
$View = new View($this->Controller);
|
$View = new View($this->Controller);
|
||||||
$result = $View->render('index');
|
$result = $View->render('index');
|
||||||
|
@ -358,18 +356,18 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testCacheActionArray() {
|
public function testCacheActionArray() {
|
||||||
$this->Controller->cache_parsing();
|
|
||||||
$this->Controller->request->addParams(array(
|
$this->Controller->request->addParams(array(
|
||||||
'controller' => 'cache_test',
|
'controller' => 'cache_test',
|
||||||
'action' => 'cache_parsing',
|
'action' => 'cache_parsing',
|
||||||
'pass' => array(),
|
'pass' => array(),
|
||||||
'named' => array()
|
'named' => array()
|
||||||
));
|
));
|
||||||
|
$this->Controller->request->here = '/cache_test/cache_parsing';
|
||||||
$this->Controller->cacheAction = array(
|
$this->Controller->cacheAction = array(
|
||||||
'cache_parsing' => 21600
|
'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);
|
$View = new View($this->Controller);
|
||||||
$result = $View->render('index');
|
$result = $View->render('index');
|
||||||
|
@ -380,13 +378,25 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
$filename = CACHE . 'views' . DS . 'cache_test_cache_parsing.php';
|
$filename = CACHE . 'views' . DS . 'cache_test_cache_parsing.php';
|
||||||
$this->assertTrue(file_exists($filename));
|
$this->assertTrue(file_exists($filename));
|
||||||
@unlink($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(
|
$this->Controller->cacheAction = array(
|
||||||
'cache_parsing' => 21600
|
'cache_parsing' => 21600
|
||||||
);
|
);
|
||||||
$this->Controller->request->here = '/cacheTest/cache_parsing';
|
$this->Controller->request->here = '/cacheTest/cache_parsing';
|
||||||
$this->Controller->action = 'cache_parsing';
|
$this->Controller->cache_parsing();
|
||||||
|
|
||||||
$View = new View($this->Controller);
|
$View = new View($this->Controller);
|
||||||
$result = $View->render('index');
|
$result = $View->render('index');
|
||||||
|
@ -397,28 +407,6 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
$filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php';
|
$filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php';
|
||||||
$this->assertTrue(file_exists($filename));
|
$this->assertTrue(file_exists($filename));
|
||||||
@unlink($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