mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
adding failing testcase for identical <cake:nocache> content confussion.
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7703 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
385ebbce1f
commit
3ddc5e6be2
3 changed files with 59 additions and 1 deletions
|
@ -195,6 +195,49 @@ class CacheHelperTest extends CakeTestCase {
|
|||
//$this->assertPattern('/6\. in element with no cache tags/', $contents);
|
||||
$this->assertPattern('/7\. layout after content and after element with no cache tags/', $contents);
|
||||
}
|
||||
/**
|
||||
* testCacheEmptySections method
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testCacheEmptySections () {
|
||||
$this->Controller->cache_parsing();
|
||||
$this->Controller->cacheAction = array('cacheTest' => 21600);
|
||||
$this->Controller->here = '/cacheTest/cache_empty_sections';
|
||||
$this->Controller->action = 'cache_empty_sections';
|
||||
$this->Controller->layout = 'cache_empty_sections';
|
||||
$this->Controller->viewPath = 'posts';
|
||||
|
||||
$View = new View($this->Controller);
|
||||
$result = $View->render('cache_empty_sections');
|
||||
$this->assertNoPattern('/cake:nocache/', $result);
|
||||
$this->assertNoPattern('/php echo/', $result);
|
||||
$this->assertPattern(
|
||||
'@</title>\s*</head>\s*' .
|
||||
'<body>\s*' .
|
||||
'View Content\s*' .
|
||||
'cached count is: 3\s*' .
|
||||
'</body>@', $result);
|
||||
|
||||
$filename = CACHE . 'views' . DS . 'cacheTest_cache_empty_sections.php';
|
||||
$this->assertTrue(file_exists($filename));
|
||||
$contents = file_get_contents($filename);
|
||||
$this->assertNoPattern('/cake:nocache/', $contents);
|
||||
$this->assertPattern(
|
||||
'@<head>\s*<title>Posts</title>\s*' .
|
||||
"<\?php \$x = 1; \?>\s*" .
|
||||
'</head>\s*' .
|
||||
'<body>\s*' .
|
||||
"<\?php \$x\+\+; \?>\s*" .
|
||||
"<\?php \$x\+\+; \?>\s*" .
|
||||
'View Content\s*' .
|
||||
"<\?php \$y = 1; \?>\s*" .
|
||||
"<\?php echo 'cached count is:' . \$x; \?>\s*" .
|
||||
'@', $contents);
|
||||
@unlink($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* End Case - restore view Paths
|
||||
*
|
||||
|
@ -214,5 +257,4 @@ class CacheHelperTest extends CakeTestCase {
|
|||
unset($this->Cache);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
14
cake/tests/test_app/views/layouts/cache_empty_sections.ctp
Normal file
14
cake/tests/test_app/views/layouts/cache_empty_sections.ctp
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php /* SVN FILE: $Id$ */ ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title><?php echo $title_for_layout; ?></title>
|
||||
<cake:nocache><?php $x = 1; ?></cake:nocache>
|
||||
</head>
|
||||
<body>
|
||||
<cake:nocache><?php $x++; ?></cake:nocache>
|
||||
<cake:nocache><?php $x++; ?></cake:nocache>
|
||||
<?php echo $content_for_layout; ?>
|
||||
<cake:nocache><?php echo 'cached count is: ' . $x; ?></cake:nocache>
|
||||
</body>
|
||||
</html>
|
2
cake/tests/test_app/views/posts/cache_empty_sections.ctp
Normal file
2
cake/tests/test_app/views/posts/cache_empty_sections.ctp
Normal file
|
@ -0,0 +1,2 @@
|
|||
View Content
|
||||
<cake:nocache><?php $y = 1; ?></cake:nocache>
|
Loading…
Reference in a new issue