/** * Generates a metadatas-free version of the file in the temporary directory * * @return string the path file to the temporary file */ private function getTemporaryEmptyFile() { $tmpFile = tempnam(sys_get_temp_dir(), 'hash'); unlink($tmpFile); try { $this->writer->reset(); $this->writer->erase(true); $this->writer->write($this->file->getPathname(), new MetadataBag(), $tmpFile); } catch (PHPExiftoolExceptionInterface $e) { /** * Some files can not be written by exiftool */ copy($this->file->getPathname(), $tmpFile); } $this->temporaryFiles[] = $tmpFile; return $tmpFile; }
/** * @covers PHPExiftool\Writer::write * @covers PHPExiftool\Exception\InvalidArgumentException * @expectedException PHPExiftool\Exception\InvalidArgumentException */ public function testWriteFail() { $this->object->write('ici', new Driver\Metadata\MetadataBag()); }