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