Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4137667
MWFilePropsTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
MWFilePropsTest.php
View Options
<?php
use
Wikimedia\FileBackend\FileBackend
;
/**
* @covers \MWFileProps
*/
class
MWFilePropsTest
extends
MediaWikiIntegrationTestCase
{
public
static
function
provideGetPropsFromPath
()
{
return
[
'nonexistent.png'
=>
[
'nonexistent.png'
,
[
'fileExists'
=>
false
,
'size'
=>
0
,
'file-mime'
=>
null
,
'major_mime'
=>
null
,
'minor_mime'
=>
null
,
'mime'
=>
null
,
'sha1'
=>
''
,
'metadata'
=>
[],
'width'
=>
0
,
'height'
=>
0
,
'bits'
=>
0
,
'media_type'
=>
'UNKNOWN'
,
]
],
'zip-kind-of-valid.png'
=>
[
'zip-kind-of-valid.png'
,
[
'fileExists'
=>
true
,
'size'
=>
189
,
'file-mime'
=>
'application/zip'
,
'major_mime'
=>
'application'
,
'minor_mime'
=>
'zip'
,
'mime'
=>
'application/zip'
,
'sha1'
=>
'rt7k3bexfau9i8jd5z41oxi3fqz7psb'
,
'metadata'
=>
[],
'width'
=>
0
,
'height'
=>
0
,
'bits'
=>
0
,
'media_type'
=>
'ARCHIVE'
,
]
],
'tinyrgb.jpg'
=>
[
'tinyrgb.jpg'
,
[
'width'
=>
120
,
'height'
=>
78
,
'bits'
=>
8
,
'fileExists'
=>
true
,
'size'
=>
5118
,
'file-mime'
=>
'image/jpeg'
,
'major_mime'
=>
'image'
,
'minor_mime'
=>
'jpeg'
,
'mime'
=>
'image/jpeg'
,
'sha1'
=>
'iqrl77mbbzax718nogdpirzfodf7meh'
,
'metadata'
=>
[
'JPEGFileComment'
=>
[
'File source: http://127.0.0.1:8080/wiki/File:Srgb_copy.jpg'
,
],
'MEDIAWIKI_EXIF_VERSION'
=>
2
,
],
'media_type'
=>
'BITMAP'
,
]
],
];
}
/**
* @dataProvider provideGetPropsFromPath
* @param string $relPath
* @param array $expected
*/
public
function
testGetPropsFromPath
(
$relPath
,
$expected
)
{
$mwfp
=
new
MWFileProps
(
$this
->
getServiceContainer
()->
getMimeAnalyzer
()
);
$path
=
__DIR__
.
'/../../../data/media/'
.
$relPath
;
$props
=
$mwfp
->
getPropsFromPath
(
$path
,
FileBackend
::
extensionFromPath
(
$path
)
);
$this
->
assertArrayEquals
(
$expected
,
$props
,
false
,
true
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 14:15 (3 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
fa/a8/c4aebeb9cbf123bffc5ba57b6db3
Default Alt Text
MWFilePropsTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment