/** * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException */ public function testLoadNotFound() { $statement = $this->createDbalStatementMock(); $statement->expects($this->once())->method('rowCount')->will($this->returnValue(0)); $this->dbalMock->expects($this->once())->method('prepare')->with($this->anything())->will($this->returnValue($statement)); $this->handler->load('prefix/my/file.png'); }
public function loadBinaryFile($binaryFileId) { $this->checkBinaryFileId($binaryFileId); // @todo An absolute path can in no case be loaded, but throwing an exception is too much (why ?) if ($this->isAbsolutePath($binaryFileId)) { return false; } $spiBinaryFile = $this->metadataHandler->load($this->getPrefixedUri($binaryFileId)); if (!isset($spiBinaryFile->uri)) { $spiBinaryFile->uri = $this->binarydataHandler->getUri($spiBinaryFile->id); } return $this->buildDomainBinaryFileObject($spiBinaryFile); }
/** * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException */ public function testLoadNotFound() { $this->filesystem->expects($this->once())->method('getMetadata')->with('prefix/my/file.png')->will($this->throwException(new FileNotFoundException('prefix/my/file.png'))); $this->handler->load('prefix/my/file.png'); }