Skip to content
Permalink
Browse files

Split up tests.

Fix API usage in tests.
  • Loading branch information...
markstory committed May 15, 2012
1 parent cbd6caf commit 0faaedfff5c542909b58fbe55c78b83c29f4596b
Showing with 20 additions and 32 deletions.
  1. +20 −32 lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
@@ -291,15 +291,14 @@ public function testComplexNoCache() {
*/
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 @@ public function testCacheViewVars() {
* @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,58 +356,47 @@ public function testCacheCallbacks() {
* @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';
$View = new View($this->Controller);
$result = $View->render('index');
$this->assertNotRegExp('/cake:nocache/', $result);
$this->assertNotRegExp('/php echo/', $result);
$filename = CACHE . 'views' . DS . 'cache_test_cache_parsing.php';
$this->assertTrue(file_exists($filename));
@unlink($filename);
$this->Controller->cache_parsing();
$this->Controller->cacheAction = array(
'cache_parsing' => 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';
$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(
'some_other_action' => 21600
'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');
@@ -418,7 +405,8 @@ public function testCacheActionArray() {
$this->assertNotRegExp('/php echo/', $result);
$filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php';
$this->assertFalse(file_exists($filename));
$this->assertTrue(file_exists($filename));
@unlink($filename);
}
/**

0 comments on commit 0faaedf

Please sign in to comment.
You can’t perform that action at this time.