MediaWiki  REL1_31
SpecialUncategorizedcategoriesTest.php
Go to the documentation of this file.
1 <?php
10  public function testGetQueryInfo( $msgContent, $expected ) {
11  $msg = new RawMessage( $msgContent );
12  $mockContext = $this->getMockBuilder( RequestContext::class )->getMock();
13  $mockContext->method( 'msg' )->willReturn( $msg );
15  $special->setContext( $mockContext );
16  $this->assertEquals( [
17  'tables' => [
18  0 => 'page',
19  1 => 'categorylinks',
20  ],
21  'fields' => [
22  'namespace' => 'page_namespace',
23  'title' => 'page_title',
24  ],
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',
34  ],
35  ],
36  ], $special->getQueryInfo() );
37  }
38 
39  public function provideTestGetQueryInfoData() {
40  return [
41  [
42  "* Stubs\n* Test\n* *\n* * test123",
43  [ 1 => "page_title not in ( 'Stubs','Test','*','*_test123' )" ]
44  ],
45  [
46  "Stubs\n* Test\n* *\n* * test123",
47  [ 1 => "page_title not in ( 'Test','*','*_test123' )" ]
48  ],
49  [
50  "* StubsTest\n* *\n* * test123",
51  [ 1 => "page_title not in ( 'StubsTest','*','*_test123' )" ]
52  ],
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", [] ],
60  ];
61  }
62 }
UncategorizedCategoriesPageTest
Tests for Special:Uncategorizedcategories.
Definition: SpecialUncategorizedcategoriesTest.php:5
UncategorizedCategoriesPage
A special page that lists uncategorized categories.
Definition: SpecialUncategorizedcategories.php:29
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:37
UncategorizedCategoriesPageTest\testGetQueryInfo
testGetQueryInfo( $msgContent, $expected)
provideTestGetQueryInfoData UncategorizedCategoriesPage::getQueryInfo
Definition: SpecialUncategorizedcategoriesTest.php:10
MediaWikiTestCase
Definition: MediaWikiTestCase.php:17
UncategorizedCategoriesPageTest\provideTestGetQueryInfoData
provideTestGetQueryInfoData()
Definition: SpecialUncategorizedcategoriesTest.php:39
$special
this hook is for auditing only RecentChangesLinked and Watchlist $special
Definition: hooks.txt:998
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:56
RawMessage
Variant of the Message class.
Definition: RawMessage.php:34