MediaWiki REL1_31
SpecialMIMESearchTest.php
Go to the documentation of this file.
1<?php
2
8
10 private $page;
11
12 function setUp() {
13 $this->page = new MIMEsearchPage;
15 $context->setTitle( Title::makeTitle( NS_SPECIAL, 'MIMESearch' ) );
16 $context->setRequest( new FauxRequest() );
17 $this->page->setContext( $context );
18
19 parent::setUp();
20 }
21
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 );
34 } else {
35 $this->assertArrayNotHasKey( 'img_minor_mime', $qi['conds'] );
36 }
37 $this->assertContains( 'image', $qi['tables'] );
38 }
39
41 return [
42 [ 'image/gif', 'image', 'gif' ],
43 [ 'image/png', 'image', 'png' ],
44 [ 'application/pdf', 'application', 'pdf' ],
45 [ 'image/*', 'image', null ],
46 [ 'multipart/*', 'multipart', null ],
47 ];
48 }
49}
WebRequest clone which takes values from a provided array.
Searches the database for files of the requested MIME type, comparing this with the 'img_major_mime' ...
Group all the pieces relevant to the context of a request into one instance.
Database MIMEsearchPage.
testMimeFiltering( $par, $major, $minor)
providerMimeFiltering
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition hooks.txt:2811
const NS_SPECIAL
Definition Defines.php:63