Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5978534
BmpHandlerTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
BmpHandlerTest.php
View Options
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @since 1.42
*/
namespace
MediaWiki\Tests\Media
;
use
BmpHandler
;
use
MediaHandlerState
;
use
MediaWiki\FileRepo\File\File
;
use
MediaWikiMediaTestCase
;
/**
* @covers \BmpHandler
* @group Media
*/
class
BmpHandlerTest
extends
MediaWikiMediaTestCase
{
protected
BmpHandler
$handler
;
protected
File
$tempFile
;
protected
function
setUp
():
void
{
parent
::
setUp
();
$this
->
handler
=
new
BmpHandler
();
$this
->
tempFile
=
$this
->
createMock
(
File
::
class
);
}
/**
* @covers \BmpHandler::mustRender
*/
public
function
testMustRender
()
{
$this
->
assertTrue
(
$this
->
handler
->
mustRender
(
$this
->
tempFile
)
);
}
/**
* @covers \BmpHandler::getThumbType
*/
public
function
testGetThumbType
()
{
$this
->
assertEquals
(
[
'png'
,
'image/png'
],
$this
->
handler
->
getThumbType
(
'bmp'
,
'image/bmp'
)
);
}
/**
* @covers \BmpHandler::getSizeAndMetadata
* @dataProvider provideGetSizeAndMetadata
*/
public
function
testGetSizeAndMetadata
(
string
$filename
,
array
$expected
)
{
$stateMock
=
$this
->
createMock
(
MediaHandlerState
::
class
);
$res
=
$this
->
handler
->
getSizeAndMetadata
(
$stateMock
,
$filename
);
$this
->
assertEquals
(
$expected
,
$res
);
}
public
static
function
provideGetSizeAndMetadata
():
array
{
return
[
[
__DIR__
.
'/../../data/media/bmp-100x100.bmp'
,
[
'width'
=>
100
,
'height'
=>
100
]
],
[
__DIR__
.
'/../../data/media/bmp-200x150.bmp'
,
[
'width'
=>
200
,
'height'
=>
150
]
],
[
__DIR__
.
'/../../data/media/bmp-300x200.bmp'
,
[
'width'
=>
300
,
'height'
=>
200
]
],
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 20:26 (3 d, 22 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f4/fc/bf3f60ce261cb742784c9d7a3d23
Default Alt Text
BmpHandlerTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment