PHPExiftool\Test\AbstractWriterTest::testEraseWithICC PHP Метод

testEraseWithICC() публичный Метод

public testEraseWithICC ( )
    public function testEraseWithICC()
    {
        $uniqueId = 'UNI-QUE-ID';
        $metadatas = new Driver\Metadata\MetadataBag();
        $metadatas->add(new Driver\Metadata\Metadata(new Driver\Tag\IPTC\UniqueDocumentID(), new Driver\Value\Mono($uniqueId)));
        $metadatas->add(new Driver\Metadata\Metadata(new Driver\Tag\XMPExif\ImageUniqueID(), new Driver\Value\Mono($uniqueId)));
        $this->object->erase(true, true);
        $changedFiles = $this->object->write($this->inWithICC, $metadatas, $this->out);
        $this->assertEquals(1, $changedFiles);
        $reader = new Reader($this->getExiftool(), new RDFParser());
        $this->assertGreaterThan(200, count($reader->files($this->in)->first()->getMetadatas()));
        $reader = new Reader($this->getExiftool(), new RDFParser());
        $this->assertGreaterThan(4, count($reader->files($this->out)->first()->getMetadatas()));
        $acceptedMetas = array('Exiftool:\\w+', 'System:\\w+', 'File:\\w+', 'Composite:\\w+', 'IPTC:CodedCharacterSet', 'ICC-header:\\w+', 'IPTC:EnvelopeRecordVersion', 'IPTC:UniqueDocumentID', 'IPTC:ApplicationRecordVersion', 'Photoshop:IPTCDigest', 'XMP-x:XMPToolkit', 'XMP-exif:ImageUniqueID', 'Adobe:DCTEncodeVersion', 'Adobe:APP14Flags0', 'Adobe:APP14Flags1', 'Adobe:ColorTransform');
        foreach ($reader->files($this->out)->first()->getMetadatas() as $meta) {
            $found = false;
            foreach ($acceptedMetas as $accepted) {
                if (preg_match('/' . $accepted . '/i', $meta->getTag()->getTagname())) {
                    $found = true;
                    break;
                }
            }
            if (!$found) {
                $this->fail(sprintf('Unexpected meta %s found', $meta->getTag()->getTagname()));
            }
        }
    }