aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/CacheTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/CacheTest.php')
-rw-r--r--tests/CacheTest.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/CacheTest.php b/tests/CacheTest.php
index aa5395b0..26c43225 100644
--- a/tests/CacheTest.php
+++ b/tests/CacheTest.php
@@ -11,10 +11,10 @@ require_once 'application/Cache.php';
11/** 11/**
12 * Unitary tests for cached pages 12 * Unitary tests for cached pages
13 */ 13 */
14class CachedTest extends PHPUnit_Framework_TestCase 14class CacheTest extends PHPUnit_Framework_TestCase
15{ 15{
16 // test cache directory 16 // test cache directory
17 protected static $testCacheDir = 'tests/dummycache'; 17 protected static $testCacheDir = 'sandbox/dummycache';
18 18
19 // dummy cached file names / content 19 // dummy cached file names / content
20 protected static $pages = array('a', 'toto', 'd7b59c'); 20 protected static $pages = array('a', 'toto', 'd7b59c');
@@ -30,7 +30,7 @@ class CachedTest extends PHPUnit_Framework_TestCase
30 } else { 30 } else {
31 array_map('unlink', glob(self::$testCacheDir.'/*')); 31 array_map('unlink', glob(self::$testCacheDir.'/*'));
32 } 32 }
33 33
34 foreach (self::$pages as $page) { 34 foreach (self::$pages as $page) {
35 file_put_contents(self::$testCacheDir.'/'.$page.'.cache', $page); 35 file_put_contents(self::$testCacheDir.'/'.$page.'.cache', $page);
36 } 36 }
@@ -38,6 +38,15 @@ class CachedTest extends PHPUnit_Framework_TestCase
38 } 38 }
39 39
40 /** 40 /**
41 * Remove dummycache folder after each tests.
42 */
43 public function tearDown()
44 {
45 array_map('unlink', glob(self::$testCacheDir.'/*'));
46 rmdir(self::$testCacheDir);
47 }
48
49 /**
41 * Purge cached pages 50 * Purge cached pages
42 */ 51 */
43 public function testPurgeCachedPages() 52 public function testPurgeCachedPages()
@@ -56,7 +65,7 @@ class CachedTest extends PHPUnit_Framework_TestCase
56 public function testPurgeCachedPagesMissingDir() 65 public function testPurgeCachedPagesMissingDir()
57 { 66 {
58 $this->assertEquals( 67 $this->assertEquals(
59 'Cannot purge tests/dummycache_missing: no directory', 68 'Cannot purge sandbox/dummycache_missing: no directory',
60 purgeCachedPages(self::$testCacheDir.'_missing') 69 purgeCachedPages(self::$testCacheDir.'_missing')
61 ); 70 );
62 } 71 }