/** * Test hasKey method */ public function testHasKey() { $this->setDir(); $this->getDir(); $this->directoryMock->freeze(); $this->filemanagerMock->fileExists($this->getCachedFilePath())->once()->andReturn(true); $this->filemanagerMock->freeze(); $fileCache = new FileCache(self::PATH, $this->filemanagerMock); $this->assertTrue($fileCache->hasKey(self::KEY)); $this->directoryMock->assertExpectations(); $this->filemanagerMock->assertExpectations(); }
/** * Test load method correctly */ public function testLoadObject() { $fileCache = new FileCache($this->getTempPath(), $this->filemanager); $object = new TestClass('value'); $object->publicParam = 'public'; $fileCache->save(self::KEY, $object); $this->assertEquals($object, $fileCache->load(self::KEY)); $object->setPrivateParam('new value'); $this->assertNotEquals($object, $fileCache->load(self::KEY)); }
/** * Test load method correctly by file cache */ public function testLoadFileCache() { $this->fileCache->save(self::KEY, self::VALUE); $this->assertSame(self::VALUE, $this->smartCache->load(self::KEY)); }