-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for the ability to not only cache HTTP 200 and GET method
- Loading branch information
Showing
13 changed files
with
418 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the symfony package. | ||
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
$app = 'cache203'; | ||
$successStatusCode = 203; | ||
|
||
include __DIR__.'/cacheTest.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the symfony package. | ||
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
$app = 'cache'; | ||
$debug = false; | ||
|
||
if (!include __DIR__.'/../bootstrap/functional.php') | ||
{ | ||
return; | ||
} | ||
|
||
$b = new sfTestBrowser(); | ||
|
||
// Test for 404 support | ||
$b-> | ||
get('/cache/error404')-> | ||
with('request')->begin()-> | ||
isParameter('module', 'cache')-> | ||
isParameter('action', 'error404')-> | ||
end()-> | ||
with('response')->begin()-> | ||
isStatusCode(404)-> | ||
checkElement('body', '/Error 404/')-> | ||
end()-> | ||
with('view_cache')->begin()-> | ||
isCached(true, true)-> | ||
end()-> | ||
|
||
setHttpHeader('If-Modified-Since', $b->getResponse()->getHttpHeader('Last-Modified'))-> | ||
|
||
get('/cache/error404')-> | ||
with('response')->begin()-> | ||
isStatusCode(304)-> | ||
matches('/^$/')-> // Response content is empty. | ||
end() | ||
; | ||
|
||
// Test for 404 support without layout | ||
$b-> | ||
restart()-> | ||
get('/cache/error404WithoutLayout')-> | ||
with('request')->begin()-> | ||
isParameter('module', 'cache')-> | ||
isParameter('action', 'error404WithoutLayout')-> | ||
end()-> | ||
with('response')->begin()-> | ||
isStatusCode(404)-> | ||
checkElement('body', '/Error 404/')-> | ||
end()-> | ||
with('view_cache')->begin()-> | ||
isCached(true)-> | ||
end()-> | ||
|
||
setHttpHeader('If-Modified-Since', $b->getResponse()->getHttpHeader('Last-Modified'))-> | ||
|
||
get('/cache/error404WithoutLayout')-> | ||
with('response')->begin()-> | ||
isStatusCode(404)-> | ||
checkElement('body', '/Error 404/')-> | ||
end() | ||
; |
Oops, something went wrong.