From 01e48f269df59e02798dad4a698c125d76b0ed70 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Thu, 9 Jul 2015 22:14:39 +0200 Subject: CachedPage: move to a proper file, add tests Modifications - rename `pageCache` to `CachedPage` - move utilities to `Cache` - do not access globals - apply coding rules - update LinkDB and test code - add test coverage Signed-off-by: VirtualTam --- tests/CacheTest.php | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 tests/CacheTest.php (limited to 'tests/CacheTest.php') diff --git a/tests/CacheTest.php b/tests/CacheTest.php new file mode 100644 index 00000000..4caf6552 --- /dev/null +++ b/tests/CacheTest.php @@ -0,0 +1,63 @@ +assertFileNotExists(self::$testCacheDir.'/'.$page.'.cache'); + } + } + + /** + * Purge cached pages and session cache + */ + public function testInvalidateCaches() + { + $this->assertArrayNotHasKey('tags', $_SESSION); + $_SESSION['tags'] = array('goodbye', 'cruel', 'world'); + + invalidateCaches(self::$testCacheDir); + foreach (self::$pages as $page) { + $this->assertFileNotExists(self::$testCacheDir.'/'.$page.'.cache'); + } + + $this->assertArrayNotHasKey('tags', $_SESSION); + } +} -- cgit v1.2.3