test: coverage recording now needs to be explicit
[mediawiki.git] / tests / phpunit / includes / media / GIFMetadataExtractorTest.php
blob86cf3465b7bce22e1a063804fcf2cb0e4d380bc7
1 <?php
2 class GIFMetadataExtractorTest extends MediaWikiTestCase {
4 protected function setUp() {
5 parent::setUp();
7 $this->mediaPath = __DIR__ . '/../../data/media/';
10 /**
11 * Put in a file, and see if the metadata coming out is as expected.
12 * @param $filename String
13 * @param $expected Array The extracted metadata.
14 * @dataProvider provideGetMetadata
16 public function testGetMetadata( $filename, $expected ) {
17 $actual = GIFMetadataExtractor::getMetadata( $this->mediaPath . $filename );
18 $this->assertEquals( $expected, $actual );
21 public static function provideGetMetadata() {
23 $xmpNugget = <<<EOF
24 <?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
25 <x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 7.30'>
26 <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
28 <rdf:Description rdf:about=''
29 xmlns:Iptc4xmpCore='http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/'>
30 <Iptc4xmpCore:Location>The interwebs</Iptc4xmpCore:Location>
31 </rdf:Description>
33 <rdf:Description rdf:about=''
34 xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
35 <tiff:Artist>Bawolff</tiff:Artist>
36 <tiff:ImageDescription>
37 <rdf:Alt>
38 <rdf:li xml:lang='x-default'>A file to test GIF</rdf:li>
39 </rdf:Alt>
40 </tiff:ImageDescription>
41 </rdf:Description>
42 </rdf:RDF>
43 </x:xmpmeta>
68 <?xpacket end='w'?>
69 EOF;
70 $xmpNugget = str_replace( "\r", '', $xmpNugget ); // Windows compat
72 return array(
73 array(
74 'nonanimated.gif',
75 array(
76 'comment' => array( 'GIF test file ⁕ Created with GIMP' ),
77 'duration' => 0.1,
78 'frameCount' => 1,
79 'looped' => false,
80 'xmp' => '',
83 array(
84 'animated.gif',
85 array(
86 'comment' => array( 'GIF test file . Created with GIMP' ),
87 'duration' => 2.4,
88 'frameCount' => 4,
89 'looped' => true,
90 'xmp' => '',
94 array(
95 'animated-xmp.gif',
96 array(
97 'xmp' => $xmpNugget,
98 'duration' => 2.4,
99 'frameCount' => 4,
100 'looped' => true,
101 'comment' => array( 'GIƒ·test·file' ),