wiki.techinc.nl/tests/phpunit/includes/media/ExifTest.php
addshore 959bc315f2 MediaWikiTestCase to MediaWikiIntegrationTestCase
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)

My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.

Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
2020-06-30 17:02:22 +01:00

47 lines
1.2 KiB
PHP

<?php
/**
* @group Media
* @covers Exif
*/
class ExifTest extends MediaWikiIntegrationTestCase {
/** @var string */
protected $mediaPath;
protected function setUp() : void {
parent::setUp();
$this->checkPHPExtension( 'exif' );
$this->mediaPath = __DIR__ . '/../../data/media/';
$this->setMwGlobals( 'wgShowEXIF', true );
}
public function testGPSExtraction() {
$filename = $this->mediaPath . 'exif-gps.jpg';
$seg = JpegMetadataExtractor::segmentSplitter( $filename );
$exif = new Exif( $filename, $seg['byteOrder'] );
$data = $exif->getFilteredData();
$expected = [
'GPSLatitude' => 88.5180555556,
'GPSLongitude' => -21.12357,
'GPSAltitude' => -3.141592653,
'GPSDOP' => '5/1',
'GPSVersionID' => '2.2.0.0',
];
$this->assertEqualsWithDelta( $expected, $data, 0.0000000001 );
}
public function testUnicodeUserComment() {
$filename = $this->mediaPath . 'exif-user-comment.jpg';
$seg = JpegMetadataExtractor::segmentSplitter( $filename );
$exif = new Exif( $filename, $seg['byteOrder'] );
$data = $exif->getFilteredData();
$expected = [
'UserComment' => 'test⁔comment',
];
$this->assertEquals( $expected, $data );
}
}