Example #1
0
 /**
  * @covers has
  */
 public function testFileCache()
 {
     $cache = new FileSystemCache(['cache_dir' => sys_get_temp_dir()]);
     $cache->set('a', 'foobar');
     $this->assertEquals(true, $cache->has('a'));
     $cache->remove('a');
     $this->assertEquals(false, $cache->has('a'));
 }
Example #2
0
 public function testIssue()
 {
     $cache = new FileSystemCache($this->cacheDir);
     $cache->set('foo', 'bar');
     $this->assertFileExists($this->cacheDir . '/foo.cache');
     // put something in the cache folder
     file_put_contents($this->cacheDir . '/something.txt', 'dummy contents');
     $cache->clean();
     // the cache file was removed by clean()
     $this->assertFileNotExists($this->cacheDir . '/foo.cache');
     // the file is not deleted by clean()
     $this->assertFileExists($this->cacheDir . '/something.txt');
 }