/** * 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 key not found exception */ public function testLoadKeyNotFound() { $this->setDir(); $this->getDir(); $this->directoryMock->freeze(); $this->filemanagerMock->fileExists($this->getCachedFilePath())->once()->andReturn(false); $this->filemanagerMock->freeze(); $fileCache = new FileCache(self::PATH, $this->filemanagerMock); $this->setExpectedException('Hadamcik\\SmartCache\\KeyNotFoundException'); $fileCache->load(self::KEY); }