1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 14:17:49 +02:00

Cache clear test.

This commit is contained in:
Cameron
2020-12-28 10:56:21 -08:00
parent 7d04bc5c6a
commit 8048744de7
2 changed files with 26 additions and 2 deletions

View File

@@ -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 = '<?php exit; ?>';
@@ -119,6 +120,7 @@ class ecache {
$fname = e_CACHE_CONTENT.$q.$CheckTag.'.cache.php';
//echo "cache f_name = $fname <br />";
$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

View File

@@ -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()
{