Commit 9f45ef24 authored by Fabien Potencier's avatar Fabien Potencier

feature #824 Default HttpCache debug option to that of the main container (davedevelopment)

This PR was merged into the master branch.

Discussion
----------

Default HttpCache debug option to that of the main container

Commits
-------

9cd048c7 Default HttpCache debug option to that of
parents 87e0a836 9cd048c7
......@@ -28,6 +28,12 @@ class HttpCacheServiceProvider implements ServiceProviderInterface
public function register(Application $app)
{
$app['http_cache'] = $app->share(function ($app) {
$app['http_cache.options'] = array_replace(
array(
'debug' => $app['debug'],
), $app['http_cache.options']
);
return new HttpCache($app, $app['http_cache.store'], $app['http_cache.esi'], $app['http_cache.options']);
});
......
......@@ -57,6 +57,19 @@ class HttpCacheServiceProviderTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($finished);
}
public function testDebugDefaultsToThatOfApp()
{
$app = new Application();
$app->register(new HttpCacheServiceProvider(), array(
'http_cache.cache_dir' => sys_get_temp_dir().'/silex_http_cache_'.uniqid(),
));
$app['debug'] = true;
$app['http_cache'];
$this->assertTrue($app['http_cache.options']['debug']);
}
}
class UnsendableResponse extends Response
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment