MediaWiki REL1_32
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.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37