diff --git a/e107_handlers/cache_handler.php b/e107_handlers/cache_handler.php index 9fc38c77e..580fda319 100644 --- a/e107_handlers/cache_handler.php +++ b/e107_handlers/cache_handler.php @@ -32,6 +32,7 @@ class ecache { public $UserCacheActive; // Checkable flag - TRUE if user cache enabled public $SystemCacheActive; // Checkable flag - TRUE if system cache enabled private $lastError; + private $lastFile; const CACHE_PREFIX = ''; @@ -119,6 +120,7 @@ class ecache { $fname = e_CACHE_CONTENT.$q.$CheckTag.'.cache.php'; //echo "cache f_name = $fname
"; + $this->lastFile = $fname; return $fname; } @@ -187,6 +189,15 @@ class ecache { return $this->lastError; } + /** + * Return the last error encountered during cache processing. + * @return mixed + */ + public function getLastFile() + { + return $this->lastFile; + } + /** * @return string * @param string $CacheTag diff --git a/e107_tests/tests/unit/ecacheTest.php b/e107_tests/tests/unit/ecacheTest.php index 9bb9caf82..e93f1ba42 100644 --- a/e107_tests/tests/unit/ecacheTest.php +++ b/e107_tests/tests/unit/ecacheTest.php @@ -107,12 +107,25 @@ class ecacheTest extends \Codeception\Test\Unit { } - +*/ public function testClear() { + $cacheName = 'testClearCache'; + $this->cache->set($cacheName, "something", true); + $file = $this->cache->getLastFile(); + + // check it has been created. + $exists = file_exists($file); + $this->assertTrue($exists); + + // check it has been deleted. + $this->cache->clear($cacheName); + $exists = file_exists($file); + $this->assertFalse($exists); + } - +/* public function testDelete() {