tweaked previous commit

This commit is contained in:
Fabien Potencier 2011-06-07 11:48:08 +02:00
parent 96fc666454
commit a17478ff74
3 changed files with 8 additions and 6 deletions

View File

@ -9,6 +9,8 @@ timeline closely anyway.
beta4 to beta5
--------------
* All settings regarding the cache warmers have been removed.
* `Response::isRedirected()` has been merged with `Response::isRedirect()`
beta3 to beta4

View File

@ -28,12 +28,12 @@ class TemplateLocator implements FileLocatorInterface
/**
* Constructor.
*
* @param string $cacheDir The cache path
* @param FileLocatorInterface $locator A FileLocatorInterface instance
* @param string $cacheDir The cache path
*/
public function __construct($cacheDir, FileLocatorInterface $locator)
public function __construct(FileLocatorInterface $locator, $cacheDir = null)
{
if (file_exists($cache = $cacheDir.'/templates.php')) {
if (null !== $cacheDir && file_exists($cache = $cacheDir.'/templates.php')) {
$this->cache = require $cache;
}

View File

@ -30,7 +30,7 @@ class TemplateLocatorTest extends TestCase
->will($this->returnValue('/path/to/template'))
;
$locator = new TemplateLocator('', $fileLocator);
$locator = new TemplateLocator($fileLocator);
$this->assertEquals('/path/to/template', $locator->locate($template));
}
@ -50,7 +50,7 @@ class TemplateLocatorTest extends TestCase
->will($this->throwException(new \InvalidArgumentException()))
;
$locator = new TemplateLocator('', $fileLocator);
$locator = new TemplateLocator($fileLocator);
$locator->locate($template);
}
@ -60,7 +60,7 @@ class TemplateLocatorTest extends TestCase
*/
public function testThrowsAnExceptionWhenTemplateIsNotATemplateReferenceInterface()
{
$locator = new TemplateLocator('', $this->getFileLocator());
$locator = new TemplateLocator($this->getFileLocator());
$locator->locate('template');
}