MediaWiki REL1_33
SpecialShortpagesTest.php
Go to the documentation of this file.
1<?php
2
11
16 public function testGetQueryInfoRespectsContentNS( $contentNS, $blacklistNS, $expectedNS ) {
17 $this->setMwGlobals( [
18 'wgShortPagesNamespaceBlacklist' => $blacklistNS,
19 'wgContentNamespaces' => $contentNS
20 ] );
21 $this->setTemporaryHook( 'ShortPagesQuery', function () {
22 // empty hook handler
23 } );
24
25 $page = new ShortPagesPage();
26 $queryInfo = $page->getQueryInfo();
27
28 $this->assertArrayHasKey( 'conds', $queryInfo );
29 $this->assertArrayHasKey( 'page_namespace', $queryInfo[ 'conds' ] );
30 $this->assertEquals( $expectedNS, $queryInfo[ 'conds' ][ 'page_namespace' ] );
31 }
32
34 return [
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 ] ]
40 ];
41 }
42
43}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
setTemporaryHook( $hookName, $handler)
Create a temporary hook handler which will be reset by tearDown.
SpecialShortpages extends QueryPage.
Test class for SpecialShortpages class.
testGetQueryInfoRespectsContentNS( $contentNS, $blacklistNS, $expectedNS)
provideGetQueryInfoRespectsContentNs ShortPagesPage::getQueryInfo()
const NS_FILE
Definition Defines.php:79
const NS_MAIN
Definition Defines.php:73
const NS_TALK
Definition Defines.php:74