6 class SpecialMIMESearchTest
extends MediaWikiTestCase
{
8 /** @var MIMEsearchPage */
12 $this->page
= new MIMEsearchPage
;
13 $context = new RequestContext();
14 $context->setTitle( Title
::makeTitle( NS_SPECIAL
, 'MIMESearch' ) );
15 $context->setRequest( new FauxRequest() );
16 $this->page
->setContext( $context );
22 * @dataProvider providerMimeFiltering
23 * @param string $par Subpage for special page
24 * @param string $major Major MIME type we expect to look for
25 * @param string $minor Minor MIME type we expect to look for
27 function testMimeFiltering( $par, $major, $minor ) {
28 $this->page
->run( $par );
29 $qi = $this->page
->getQueryInfo();
30 $this->assertEquals( $qi['conds']['img_major_mime'], $major );
31 if ( $minor !== null ) {
32 $this->assertEquals( $qi['conds']['img_minor_mime'], $minor );
34 $this->assertArrayNotHasKey( 'img_minor_mime', $qi['conds'] );
36 $this->assertContains( 'image', $qi['tables'] );
39 function providerMimeFiltering() {
41 array( 'image/gif', 'image', 'gif' ),
42 array( 'image/png', 'image', 'png' ),
43 array( 'application/pdf', 'application', 'pdf' ),
44 array( 'image/*', 'image', null ),
45 array( 'multipart/*', 'multipart', null ),