Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / tests / phpunit / includes / page / ImagePage404Test.php
blob197a2b32e0e7519cc880e6c641f8e767fb812a12
1 <?php
2 /**
3 * For doing Image Page tests that rely on 404 thumb handling
4 */
5 class ImagePage404Test extends MediaWikiMediaTestCase {
7 protected function getRepoOptions() {
8 return parent::getRepoOptions() + array( 'transformVia404' => true );
11 function setUp() {
12 $this->setMwGlobals( 'wgImageLimits', array(
13 array( 320, 240 ),
14 array( 640, 480 ),
15 array( 800, 600 ),
16 array( 1024, 768 ),
17 array( 1280, 1024 )
18 ) );
19 parent::setUp();
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 );
27 return $iPage;
30 /**
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() {
46 return array(
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 ),