Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions tests/PHPExif/Adapter/AdapterAbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand All @@ -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));
}
}
Expand All @@ -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));
}
}
Expand All @@ -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));
}

Expand All @@ -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());
}
Expand All @@ -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());
Expand All @@ -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));
}
Expand All @@ -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));
}

Expand All @@ -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());
}
Expand All @@ -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));
}
Expand Down
1 change: 0 additions & 1 deletion tests/PHPExif/Adapter/ExiftoolProcOpenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
18 changes: 13 additions & 5 deletions tests/PHPExif/Adapter/ExiftoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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');
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions tests/PHPExif/Adapter/FFprobeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down
8 changes: 0 additions & 8 deletions tests/PHPExif/Adapter/NativeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -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());
Expand All @@ -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());
}
Expand All @@ -66,7 +63,6 @@ public function testGetRequiredSections()
public function testSetRequiredSections()
{
$reflProperty = new \ReflectionProperty(Native::class, 'requiredSections');
$reflProperty->setAccessible(true);

$testData = array('foo', 'bar', 'baz');

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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());
Expand Down
20 changes: 15 additions & 5 deletions tests/PHPExif/ExifTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand All @@ -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);

Expand All @@ -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());
}
Expand All @@ -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);

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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());
}
}
}
2 changes: 0 additions & 2 deletions tests/PHPExif/Mapper/ExiftoolMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions tests/PHPExif/Mapper/FFprobeMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -417,7 +414,6 @@ public function testconvertDMStoDecimal()
{

$reflMethod = new \ReflectionMethod(FFprobe::class, 'convertDMStoDecimal');
$reflMethod->setAccessible(true);

$testcase = array(
'+27.5916' => array(
Expand Down
2 changes: 0 additions & 2 deletions tests/PHPExif/Mapper/ImageMagickMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions tests/PHPExif/Mapper/NativeMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -175,7 +174,7 @@ public function testMapRawDataCorrectlyFormatsCreationDateWithTimeZone3()
$result->getTimezone()->getName()
);
}

/**
* @group mapper
*/
Expand Down Expand Up @@ -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,
Expand Down
Loading