* @author Gilles Bourgeat */ class CacheTest extends \PHPUnit_Framework_TestCase { protected $dir; protected $dir2; public function setUp() { $this->dir = __DIR__ . '/test'; $this->dir2 = __DIR__ . '/test2'; $fs = new Filesystem(); $fs->mkdir($this->dir); $fs->mkdir($this->dir2); } public function testCacheClear() { $event = new CacheEvent($this->dir, false); $adapter = new ArrayAdapter(); $action = new Cache($adapter); $action->cacheClear($event); $fs = new Filesystem(); $this->assertFalse($fs->exists($this->dir)); } public function testKernelTerminateCacheClear() { $event = new CacheEvent($this->dir2); $adapter = new ArrayAdapter(); $action = new Cache($adapter); $action->cacheClear($event); $fs = new Filesystem(); $this->assertTrue($fs->exists($this->dir2)); $action->onTerminate(); $this->assertFalse($fs->exists($this->dir2)); } }