diff --git a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php index cce3ca21b..f6e04b6a4 100644 --- a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php @@ -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)); } /**