Added release notes for 'ContentHandler::runLegacyHooks' removal
[mediawiki.git] / tests / phpunit / includes / specials / SpecialUncategorizedcategoriesTest.php
blob64e78f28284f932ad8805bdb7880d4035508c1a7
1 <?php
2 /**
3 * Tests for Special:Uncategorizedcategories
4 */
5 class UncategorizedCategoriesPageTest extends MediaWikiTestCase {
6 /**
7 * @dataProvider provideTestGetQueryInfoData
8 */
9 public function testGetQueryInfo( $msgContent, $expected ) {
10 $msg = new RawMessage( $msgContent );
11 $mockContext = $this->getMockBuilder( 'RequestContext' )->getMock();
12 $mockContext->method( 'msg' )->willReturn( $msg );
13 $special = new UncategorizedCategoriesPage();
14 $special->setContext( $mockContext );
15 $this->assertEquals( [
16 'tables' => [
17 0 => 'page',
18 1 => 'categorylinks',
20 'fields' => [
21 'namespace' => 'page_namespace',
22 'title' => 'page_title',
23 'value' => 'page_title',
25 'conds' => [
26 0 => 'cl_from IS NULL',
27 'page_namespace' => 14,
28 'page_is_redirect' => 0,
29 ] + $expected,
30 'join_conds' => [
31 'categorylinks' => [
32 0 => 'LEFT JOIN',
33 1 => 'cl_from = page_id',
36 ], $special->getQueryInfo() );
39 public function provideTestGetQueryInfoData() {
40 return [
42 "* Stubs\n* Test\n* *\n* * test123",
43 [ 1 => "page_title not in ( 'Stubs','Test','*','*_test123' )" ]
46 "Stubs\n* Test\n* *\n* * test123",
47 [ 1 => "page_title not in ( 'Test','*','*_test123' )" ]
50 "* StubsTest\n* *\n* * test123",
51 [ 1 => "page_title not in ( 'StubsTest','*','*_test123' )" ]
53 [ "", [] ],
54 [ "\n\n\n", [] ],
55 [ "\n", [] ],
56 [ "Test\n*Test2", [ 1 => "page_title not in ( 'Test2' )" ] ],
57 [ "Test", [] ],
58 [ "*Test\nTest2", [ 1 => "page_title not in ( 'Test' )" ] ],
59 [ "Test\nTest2", [] ],