4 * Test class for SpecialShortpages class
10 class SpecialShortpagesTest
extends MediaWikiTestCase
{
13 * @dataProvider provideGetQueryInfoRespectsContentNs
14 * @covers ShortPagesPage::getQueryInfo()
16 public function testGetQueryInfoRespectsContentNS( $contentNS, $blacklistNS, $expectedNS ) {
17 $this->setMwGlobals( [
18 'wgShortPagesNamespaceBlacklist' => $blacklistNS,
19 'wgContentNamespaces' => $contentNS
21 $this->setTemporaryHook( 'ShortPagesQuery', function () {
25 $page = new ShortPagesPage();
26 $queryInfo = $page->getQueryInfo();
28 $this->assertArrayHasKey( 'conds', $queryInfo );
29 $this->assertArrayHasKey( 'page_namespace', $queryInfo[ 'conds' ] );
30 $this->assertEquals( $expectedNS, $queryInfo[ 'conds' ][ 'page_namespace' ] );
33 public function provideGetQueryInfoRespectsContentNs() {
35 [ [ NS_MAIN
, NS_FILE
], [], [ NS_MAIN
, NS_FILE
] ],
36 [ [ NS_MAIN
, NS_TALK
], [ NS_FILE
], [ NS_MAIN
, NS_TALK
] ],
37 [ [ NS_MAIN
, NS_FILE
], [ NS_FILE
], [ NS_MAIN
] ],
38 // NS_MAIN namespace is always forced
39 [ [], [ NS_FILE
], [ NS_MAIN
] ]