rdbms: Rename "memCache" to "memStash" in LBFactory
[mediawiki.git] / tests / phpunit / includes / specials / SpecialMIMESearchTest.php
blobede279174541043340c2577c02f071459338c9c1
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 [
41 [ 'image/gif', 'image', 'gif' ],
42 [ 'image/png', 'image', 'png' ],
43 [ 'application/pdf', 'application', 'pdf' ],
44 [ 'image/*', 'image', null ],
45 [ 'multipart/*', 'multipart', null ],