2 class SpecialMIMESearchTest
extends MediaWikiTestCase
{
4 /** @var MIMESearchPage */
8 $this->page
= new MIMESearchPage
;
9 $context = new RequestContext();
10 $context->setTitle( Title
::makeTitle( NS_SPECIAL
, 'MIMESearch' ) );
11 $context->setRequest( new FauxRequest() );
12 $this->page
->setContext( $context );
18 * @dataProvider providerMimeFiltering
19 * @param $par String subpage for special page
20 * @param $major String Major mime type we expect to look for
21 * @param $minor String Minor mime type we expect to look for
23 function testMimeFiltering( $par, $major, $minor ) {
24 $this->page
->run( $par );
25 $qi = $this->page
->getQueryInfo();
26 $this->assertEquals( $qi['conds']['img_major_mime'], $major );
27 if ( $minor !== null ) {
28 $this->assertEquals( $qi['conds']['img_minor_mime'], $minor );
30 $this->assertArrayNotHasKey( 'img_minor_mime', $qi['conds'] );
32 $this->assertContains( 'image', $qi['tables'] );
35 function providerMimeFiltering() {
37 array( 'image/gif', 'image', 'gif' ),
38 array( 'image/png', 'image', 'png' ),
39 array( 'application/pdf', 'application', 'pdf' ),
40 array( 'image/*', 'image', null ),
41 array( 'multipart/*', 'multipart', null ),