diff options
Diffstat (limited to 'tests/CacheTest.php')
-rw-r--r-- | tests/CacheTest.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/CacheTest.php b/tests/CacheTest.php index 4caf6552..aa5395b0 100644 --- a/tests/CacheTest.php +++ b/tests/CacheTest.php | |||
@@ -27,11 +27,14 @@ class CachedTest extends PHPUnit_Framework_TestCase | |||
27 | { | 27 | { |
28 | if (! is_dir(self::$testCacheDir)) { | 28 | if (! is_dir(self::$testCacheDir)) { |
29 | mkdir(self::$testCacheDir); | 29 | mkdir(self::$testCacheDir); |
30 | } else { | ||
31 | array_map('unlink', glob(self::$testCacheDir.'/*')); | ||
30 | } | 32 | } |
31 | 33 | ||
32 | foreach (self::$pages as $page) { | 34 | foreach (self::$pages as $page) { |
33 | file_put_contents(self::$testCacheDir.'/'.$page.'.cache', $page); | 35 | file_put_contents(self::$testCacheDir.'/'.$page.'.cache', $page); |
34 | } | 36 | } |
37 | file_put_contents(self::$testCacheDir.'/intru.der', 'ShouldNotBeThere'); | ||
35 | } | 38 | } |
36 | 39 | ||
37 | /** | 40 | /** |
@@ -42,7 +45,20 @@ class CachedTest extends PHPUnit_Framework_TestCase | |||
42 | purgeCachedPages(self::$testCacheDir); | 45 | purgeCachedPages(self::$testCacheDir); |
43 | foreach (self::$pages as $page) { | 46 | foreach (self::$pages as $page) { |
44 | $this->assertFileNotExists(self::$testCacheDir.'/'.$page.'.cache'); | 47 | $this->assertFileNotExists(self::$testCacheDir.'/'.$page.'.cache'); |
45 | } | 48 | } |
49 | |||
50 | $this->assertFileExists(self::$testCacheDir.'/intru.der'); | ||
51 | } | ||
52 | |||
53 | /** | ||
54 | * Purge cached pages - missing directory | ||
55 | */ | ||
56 | public function testPurgeCachedPagesMissingDir() | ||
57 | { | ||
58 | $this->assertEquals( | ||
59 | 'Cannot purge tests/dummycache_missing: no directory', | ||
60 | purgeCachedPages(self::$testCacheDir.'_missing') | ||
61 | ); | ||
46 | } | 62 | } |
47 | 63 | ||
48 | /** | 64 | /** |