diff --git a/tests/PHPExif/Adapter/AdapterAbstractTest.php b/tests/PHPExif/Adapter/AdapterAbstractTest.php index 1be8b4c..8d03417 100644 --- a/tests/PHPExif/Adapter/AdapterAbstractTest.php +++ b/tests/PHPExif/Adapter/AdapterAbstractTest.php @@ -39,7 +39,6 @@ public function testSetOptionsCorrectlySetsProperties() foreach ($expected as $key => $value) { $reflProp = new \ReflectionProperty(Native::class, $key); - $reflProp->setAccessible(true); $this->assertEquals($value, $reflProp->getValue($this->adapter)); } } @@ -56,7 +55,6 @@ public function testSetOptionsIgnoresPropertiesWithoutSetters() foreach ($expected as $key => $value) { $reflProp = new \ReflectionProperty(Native::class, $key); - $reflProp->setAccessible(true); $this->assertNotEquals($value, $reflProp->getValue($this->adapter)); } } @@ -76,7 +74,6 @@ public function testConstructorSetsOptions() foreach ($expected as $key => $value) { $reflProp = new \ReflectionProperty(Native::class, $key); - $reflProp->setAccessible(true); $this->assertEquals($value, $reflProp->getValue($adapter)); } } @@ -100,7 +97,6 @@ public function testSetMapperCorrectlySetsInProperty() $this->adapter->setMapper($mapper); $reflProp = new \ReflectionProperty(AbstractAdapter::class, 'mapper'); - $reflProp->setAccessible(true); $this->assertSame($mapper, $reflProp->getValue($this->adapter)); } @@ -111,7 +107,6 @@ public function testGetMapperCorrectlyReturnsFromProperty() { $mapper = new \PHPExif\Mapper\Native(); $reflProp = new \ReflectionProperty(AbstractAdapter::class, 'mapper'); - $reflProp->setAccessible(true); $reflProp->setValue($this->adapter, $mapper); $this->assertSame($mapper, $this->adapter->getMapper()); } @@ -127,7 +122,6 @@ public function testGetMapperLazyLoadsMapperWhenNotPresent() ); $mapperClass = '\\PHPExif\\Mapper\\Native'; - $reflProp->setAccessible(true); $reflProp->setValue($this->adapter, $mapperClass); $this->assertInstanceOf($mapperClass, $this->adapter->getMapper()); @@ -144,14 +138,12 @@ public function testGetMapperLazyLoadingSetsInProperty() ); $mapperClass = '\\PHPExif\\Mapper\\Native'; - $reflProp->setAccessible(true); $reflProp->setValue($this->adapter, $mapperClass); $reflProp2 = new \ReflectionProperty( get_class($this->adapter), 'mapper' ); - $reflProp2->setAccessible(true); $this->adapter->getMapper(); $this->assertInstanceOf($mapperClass, $reflProp2->getValue($this->adapter)); } @@ -175,7 +167,6 @@ public function testSetHydratorCorrectlySetsInProperty() $this->adapter->setHydrator($hydrator); $reflProp = new \ReflectionProperty(AbstractAdapter::class, 'hydrator'); - $reflProp->setAccessible(true); $this->assertSame($hydrator, $reflProp->getValue($this->adapter)); } @@ -186,7 +177,6 @@ public function testGetHydratorCorrectlyReturnsFromProperty() { $hydrator = new \PHPExif\Hydrator\Mutator(); $reflProp = new \ReflectionProperty(AbstractAdapter::class, 'hydrator'); - $reflProp->setAccessible(true); $reflProp->setValue($this->adapter, $hydrator); $this->assertSame($hydrator, $this->adapter->getHydrator()); } @@ -211,7 +201,6 @@ public function testGetHydratorLazyLoadingSetsInProperty() get_class($this->adapter), 'hydrator' ); - $reflProp->setAccessible(true); $this->adapter->getHydrator(); $this->assertInstanceOf($hydratorClass, $reflProp->getValue($this->adapter)); } diff --git a/tests/PHPExif/Adapter/ExiftoolProcOpenTest.php b/tests/PHPExif/Adapter/ExiftoolProcOpenTest.php index 59d7a4e..c5cc813 100644 --- a/tests/PHPExif/Adapter/ExiftoolProcOpenTest.php +++ b/tests/PHPExif/Adapter/ExiftoolProcOpenTest.php @@ -55,7 +55,6 @@ public function testGetCliOutput() { $this->expectException(PhpExifReaderException::class); $reflMethod = new \ReflectionMethod(Exiftool::class, 'getCliOutput'); - $reflMethod->setAccessible(true); $result = $reflMethod->invoke( $this->adapter, diff --git a/tests/PHPExif/Adapter/ExiftoolTest.php b/tests/PHPExif/Adapter/ExiftoolTest.php index fa825d9..53b603b 100644 --- a/tests/PHPExif/Adapter/ExiftoolTest.php +++ b/tests/PHPExif/Adapter/ExiftoolTest.php @@ -17,7 +17,6 @@ public function setUp(): void public function testGetToolPathFromProperty() { $reflProperty = new \ReflectionProperty(Exiftool::class, 'toolPath'); - $reflProperty->setAccessible(true); $expected = '/foo/bar/baz'; $reflProperty->setValue($this->adapter, $expected); @@ -30,7 +29,6 @@ public function testGetToolPathFromProperty() public function testSetToolPathInProperty() { $reflProperty = new \ReflectionProperty(Exiftool::class, 'toolPath'); - $reflProperty->setAccessible(true); $expected = '/tmp'; $this->adapter->setToolPath($expected); @@ -62,7 +60,6 @@ public function testGetToolPathLazyLoadsPath() public function testSetNumericInProperty() { $reflProperty = new \ReflectionProperty(Exiftool::class, 'numeric'); - $reflProperty->setAccessible(true); $expected = true; $this->adapter->setNumeric($expected); @@ -77,7 +74,6 @@ public function testSetNumericInProperty() public function testSetEncodingInProperty() { $reflProperty = new \ReflectionProperty(Exiftool::class, 'encoding'); - $reflProperty->setAccessible(true); $expected = array('iptc' => 'cp1250'); $input = array('iptc' => 'cp1250', 'exif' => 'utf8', 'foo' => 'bar'); @@ -112,13 +108,25 @@ public function testGetExifFromFileWithUtf8() $this->assertNotEmpty($result->getRawData()); } + /** + * @group exiftool + */ + public function testGetExifFromFileWithAvif() + { + $file = PHPEXIF_TEST_ROOT . '/files/fox.profile0.10bpc.yuv420.avif'; + $this->adapter->setOptions(array('encoding' => array('utf8'))); + $result = $this->adapter->getExifFromFile($file); + $this->assertInstanceOf('\PHPExif\Exif', $result); + $this->assertIsArray($result->getRawData()); + $this->assertNotEmpty($result->getRawData()); + } + /** * @group exiftool */ public function testGetCliOutput() { $reflMethod = new \ReflectionMethod(Exiftool::class, 'getCliOutput'); - $reflMethod->setAccessible(true); $result = $reflMethod->invoke( $this->adapter, diff --git a/tests/PHPExif/Adapter/FFprobeTest.php b/tests/PHPExif/Adapter/FFprobeTest.php index 5d0090a..146fb61 100644 --- a/tests/PHPExif/Adapter/FFprobeTest.php +++ b/tests/PHPExif/Adapter/FFprobeTest.php @@ -23,7 +23,6 @@ public function setUp(): void public function testGetToolPathFromProperty() { $reflProperty = new \ReflectionProperty(FFprobe::class, 'toolPath'); - $reflProperty->setAccessible(true); $expected = '/foo/bar/baz'; $reflProperty->setValue($this->adapter, $expected); @@ -36,7 +35,6 @@ public function testGetToolPathFromProperty() public function testSetToolPathInProperty() { $reflProperty = new \ReflectionProperty(FFprobe::class, 'toolPath'); - $reflProperty->setAccessible(true); $expected = '/tmp'; $this->adapter->setToolPath($expected); diff --git a/tests/PHPExif/Adapter/NativeTest.php b/tests/PHPExif/Adapter/NativeTest.php index df9d1af..aa211e8 100644 --- a/tests/PHPExif/Adapter/NativeTest.php +++ b/tests/PHPExif/Adapter/NativeTest.php @@ -20,7 +20,6 @@ public function setUp(): void public function testSetIncludeThumbnailInProperty() { $reflProperty = new \ReflectionProperty(Native::class, 'includeThumbnail'); - $reflProperty->setAccessible(true); $this->assertEquals(Native::NO_THUMBNAIL, $reflProperty->getValue($this->adapter)); @@ -35,7 +34,6 @@ public function testSetIncludeThumbnailInProperty() public function testGetIncludeThumbnailFromProperty() { $reflProperty = new \ReflectionProperty(Native::class, 'includeThumbnail'); - $reflProperty->setAccessible(true); $reflProperty->setValue($this->adapter, Native::INCLUDE_THUMBNAIL); $this->assertEquals(Native::INCLUDE_THUMBNAIL, $this->adapter->getIncludeThumbnail()); @@ -55,7 +53,6 @@ public function testGetIncludeThumbnailHasDefaultValue() public function testGetRequiredSections() { $reflProperty = new \ReflectionProperty(Native::class, 'requiredSections'); - $reflProperty->setAccessible(true); $this->assertEquals($reflProperty->getValue($this->adapter), $this->adapter->getRequiredSections()); } @@ -66,7 +63,6 @@ public function testGetRequiredSections() public function testSetRequiredSections() { $reflProperty = new \ReflectionProperty(Native::class, 'requiredSections'); - $reflProperty->setAccessible(true); $testData = array('foo', 'bar', 'baz'); @@ -82,7 +78,6 @@ public function testSetRequiredSections() public function testAddRequiredSection() { $reflProperty = new \ReflectionProperty(Native::class, 'requiredSections'); - $reflProperty->setAccessible(true); $testData = array('foo', 'bar', 'baz'); $this->adapter->setRequiredSections($testData); @@ -153,7 +148,6 @@ public function testGetEmptyIptcData() public function testSetSectionsAsArrayInProperty() { $reflProperty = new \ReflectionProperty(Native::class, 'sectionsAsArrays'); - $reflProperty->setAccessible(true); $expected = Native::SECTIONS_AS_ARRAYS; $this->adapter->setSectionsAsArrays($expected); $actual = $reflProperty->getValue($this->adapter); @@ -166,7 +160,6 @@ public function testSetSectionsAsArrayInProperty() public function testSetSectionsAsArrayConvertsToBoolean() { $reflProperty = new \ReflectionProperty(Native::class, 'sectionsAsArrays'); - $reflProperty->setAccessible(true); $expected = Native::SECTIONS_AS_ARRAYS; $this->adapter->setSectionsAsArrays('Foo'); $actual = $reflProperty->getValue($this->adapter); @@ -179,7 +172,6 @@ public function testSetSectionsAsArrayConvertsToBoolean() public function testGetSectionsAsArrayFromProperty() { $reflProperty = new \ReflectionProperty(Native::class, 'sectionsAsArrays'); - $reflProperty->setAccessible(true); $reflProperty->setValue($this->adapter, Native::SECTIONS_AS_ARRAYS); $this->assertEquals(Native::SECTIONS_AS_ARRAYS, $this->adapter->getSectionsAsArrays()); diff --git a/tests/PHPExif/ExifTest.php b/tests/PHPExif/ExifTest.php index 360b173..1bc9b1a 100644 --- a/tests/PHPExif/ExifTest.php +++ b/tests/PHPExif/ExifTest.php @@ -48,7 +48,6 @@ public function testConstructorCallsSetData() public function testGetRawData() { $reflProperty = new \ReflectionProperty(Exif::class, 'rawData'); - $reflProperty->setAccessible(true); $this->assertEquals($reflProperty->getValue($this->exif), $this->exif->getRawData()); } @@ -60,7 +59,6 @@ public function testSetRawData() { $testData = array('foo', 'bar', 'baz'); $reflProperty = new \ReflectionProperty(Exif::class, 'rawData'); - $reflProperty->setAccessible(true); $result = $this->exif->setRawData($testData); @@ -74,7 +72,6 @@ public function testSetRawData() public function testGetData() { $reflProperty = new \ReflectionProperty(Exif::class, 'data'); - $reflProperty->setAccessible(true); $this->assertEquals($reflProperty->getValue($this->exif), $this->exif->getData()); } @@ -86,7 +83,6 @@ public function testSetData() { $testData = array('foo', 'bar', 'baz'); $reflProperty = new \ReflectionProperty(Exif::class, 'data'); - $reflProperty->setAccessible(true); $result = $this->exif->setData($testData); @@ -653,7 +649,6 @@ public function testMutatorMethodsSetInProperty() $constants = $reflClass->getConstants(); $reflProp = new \ReflectionProperty(get_class($this->exif), 'data'); - $reflProp->setAccessible(true); $expected = 'foo'; foreach ($constants as $name => $value) { @@ -788,5 +783,20 @@ public function testAdapterConsistency() ); } } + + // Test for .avif type image for Native adapter + $testfiles = array( + PHPEXIF_TEST_ROOT . '/files/fox.profile0.10bpc.yuv420.avif', + ); + + foreach ($testfiles as $file) { + $file_name = basename($file); + $adapter_native = new \PHPExif\Adapter\Native(); + $result_exif_native = $adapter_native->getExifFromFile($file); + + $this->assertEquals($file_name, $result_exif_native->getFileName()); + $this->assertEquals('image/avif', $result_exif_native->getMimeType()); + $this->assertIsNumeric($result_exif_native->getWidth()); + } } } diff --git a/tests/PHPExif/Mapper/ExiftoolMapperTest.php b/tests/PHPExif/Mapper/ExiftoolMapperTest.php index 00502d1..8a3de57 100644 --- a/tests/PHPExif/Mapper/ExiftoolMapperTest.php +++ b/tests/PHPExif/Mapper/ExiftoolMapperTest.php @@ -37,7 +37,6 @@ public function testMapRawDataIgnoresFieldIfItDoesntExist() public function testMapRawDataMapsFieldsCorrectly() { $reflProp = new \ReflectionProperty(get_class($this->mapper), 'map'); - $reflProp->setAccessible(true); $map = $reflProp->getValue($this->mapper); // ignore custom formatted data stuff: @@ -441,7 +440,6 @@ public function testMapRawDataCorrectImageDirection() public function testSetNumericInProperty() { $reflProperty = new \ReflectionProperty(get_class($this->mapper), 'numeric'); - $reflProperty->setAccessible(true); $expected = true; $this->mapper->setNumeric($expected); diff --git a/tests/PHPExif/Mapper/FFprobeMapperTest.php b/tests/PHPExif/Mapper/FFprobeMapperTest.php index 079082f..8e24020 100644 --- a/tests/PHPExif/Mapper/FFprobeMapperTest.php +++ b/tests/PHPExif/Mapper/FFprobeMapperTest.php @@ -38,7 +38,6 @@ public function testMapRawDataIgnoresFieldIfItDoesntExist() public function testMapRawDataMapsFieldsCorrectly() { $reflProp = new \ReflectionProperty(get_class($this->mapper), 'map'); - $reflProp->setAccessible(true); $map = $reflProp->getValue($this->mapper); // ignore custom formatted data stuff: @@ -307,7 +306,6 @@ public function testMapRawDataCorrectlyIgnoresInvalidCreateDate() public function testNormalizeComponentCorrectly() { $reflMethod = new \ReflectionMethod(FFprobe::class, 'normalizeComponent'); - $reflMethod->setAccessible(true); $rawData = array( '2/800' => 0.0025, @@ -354,7 +352,6 @@ public function testMapRawDataMatchesFieldsWithoutCaseSensibilityOnFirstLetter() public function testreadISO6709() { $reflMethod = new \ReflectionMethod(FFprobe::class, 'readISO6709'); - $reflMethod->setAccessible(true); $testcase = array( '+27.5916+086.5640+8850/' => array( @@ -417,7 +414,6 @@ public function testconvertDMStoDecimal() { $reflMethod = new \ReflectionMethod(FFprobe::class, 'convertDMStoDecimal'); - $reflMethod->setAccessible(true); $testcase = array( '+27.5916' => array( diff --git a/tests/PHPExif/Mapper/ImageMagickMapperTest.php b/tests/PHPExif/Mapper/ImageMagickMapperTest.php index fc741a2..4cbb8f7 100644 --- a/tests/PHPExif/Mapper/ImageMagickMapperTest.php +++ b/tests/PHPExif/Mapper/ImageMagickMapperTest.php @@ -37,7 +37,6 @@ public function testMapRawDataIgnoresFieldIfItDoesntExist() public function testMapRawDataMapsFieldsCorrectly() { $reflProp = new \ReflectionProperty(get_class($this->mapper), 'map'); - $reflProp->setAccessible(true); $map = $reflProp->getValue($this->mapper); // ignore custom formatted data stuff: @@ -487,7 +486,6 @@ public function testMapRawDataCorrectlyWidthPNG() public function testNormalizeComponentCorrectly() { $reflMethod = new \ReflectionMethod(ImageMagick::class, 'normalizeComponent'); - $reflMethod->setAccessible(true); $rawData = array( '2/800' => 0.0025, diff --git a/tests/PHPExif/Mapper/NativeMapperTest.php b/tests/PHPExif/Mapper/NativeMapperTest.php index d4dbc67..ceffd7d 100644 --- a/tests/PHPExif/Mapper/NativeMapperTest.php +++ b/tests/PHPExif/Mapper/NativeMapperTest.php @@ -37,7 +37,6 @@ public function testMapRawDataIgnoresFieldIfItDoesntExist() public function testMapRawDataMapsFieldsCorrectly() { $reflProp = new \ReflectionProperty(get_class($this->mapper), 'map'); - $reflProp->setAccessible(true); $map = $reflProp->getValue($this->mapper); // ignore custom formatted data stuff: @@ -175,7 +174,7 @@ public function testMapRawDataCorrectlyFormatsCreationDateWithTimeZone3() $result->getTimezone()->getName() ); } - + /** * @group mapper */ @@ -455,7 +454,6 @@ public function testMapRawDataCorrectlyIgnoresInvalidCreateDate() public function testNormalizeComponentCorrectly() { $reflMethod = new \ReflectionMethod(Native::class, 'normalizeComponent'); - $reflMethod->setAccessible(true); $rawData = array( '2/800' => 0.0025, diff --git a/tests/PHPExif/Reader/ReaderTest.php b/tests/PHPExif/Reader/ReaderTest.php index 243fcee..d000f81 100644 --- a/tests/PHPExif/Reader/ReaderTest.php +++ b/tests/PHPExif/Reader/ReaderTest.php @@ -18,7 +18,6 @@ public function testConstructorWithAdapter() /** @var AdapterInterface $mock */ $mock = $this->getMockBuilder(AdapterInterface::class)->getMockForAbstractClass(); $reflProperty = new \ReflectionProperty(Reader::class, 'adapter'); - $reflProperty->setAccessible(true); $reader = new Reader($mock); @@ -62,7 +61,6 @@ public function testFactoryAdapterTypeNative() { $reader = Reader::factory(\PHPExif\Enum\ReaderType::NATIVE); $reflProperty = new \ReflectionProperty(Reader::class, 'adapter'); - $reflProperty->setAccessible(true); $adapter = $reflProperty->getValue($reader); @@ -76,7 +74,6 @@ public function testFactoryAdapterTypeExiftool() { $reader = Reader::factory(\PHPExif\Enum\ReaderType::EXIFTOOL); $reflProperty = new \ReflectionProperty(Reader::class, 'adapter'); - $reflProperty->setAccessible(true); $adapter = $reflProperty->getValue($reader); @@ -90,7 +87,6 @@ public function testFactoryAdapterTypeFFprobe() { $reader = Reader::factory(\PHPExif\Enum\ReaderType::FFPROBE); $reflProperty = new \ReflectionProperty(Reader::class, 'adapter'); - $reflProperty->setAccessible(true); $adapter = $reflProperty->getValue($reader); @@ -105,7 +101,6 @@ public function testFactoryAdapterTypeImageMagick() { $reader = Reader::factory(\PHPExif\Enum\ReaderType::IMAGICK); $reflProperty = new \ReflectionProperty(Reader::class, 'adapter'); - $reflProperty->setAccessible(true); $adapter = $reflProperty->getValue($reader); diff --git a/tests/files/fox.profile0.10bpc.yuv420.avif b/tests/files/fox.profile0.10bpc.yuv420.avif new file mode 100644 index 0000000..a1c0abd Binary files /dev/null and b/tests/files/fox.profile0.10bpc.yuv420.avif differ