/**
* Unitary tests for cached pages
*/
-class CachedTest extends PHPUnit_Framework_TestCase
+class CacheTest extends PHPUnit_Framework_TestCase
{
// test cache directory
- protected static $testCacheDir = 'tests/dummycache';
+ protected static $testCacheDir = 'sandbox/dummycache';
// dummy cached file names / content
protected static $pages = array('a', 'toto', 'd7b59c');
} else {
array_map('unlink', glob(self::$testCacheDir.'/*'));
}
-
+
foreach (self::$pages as $page) {
file_put_contents(self::$testCacheDir.'/'.$page.'.cache', $page);
}
file_put_contents(self::$testCacheDir.'/intru.der', 'ShouldNotBeThere');
}
+ /**
+ * Remove dummycache folder after each tests.
+ */
+ public function tearDown()
+ {
+ array_map('unlink', glob(self::$testCacheDir.'/*'));
+ rmdir(self::$testCacheDir);
+ }
+
/**
* Purge cached pages
*/
*/
public function testPurgeCachedPagesMissingDir()
{
+ $oldlog = ini_get('error_log');
+ ini_set('error_log', '/dev/null');
$this->assertEquals(
- 'Cannot purge tests/dummycache_missing: no directory',
+ 'Cannot purge sandbox/dummycache_missing: no directory',
purgeCachedPages(self::$testCacheDir.'_missing')
);
+ ini_set('error_log', $oldlog);
}
/**