Move ResultWrapper subclasses to Rdbms
[mediawiki.git] / tests / phpunit / includes / page / ImagePage404Test.php
blob48c4392d0544a5e41240c55dec671a1af9a1209f
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() + [ 'transformVia404' => true ];
11 function setUp() {
12 $this->setMwGlobals( 'wgImageLimits', [
13 [ 320, 240 ],
14 [ 640, 480 ],
15 [ 800, 600 ],
16 [ 1024, 768 ],
17 [ 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 [
47 [ 'animated.gif', 6 ],
48 [ 'Toll_Texas_1.svg', 6 ],
49 [ '80x60-Greyscale.xcf', 6 ],
50 [ 'jpeg-comment-binary.jpg', 6 ],