File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -427,4 +427,33 @@ public function testGetOrientation()
427427 $ this ->exif ->setRawData ($ data );
428428 $ this ->assertEquals ($ expected , $ this ->exif ->getOrientation ());
429429 }
430+
431+ /**
432+ * Test that the values returned by both adapters are equal
433+ */
434+ public function testAdapterConsistency ()
435+ {
436+ $ reflClass = new \ReflectionClass ('\PHPExif\Exif ' );
437+ $ methods = $ reflClass ->getMethods (ReflectionMethod::IS_PUBLIC );
438+ $ file = PHPEXIF_TEST_ROOT . '/files/morning_glory_pool_500.jpg ' ;
439+
440+ $ adapter_exiftool = new \PHPExif \Reader \Adapter \Exiftool ();
441+ $ adapter_native = new \PHPExif \Reader \Adapter \Native ();
442+
443+ $ result_exiftool = $ adapter_exiftool ->getExifFromFile ($ file );
444+ $ result_native = $ adapter_native ->getExifFromFile ($ file );
445+
446+ // find all Getter methods on the results and compare its output
447+ foreach ($ methods as $ method ) {
448+ $ name = $ method ->getName ();
449+ if (strpos ($ name , 'get ' ) !== 0 || $ name == 'getRawData ' ) {
450+ continue ;
451+ }
452+ $ this ->assertEquals (
453+ call_user_func (array ($ result_native , $ name )),
454+ call_user_func (array ($ result_exiftool , $ name )),
455+ 'Adapter difference in method ' . $ name
456+ );
457+ }
458+ }
430459}
You can’t perform that action at this time.
0 commit comments