Adding a test case for CacheHelper correctly generating filenames when $this->here includes all the named and passed args. Refs #977

This commit is contained in:
mark_story 2010-08-04 23:08:43 -04:00
parent 712ca6d5b5
commit 22673a5348

View file

@ -381,6 +381,42 @@ class CacheHelperTest extends CakeTestCase {
$this->assertFalse(file_exists($filename));
}
/**
* test with named and pass args.
*
* @return void
*/
function testCacheWithNamedAndPassedArgs() {
Router::reload();
$this->Controller->cache_parsing();
$this->Controller->params = array(
'controller' => 'cache_test',
'action' => 'cache_parsing',
'url' => array(),
'pass' => array(1, 2),
'named' => array(
'name' => 'mark',
'ice' => 'cream'
)
);
$this->Controller->cacheAction = array(
'cache_parsing' => 21600
);
$this->Controller->here = '/cache_test/cache_parsing/1/2/name:mark/ice:cream';
$this->Controller->action = 'cache_parsing';
$View = new View($this->Controller);
$result = $View->render('index');
$this->assertNoPattern('/cake:nocache/', $result);
$this->assertNoPattern('/php echo/', $result);
$filename = CACHE . 'views' . DS . 'cache_test_cache_parsing_1_2_name_mark_ice_cream.php';
$this->assertTrue(file_exists($filename));
@unlink($filename);
}
/**
* test that custom routes are respected when generating cache files.
*