From 28f4cb749ebdfeaf5f6f95233832c507450c0cd5 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 14 Dec 2010 11:50:47 +0100 Subject: [PATCH] tweaked last commit --- lib/Twig/Environment.php | 5 +---- test/Twig/Tests/FileCachingTest.php | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index 97e1f1b..96af3ff 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -232,19 +232,16 @@ class Twig_Environment /** * Clears the template cache files on the filesystem. - * - * @return boolean success */ public function clearCacheFiles() { if ($this->cache) { foreach(new DirectoryIterator($this->cache) as $fileInfo) { - if (strpos($fileInfo->getFilename(), $this->templateClassPrefix) === 0) { + if (0 === strpos($fileInfo->getFilename(), $this->templateClassPrefix)) { @unlink($fileInfo->getPathname()); } } } - return true; } public function getLexer() diff --git a/test/Twig/Tests/FileCachingTest.php b/test/Twig/Tests/FileCachingTest.php index f7f5993..dd4a892 100644 --- a/test/Twig/Tests/FileCachingTest.php +++ b/test/Twig/Tests/FileCachingTest.php @@ -33,7 +33,7 @@ class Twig_Tests_FileCachingTest extends PHPUnit_Framework_TestCase $cacheFileName = $this->env->getCacheFilename($name); $this->assertTrue(file_exists($cacheFileName), 'Cache file does not exist.'); - $this->assertTrue($this->env->clearCacheFiles()); + $this->env->clearCacheFiles(); $this->assertFalse(file_exists($cacheFileName), 'Cache file was not cleared.'); } -- 1.7.2.5