Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
16872871
Commit
16872871
authored
May 12, 2012
by
Igor Wiedler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call terminate() after sending the response in HttpCache
parent
5f7b6505
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
1 deletion
+71
-1
src/Silex/HttpCache.php
src/Silex/HttpCache.php
+3
-1
tests/Silex/Tests/Provider/HttpCacheServiceProviderTest.php
tests/Silex/Tests/Provider/HttpCacheServiceProviderTest.php
+68
-0
No files found.
src/Silex/HttpCache.php
View file @
16872871
...
...
@@ -32,6 +32,8 @@ class HttpCache extends BaseHttpCache
$request
=
Request
::
createFromGlobals
();
}
$this
->
handle
(
$request
)
->
send
();
$response
=
$this
->
handle
(
$request
);
$response
->
send
();
$this
->
terminate
(
$request
,
$response
);
}
}
tests/Silex/Tests/Provider/HttpCacheServiceProviderTest.php
0 → 100644
View file @
16872871
<?php
/*
* This file is part of the Silex framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace
Silex\Tests\Provider
;
use
Silex\Application
;
use
Silex\Provider\HttpCacheServiceProvider
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
/**
* HttpCacheProvider test cases.
*
* @author Igor Wiedler <igor@wiedler.ch>
*/
class
HttpCacheServiceProviderTest
extends
\PHPUnit_Framework_TestCase
{
public
function
testRegister
()
{
$app
=
new
Application
();
$app
->
register
(
new
HttpCacheServiceProvider
(),
array
(
'http_cache.cache_dir'
=>
sys_get_temp_dir
()
.
'/silex_http_cache_'
.
uniqid
(),
));
$this
->
assertInstanceOf
(
'Silex\HttpCache'
,
$app
[
'http_cache'
]);
return
$app
;
}
/**
* @depends testRegister
*/
public
function
testRunCallsShutdown
(
$app
)
{
$finished
=
false
;
$app
->
get
(
'/'
,
function
()
use
(
$app
,
&
$finished
)
{
$app
->
finish
(
function
()
use
(
&
$finished
)
{
$finished
=
true
;
});
return
new
UnsendableResponse
(
'will do something after finish'
);
});
$request
=
Request
::
create
(
'/'
);
$app
[
'http_cache'
]
->
run
(
$request
);
$this
->
assertTrue
(
$finished
);
}
}
class
UnsendableResponse
extends
Response
{
public
function
send
()
{
// do nothing
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment