3 * For doing Image Page tests that rely on 404 thumb handling
5 class ImagePage404Test
extends MediaWikiMediaTestCase
{
7 protected function getRepoOptions() {
8 return parent
::getRepoOptions() +
array( 'transformVia404' => true );
12 $this->setMwGlobals( 'wgImageLimits', array(
22 function getImagePage( $filename ) {
23 $title = Title
::makeTitleSafe( NS_FILE
, $filename );
24 $file = $this->dataFile( $filename );
25 $iPage = new ImagePage( $title );
26 $iPage->setFile( $file );
31 * @dataProvider providerGetThumbSizes
32 * @param string $filename
33 * @param int $expectedNumberThumbs How many thumbnails to show
35 function testGetThumbSizes( $filename, $expectedNumberThumbs ) {
36 $iPage = $this->getImagePage( $filename );
37 $reflection = new ReflectionClass( $iPage );
38 $reflMethod = $reflection->getMethod( 'getThumbSizes' );
39 $reflMethod->setAccessible( true );
41 $actual = $reflMethod->invoke( $iPage, 545, 700 );
42 $this->assertEquals( count( $actual ), $expectedNumberThumbs );
45 function providerGetThumbSizes() {
47 array( 'animated.gif', 6 ),
48 array( 'Toll_Texas_1.svg', 6 ),
49 array( '80x60-Greyscale.xcf', 6 ),
50 array( 'jpeg-comment-binary.jpg', 6 ),