MediaWiki  1.23.2
ExifTest.php
Go to the documentation of this file.
1 <?php
2 
6 class ExifTest extends MediaWikiTestCase {
7 
9  protected $mediaPath;
10 
11  protected function setUp() {
12  parent::setUp();
13  $this->checkPHPExtension( 'exif' );
14 
15  $this->mediaPath = __DIR__ . '/../../data/media/';
16 
17  $this->setMwGlobals( 'wgShowEXIF', true );
18  }
19 
20  public function testGPSExtraction() {
21  $filename = $this->mediaPath . 'exif-gps.jpg';
22  $seg = JpegMetadataExtractor::segmentSplitter( $filename );
23  $exif = new Exif( $filename, $seg['byteOrder'] );
24  $data = $exif->getFilteredData();
25  $expected = array(
26  'GPSLatitude' => 88.5180555556,
27  'GPSLongitude' => -21.12357,
28  'GPSAltitude' => -3.141592653,
29  'GPSDOP' => '5/1',
30  'GPSVersionID' => '2.2.0.0',
31  );
32  $this->assertEquals( $expected, $data, '', 0.0000000001 );
33  }
34 
35  public function testUnicodeUserComment() {
36  $filename = $this->mediaPath . 'exif-user-comment.jpg';
37  $seg = JpegMetadataExtractor::segmentSplitter( $filename );
38  $exif = new Exif( $filename, $seg['byteOrder'] );
39  $data = $exif->getFilteredData();
40 
41  $expected = array(
42  'UserComment' => 'test⁔comment'
43  );
44  $this->assertEquals( $expected, $data );
45  }
46 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ExifTest
@covers Exif
Definition: ExifTest.php:6
ExifTest\testUnicodeUserComment
testUnicodeUserComment()
Definition: ExifTest.php:34
Exif
Class to extract and validate Exif data from jpeg (and possibly tiff) files.
Definition: Exif.php:32
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Definition: MediaWikiTestCase.php:302
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
ExifTest\$mediaPath
string $mediaPath
Definition: ExifTest.php:8
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
ExifTest\testGPSExtraction
testGPSExtraction()
Definition: ExifTest.php:19
JpegMetadataExtractor\segmentSplitter
static segmentSplitter( $filename)
Function to extract metadata segments of interest from jpeg files based on GIFMetadataExtractor.
Definition: JpegMetadataExtractor.php:50
ExifTest\setUp
setUp()
Definition: ExifTest.php:10
MediaWikiTestCase\checkPHPExtension
checkPHPExtension( $extName)
Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded.
Definition: MediaWikiTestCase.php:1005