MediaWiki
REL1_24
|
00001 <?php 00005 class ImagePage404Test extends MediaWikiMediaTestCase { 00006 00007 protected function getRepoOptions() { 00008 return parent::getRepoOptions() + array( 'transformVia404' => true ); 00009 } 00010 00011 function setUp() { 00012 $this->setMwGlobals( 'wgImageLimits', array( 00013 array( 320, 240 ), 00014 array( 640, 480 ), 00015 array( 800, 600 ), 00016 array( 1024, 768 ), 00017 array( 1280, 1024 ) 00018 ) ); 00019 parent::setUp(); 00020 } 00021 00022 function getImagePage( $filename ) { 00023 $title = Title::makeTitleSafe( NS_FILE, $filename ); 00024 $file = $this->dataFile( $filename ); 00025 $iPage = new ImagePage( $title ); 00026 $iPage->setFile( $file ); 00027 return $iPage; 00028 } 00029 00035 function testGetThumbSizes( $filename, $expectedNumberThumbs ) { 00036 $iPage = $this->getImagePage( $filename ); 00037 $reflection = new ReflectionClass( $iPage ); 00038 $reflMethod = $reflection->getMethod( 'getThumbSizes' ); 00039 $reflMethod->setAccessible( true ); 00040 00041 $actual = $reflMethod->invoke( $iPage, 545, 700 ); 00042 $this->assertEquals( count( $actual ), $expectedNumberThumbs ); 00043 } 00044 00045 function providerGetThumbSizes() { 00046 return array( 00047 array( 'animated.gif', 6 ), 00048 array( 'Toll_Texas_1.svg', 6 ), 00049 array( '80x60-Greyscale.xcf', 6 ), 00050 array( 'jpeg-comment-binary.jpg', 6 ), 00051 ); 00052 } 00053 }