Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / tests / phpunit / includes / specials / SpecialMIMESearchTest.php
blobfe1c9e83b1c95cce988641cd52750b4a485766a5
1 <?php
2 /**
3 * @group Database
4 */
6 class SpecialMIMESearchTest extends MediaWikiTestCase {
8 /** @var MIMEsearchPage */
9 private $page;
11 function setUp() {
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 );
18 parent::setUp();
21 /**
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 );
33 } else {
34 $this->assertArrayNotHasKey( 'img_minor_mime', $qi['conds'] );
36 $this->assertContains( 'image', $qi['tables'] );
39 function providerMimeFiltering() {
40 return array(
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 ),