Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4095996
GIFMetadataExtractorTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
GIFMetadataExtractorTest.php
View Options
<?php
/**
* @group Media
*/
class
GIFMetadataExtractorTest
extends
\MediaWikiUnitTestCase
{
private
const
FILE_PATH
=
__DIR__
.
'/../../../data/media/'
;
/**
* Put in a file, and see if the metadata coming out is as expected.
* @param string $filename
* @param array $expected The extracted metadata.
* @dataProvider provideGetMetadata
* @covers \GIFMetadataExtractor::getMetadata
*/
public
function
testGetMetadata
(
$filename
,
$expected
)
{
$actual
=
GIFMetadataExtractor
::
getMetadata
(
self
::
FILE_PATH
.
$filename
);
$this
->
assertEquals
(
$expected
,
$actual
);
}
public
static
function
provideGetMetadata
()
{
$xmpNugget
=
<<<EOF
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 7.30'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about=''
xmlns:Iptc4xmpCore='http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/'>
<Iptc4xmpCore:Location>The interwebs</Iptc4xmpCore:Location>
</rdf:Description>
<rdf:Description rdf:about=''
xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
<tiff:Artist>Bawolff</tiff:Artist>
<tiff:ImageDescription>
<rdf:Alt>
<rdf:li xml:lang='x-default'>A file to test GIF</rdf:li>
</rdf:Alt>
</tiff:ImageDescription>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end='w'?>
EOF;
$xmpNugget
=
str_replace
(
"
\r
"
,
''
,
$xmpNugget
);
// Windows compat
return
[
[
'nonanimated.gif'
,
[
'width'
=>
45
,
'height'
=>
30
,
'bits'
=>
1
,
'comment'
=>
[
'GIF test file ⁕ Created with GIMP'
],
'duration'
=>
0.1
,
'frameCount'
=>
1
,
'looped'
=>
false
,
'xmp'
=>
''
,
]
],
[
'animated.gif'
,
[
'width'
=>
45
,
'height'
=>
30
,
'bits'
=>
1
,
'comment'
=>
[
'GIF test file . Created with GIMP'
],
'duration'
=>
2.4
,
'frameCount'
=>
4
,
'looped'
=>
true
,
'xmp'
=>
''
,
]
],
[
'animated-xmp.gif'
,
[
'width'
=>
45
,
'height'
=>
30
,
'bits'
=>
1
,
'xmp'
=>
$xmpNugget
,
'duration'
=>
2.4
,
'frameCount'
=>
4
,
'looped'
=>
true
,
'comment'
=>
[
'GIƒ·test·file'
],
]
],
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 14:09 (4 w, 32 m ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0f/46/6c9c7d89a0e129e428a907087c59
Default Alt Text
GIFMetadataExtractorTest.php (4 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment