MediaWiki REL1_31
ExifTest.php
Go to the documentation of this file.
1<?php
2
8
10 protected $mediaPath;
11
12 protected function setUp() {
13 parent::setUp();
14 $this->checkPHPExtension( 'exif' );
15
16 $this->mediaPath = __DIR__ . '/../../data/media/';
17
18 $this->setMwGlobals( 'wgShowEXIF', true );
19 }
20
21 public function testGPSExtraction() {
22 $filename = $this->mediaPath . 'exif-gps.jpg';
24 $exif = new Exif( $filename, $seg['byteOrder'] );
25 $data = $exif->getFilteredData();
26 $expected = [
27 'GPSLatitude' => 88.5180555556,
28 'GPSLongitude' => -21.12357,
29 'GPSAltitude' => -3.141592653,
30 'GPSDOP' => '5/1',
31 'GPSVersionID' => '2.2.0.0',
32 ];
33 $this->assertEquals( $expected, $data, '', 0.0000000001 );
34 }
35
36 public function testUnicodeUserComment() {
37 $filename = $this->mediaPath . 'exif-user-comment.jpg';
39 $exif = new Exif( $filename, $seg['byteOrder'] );
40 $data = $exif->getFilteredData();
41
42 $expected = [
43 'UserComment' => 'test⁔comment',
44 ];
45 $this->assertEquals( $expected, $data );
46 }
47}
Media Exif.
Definition ExifTest.php:7
string $mediaPath
Definition ExifTest.php:10
testUnicodeUserComment()
Definition ExifTest.php:36
testGPSExtraction()
Definition ExifTest.php:21
Class to extract and validate Exif data from jpeg (and possibly tiff) files.
Definition Exif.php:32
static segmentSplitter( $filename)
Function to extract metadata segments of interest from jpeg files based on GIFMetadataExtractor.
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
checkPHPExtension( $extName)
Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded.