MediaWiki
REL1_24
|
00001 <?php 00006 class SpecialMIMESearchTest extends MediaWikiTestCase { 00007 00009 private $page; 00010 00011 function setUp() { 00012 $this->page = new MIMESearchPage; 00013 $context = new RequestContext(); 00014 $context->setTitle( Title::makeTitle( NS_SPECIAL, 'MIMESearch' ) ); 00015 $context->setRequest( new FauxRequest() ); 00016 $this->page->setContext( $context ); 00017 00018 parent::setUp(); 00019 } 00020 00027 function testMimeFiltering( $par, $major, $minor ) { 00028 $this->page->run( $par ); 00029 $qi = $this->page->getQueryInfo(); 00030 $this->assertEquals( $qi['conds']['img_major_mime'], $major ); 00031 if ( $minor !== null ) { 00032 $this->assertEquals( $qi['conds']['img_minor_mime'], $minor ); 00033 } else { 00034 $this->assertArrayNotHasKey( 'img_minor_mime', $qi['conds'] ); 00035 } 00036 $this->assertContains( 'image', $qi['tables'] ); 00037 } 00038 00039 function providerMimeFiltering() { 00040 return array( 00041 array( 'image/gif', 'image', 'gif' ), 00042 array( 'image/png', 'image', 'png' ), 00043 array( 'application/pdf', 'application', 'pdf' ), 00044 array( 'image/*', 'image', null ), 00045 array( 'multipart/*', 'multipart', null ), 00046 ); 00047 } 00048 }