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