MediaWiki  1.28.0
ApiQueryWatchlistRawIntegrationTest.php
Go to the documentation of this file.
1 <?php
2 
4 
13 
14  protected function setUp() {
15  parent::setUp();
16  self::$users['ApiQueryWatchlistRawIntegrationTestUser']
17  = $this->getMutableTestUser();
18  self::$users['ApiQueryWatchlistRawIntegrationTestUser2']
19  = $this->getMutableTestUser();
20  $this->doLogin( 'ApiQueryWatchlistRawIntegrationTestUser' );
21  }
22 
23  private function getLoggedInTestUser() {
24  return self::$users['ApiQueryWatchlistRawIntegrationTestUser']->getUser();
25  }
26 
27  private function getNotLoggedInTestUser() {
28  return self::$users['ApiQueryWatchlistRawIntegrationTestUser2']->getUser();
29  }
30 
31  private function getWatchedItemStore() {
32  return MediaWikiServices::getInstance()->getWatchedItemStore();
33  }
34 
35  private function doListWatchlistRawRequest( array $params = [] ) {
36  return $this->doApiRequest( array_merge(
37  [ 'action' => 'query', 'list' => 'watchlistraw' ],
38  $params
39  ) );
40  }
41 
42  private function doGeneratorWatchlistRawRequest( array $params = [] ) {
43  return $this->doApiRequest( array_merge(
44  [ 'action' => 'query', 'generator' => 'watchlistraw' ],
45  $params
46  ) );
47  }
48 
49  private function getItemsFromApiResponse( array $response ) {
50  return $response[0]['watchlistraw'];
51  }
52 
54  $store = $this->getWatchedItemStore();
55  $store->addWatch(
56  $this->getLoggedInTestUser(),
57  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage' )
58  );
59 
61 
62  $this->assertArrayHasKey( 'watchlistraw', $result[0] );
63 
64  $this->assertEquals(
65  [
66  [
67  'ns' => 0,
68  'title' => 'ApiQueryWatchlistRawIntegrationTestPage',
69  ],
70  ],
72  );
73  }
74 
76  $target = new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage' );
77  $otherUser = $this->getNotLoggedInTestUser();
78 
79  $store = $this->getWatchedItemStore();
80 
81  $store->addWatch( $this->getLoggedInTestUser(), $target );
82  $store->updateNotificationTimestamp(
83  $otherUser,
84  $target,
85  '20151212010101'
86  );
87 
88  $result = $this->doListWatchlistRawRequest( [ 'wrprop' => 'changed' ] );
89 
90  $this->assertEquals(
91  [
92  [
93  'ns' => 0,
94  'title' => 'ApiQueryWatchlistRawIntegrationTestPage',
95  'changed' => '2015-12-12T01:01:01Z',
96  ],
97  ],
99  );
100  }
101 
102  public function testNamespaceParam() {
103  $store = $this->getWatchedItemStore();
104 
105  $store->addWatchBatchForUser( $this->getLoggedInTestUser(), [
106  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage' ),
107  new TitleValue( 1, 'ApiQueryWatchlistRawIntegrationTestPage' ),
108  ] );
109 
110  $result = $this->doListWatchlistRawRequest( [ 'wrnamespace' => '0' ] );
111 
112  $this->assertEquals(
113  [
114  [
115  'ns' => 0,
116  'title' => 'ApiQueryWatchlistRawIntegrationTestPage',
117  ],
118  ],
120  );
121  }
122 
123  public function testShowChangedParams() {
124  $subjectTarget = new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage' );
125  $talkTarget = new TitleValue( 1, 'ApiQueryWatchlistRawIntegrationTestPage' );
126  $otherUser = $this->getNotLoggedInTestUser();
127 
128  $store = $this->getWatchedItemStore();
129 
130  $store->addWatchBatchForUser( $this->getLoggedInTestUser(), [
131  $subjectTarget,
132  $talkTarget,
133  ] );
134  $store->updateNotificationTimestamp(
135  $otherUser,
136  $subjectTarget,
137  '20151212010101'
138  );
139 
140  $resultChanged = $this->doListWatchlistRawRequest(
141  [ 'wrprop' => 'changed', 'wrshow' => WatchedItemQueryService::FILTER_CHANGED ]
142  );
143  $resultNotChanged = $this->doListWatchlistRawRequest(
144  [ 'wrprop' => 'changed', 'wrshow' => WatchedItemQueryService::FILTER_NOT_CHANGED ]
145  );
146 
147  $this->assertEquals(
148  [
149  [
150  'ns' => 0,
151  'title' => 'ApiQueryWatchlistRawIntegrationTestPage',
152  'changed' => '2015-12-12T01:01:01Z',
153  ],
154  ],
155  $this->getItemsFromApiResponse( $resultChanged )
156  );
157 
158  $this->assertEquals(
159  [
160  [
161  'ns' => 1,
162  'title' => 'Talk:ApiQueryWatchlistRawIntegrationTestPage',
163  ],
164  ],
165  $this->getItemsFromApiResponse( $resultNotChanged )
166  );
167  }
168 
169  public function testLimitParam() {
170  $store = $this->getWatchedItemStore();
171 
172  $store->addWatchBatchForUser( $this->getLoggedInTestUser(), [
173  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage1' ),
174  new TitleValue( 1, 'ApiQueryWatchlistRawIntegrationTestPage1' ),
175  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage2' ),
176  ] );
177 
178  $resultWithoutLimit = $this->doListWatchlistRawRequest();
179  $resultWithLimit = $this->doListWatchlistRawRequest( [ 'wrlimit' => 2 ] );
180 
181  $this->assertEquals(
182  [
183  [
184  'ns' => 0,
185  'title' => 'ApiQueryWatchlistRawIntegrationTestPage1',
186  ],
187  [
188  'ns' => 0,
189  'title' => 'ApiQueryWatchlistRawIntegrationTestPage2',
190  ],
191  [
192  'ns' => 1,
193  'title' => 'Talk:ApiQueryWatchlistRawIntegrationTestPage1',
194  ],
195  ],
196  $this->getItemsFromApiResponse( $resultWithoutLimit )
197  );
198  $this->assertEquals(
199  [
200  [
201  'ns' => 0,
202  'title' => 'ApiQueryWatchlistRawIntegrationTestPage1',
203  ],
204  [
205  'ns' => 0,
206  'title' => 'ApiQueryWatchlistRawIntegrationTestPage2',
207  ],
208  ],
209  $this->getItemsFromApiResponse( $resultWithLimit )
210  );
211 
212  $this->assertArrayNotHasKey( 'continue', $resultWithoutLimit[0] );
213  $this->assertArrayHasKey( 'continue', $resultWithLimit[0] );
214  $this->assertArrayHasKey( 'wrcontinue', $resultWithLimit[0]['continue'] );
215  }
216 
217  public function testDirParams() {
218  $store = $this->getWatchedItemStore();
219 
220  $store->addWatchBatchForUser( $this->getLoggedInTestUser(), [
221  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage1' ),
222  new TitleValue( 1, 'ApiQueryWatchlistRawIntegrationTestPage1' ),
223  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage2' ),
224  ] );
225 
226  $resultDirAsc = $this->doListWatchlistRawRequest( [ 'wrdir' => 'ascending' ] );
227  $resultDirDesc = $this->doListWatchlistRawRequest( [ 'wrdir' => 'descending' ] );
228 
229  $this->assertEquals(
230  [
231  [
232  'ns' => 0,
233  'title' => 'ApiQueryWatchlistRawIntegrationTestPage1',
234  ],
235  [
236  'ns' => 0,
237  'title' => 'ApiQueryWatchlistRawIntegrationTestPage2',
238  ],
239  [
240  'ns' => 1,
241  'title' => 'Talk:ApiQueryWatchlistRawIntegrationTestPage1',
242  ],
243  ],
244  $this->getItemsFromApiResponse( $resultDirAsc )
245  );
246 
247  $this->assertEquals(
248  [
249  [
250  'ns' => 1,
251  'title' => 'Talk:ApiQueryWatchlistRawIntegrationTestPage1',
252  ],
253  [
254  'ns' => 0,
255  'title' => 'ApiQueryWatchlistRawIntegrationTestPage2',
256  ],
257  [
258  'ns' => 0,
259  'title' => 'ApiQueryWatchlistRawIntegrationTestPage1',
260  ],
261  ],
262  $this->getItemsFromApiResponse( $resultDirDesc )
263  );
264  }
265 
266  public function testAscendingIsDefaultOrder() {
267  $store = $this->getWatchedItemStore();
268 
269  $store->addWatchBatchForUser( $this->getLoggedInTestUser(), [
270  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage1' ),
271  new TitleValue( 1, 'ApiQueryWatchlistRawIntegrationTestPage1' ),
272  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage2' ),
273  ] );
274 
275  $resultNoDir = $this->doListWatchlistRawRequest();
276  $resultAscDir = $this->doListWatchlistRawRequest( [ 'wrdir' => 'ascending' ] );
277 
278  $this->assertEquals(
279  $this->getItemsFromApiResponse( $resultNoDir ),
280  $this->getItemsFromApiResponse( $resultAscDir )
281  );
282  }
283 
284  public function testFromTitleParam() {
285  $store = $this->getWatchedItemStore();
286 
287  $store->addWatchBatchForUser( $this->getLoggedInTestUser(), [
288  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage1' ),
289  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage2' ),
290  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage3' ),
291  ] );
292 
294  'wrfromtitle' => 'ApiQueryWatchlistRawIntegrationTestPage2',
295  ] );
296 
297  $this->assertEquals(
298  [
299  [
300  'ns' => 0,
301  'title' => 'ApiQueryWatchlistRawIntegrationTestPage2',
302  ],
303  [
304  'ns' => 0,
305  'title' => 'ApiQueryWatchlistRawIntegrationTestPage3',
306  ],
307  ],
309  );
310  }
311 
312  public function testToTitleParam() {
313  $store = $this->getWatchedItemStore();
314 
315  $store->addWatchBatchForUser( $this->getLoggedInTestUser(), [
316  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage1' ),
317  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage2' ),
318  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage3' ),
319  ] );
320 
322  'wrtotitle' => 'ApiQueryWatchlistRawIntegrationTestPage2',
323  ] );
324 
325  $this->assertEquals(
326  [
327  [
328  'ns' => 0,
329  'title' => 'ApiQueryWatchlistRawIntegrationTestPage1',
330  ],
331  [
332  'ns' => 0,
333  'title' => 'ApiQueryWatchlistRawIntegrationTestPage2',
334  ],
335  ],
337  );
338  }
339 
340  public function testContinueParam() {
341  $store = $this->getWatchedItemStore();
342 
343  $store->addWatchBatchForUser( $this->getLoggedInTestUser(), [
344  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage1' ),
345  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage2' ),
346  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage3' ),
347  ] );
348 
349  $firstResult = $this->doListWatchlistRawRequest( [ 'wrlimit' => 2 ] );
350  $continuationParam = $firstResult[0]['continue']['wrcontinue'];
351 
352  $this->assertEquals( '0|ApiQueryWatchlistRawIntegrationTestPage3', $continuationParam );
353 
354  $continuedResult = $this->doListWatchlistRawRequest( [ 'wrcontinue' => $continuationParam ] );
355 
356  $this->assertEquals(
357  [
358  [
359  'ns' => 0,
360  'title' => 'ApiQueryWatchlistRawIntegrationTestPage3',
361  ]
362  ],
363  $this->getItemsFromApiResponse( $continuedResult )
364  );
365  }
366 
368  return [
369  [
370  [
371  'wrfromtitle' => 'ApiQueryWatchlistRawIntegrationTestPage1',
372  'wrtotitle' => 'ApiQueryWatchlistRawIntegrationTestPage2',
373  ],
374  [
375  [ 'ns' => 0, 'title' => 'ApiQueryWatchlistRawIntegrationTestPage1' ],
376  [ 'ns' => 0, 'title' => 'ApiQueryWatchlistRawIntegrationTestPage2' ],
377  ],
378  ],
379  [
380  [
381  'wrfromtitle' => 'ApiQueryWatchlistRawIntegrationTestPage1',
382  'wrcontinue' => '0|ApiQueryWatchlistRawIntegrationTestPage3',
383  ],
384  [
385  [ 'ns' => 0, 'title' => 'ApiQueryWatchlistRawIntegrationTestPage3' ],
386  ],
387  ],
388  [
389  [
390  'wrtotitle' => 'ApiQueryWatchlistRawIntegrationTestPage3',
391  'wrcontinue' => '0|ApiQueryWatchlistRawIntegrationTestPage2',
392  ],
393  [
394  [ 'ns' => 0, 'title' => 'ApiQueryWatchlistRawIntegrationTestPage2' ],
395  [ 'ns' => 0, 'title' => 'ApiQueryWatchlistRawIntegrationTestPage3' ],
396  ],
397  ],
398  [
399  [
400  'wrfromtitle' => 'ApiQueryWatchlistRawIntegrationTestPage1',
401  'wrtotitle' => 'ApiQueryWatchlistRawIntegrationTestPage3',
402  'wrcontinue' => '0|ApiQueryWatchlistRawIntegrationTestPage3',
403  ],
404  [
405  [ 'ns' => 0, 'title' => 'ApiQueryWatchlistRawIntegrationTestPage3' ],
406  ],
407  ],
408  ];
409  }
410 
414  public function testFromTitleToTitleContinueCombo( array $params, array $expectedItems ) {
415  $store = $this->getWatchedItemStore();
416 
417  $store->addWatchBatchForUser( $this->getLoggedInTestUser(), [
418  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage1' ),
419  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage2' ),
420  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage3' ),
421  ] );
422 
423  $result = $this->doListWatchlistRawRequest( $params );
424 
425  $this->assertEquals( $expectedItems, $this->getItemsFromApiResponse( $result ) );
426  }
427 
429  return [
430  [
431  [
432  'wrfromtitle' => 'ApiQueryWatchlistRawIntegrationTestPage2',
433  'wrtotitle' => 'ApiQueryWatchlistRawIntegrationTestPage1',
434  ]
435  ],
436  [
437  [
438  'wrfromtitle' => 'ApiQueryWatchlistRawIntegrationTestPage1',
439  'wrtotitle' => 'ApiQueryWatchlistRawIntegrationTestPage2',
440  'wrdir' => 'descending',
441  ]
442  ],
443  [
444  [
445  'wrtotitle' => 'ApiQueryWatchlistRawIntegrationTestPage1',
446  'wrcontinue' => '0|ApiQueryWatchlistRawIntegrationTestPage2',
447  ]
448  ],
449  ];
450  }
451 
456  $store = $this->getWatchedItemStore();
457 
458  $store->addWatchBatchForUser( $this->getLoggedInTestUser(), [
459  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage1' ),
460  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage2' ),
461  ] );
462 
463  $result = $this->doListWatchlistRawRequest( $params );
464 
465  $this->assertEmpty( $this->getItemsFromApiResponse( $result ) );
466  $this->assertArrayNotHasKey( 'continue', $result[0] );
467  }
468 
469  public function testOwnerAndTokenParams() {
470  $otherUser = $this->getNotLoggedInTestUser();
471  $otherUser->setOption( 'watchlisttoken', '1234567890' );
472  $otherUser->saveSettings();
473 
474  $store = $this->getWatchedItemStore();
475  $store->addWatchBatchForUser( $otherUser, [
476  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage1' ),
477  new TitleValue( 1, 'ApiQueryWatchlistRawIntegrationTestPage1' ),
478  ] );
479 
480  ObjectCache::getMainWANInstance()->clearProcessCache();
482  'wrowner' => $otherUser->getName(),
483  'wrtoken' => '1234567890',
484  ] );
485 
486  $this->assertEquals(
487  [
488  [
489  'ns' => 0,
490  'title' => 'ApiQueryWatchlistRawIntegrationTestPage1',
491  ],
492  [
493  'ns' => 1,
494  'title' => 'Talk:ApiQueryWatchlistRawIntegrationTestPage1',
495  ],
496  ],
498  );
499  }
500 
502  $otherUser = $this->getNotLoggedInTestUser();
503  $otherUser->setOption( 'watchlisttoken', '1234567890' );
504  $otherUser->saveSettings();
505 
506  $this->setExpectedException( UsageException::class, 'Incorrect watchlist token provided' );
507 
508  $this->doListWatchlistRawRequest( [
509  'wrowner' => $otherUser->getName(),
510  'wrtoken' => 'wrong-token',
511  ] );
512  }
513 
515  $this->setExpectedException( UsageException::class, 'Incorrect watchlist token provided' );
516 
517  $this->doListWatchlistRawRequest( [
518  'wrowner' => $this->getNotLoggedInTestUser()->getName(),
519  'wrtoken' => 'some-watchlist-token',
520  ] );
521  }
522 
524  $store = $this->getWatchedItemStore();
525  $store->addWatch(
526  $this->getLoggedInTestUser(),
527  new TitleValue( 0, 'ApiQueryWatchlistRawIntegrationTestPage' )
528  );
529 
530  $result = $this->doGeneratorWatchlistRawRequest( [ 'prop' => 'info' ] );
531 
532  $this->assertArrayHasKey( 'query', $result[0] );
533  $this->assertArrayHasKey( 'pages', $result[0]['query'] );
534  $this->assertCount( 1, $result[0]['query']['pages'] );
535 
536  // $result[0]['query']['pages'] uses page ids as keys
537  $item = array_values( $result[0]['query']['pages'] )[0];
538 
539  $this->assertEquals( 0, $item['ns'] );
540  $this->assertEquals( 'ApiQueryWatchlistRawIntegrationTestPage', $item['title'] );
541  }
542 
543 }
static getMainWANInstance()
Get the main WAN cache object.
the array() calling protocol came about after MediaWiki 1.4rc1.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
testFromTitleToTitleContinueSelfContradictoryCombo(array $params)
fromTitleToTitleContinueSelfContradictoryComboProvider
Represents a page (or page fragment) title within MediaWiki.
Definition: TitleValue.php:36
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 MediaWikiServices
Definition: injection.txt:23
this hook is for auditing only $response
Definition: hooks.txt:802
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message.Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item.Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page.Return false to stop further processing of the tag $reader:XMLReader object &$pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision.Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag.Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload.Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports.&$fullInterwikiPrefix:Interwiki prefix, may contain colons.&$pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable.Can be used to lazy-load the import sources list.&$importSources:The value of $wgImportSources.Modify as necessary.See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page.$context:IContextSource object &$pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect.&$title:Title object for the current page &$request:WebRequest &$ignoreRedirect:boolean to skip redirect check &$target:Title/string of redirect target &$article:Article object 'InternalParseBeforeLinks':during Parser's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InternalParseBeforeSanitize':during Parser's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings.Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not.Return true without providing an interwiki to continue interwiki search.$prefix:interwiki prefix we are looking for.&$iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user's email has been invalidated successfully.$user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification.Callee may modify $url and $query, URL will be constructed as $url.$query &$url:URL to index.php &$query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) &$article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() &$ip:IP being check &$result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from &$allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn't match your organization.$addr:The e-mail address entered by the user &$result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user &$result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we're looking for a messages file for &$file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED!Use $magicWords in a file listed in $wgExtensionMessagesFiles instead.Use this to define synonyms of magic words depending of the language &$magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces.Do not use this hook to add namespaces.Use CanonicalNamespaces for that.&$namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED!Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead.Use to define aliases of special pages names depending of the language &$specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names.&$names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page's language links.This is called in various places to allow extensions to define the effective language links for a page.$title:The page's Title.&$links:Associative array mapping language codes to prefixed links of the form"language:title".&$linkFlags:Associative array mapping prefixed links to arrays of flags.Currently unused, but planned to provide support for marking individual language links in the UI, e.g.for featured articles. 'LanguageSelector':Hook to change the language selector available on a page.$out:The output page.$cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED!Use HtmlPageLinkRendererBegin instead.Used when generating internal and interwiki links in Linker::link(), before processing starts.Return false to skip default processing and return $ret.See documentation for Linker::link() for details on the expected meanings of parameters.$skin:the Skin object $target:the Title that the link is pointing to &$html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1934
testFromTitleToTitleContinueCombo(array $params, array $expectedItems)
fromTitleToTitleContinueComboProvider
doLogin($testUser= 'sysop')
$params
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:35
doApiRequest(array $params, array $session=null, $appendModule=false, User $user=null)
Does the API request and returns the result.
Definition: ApiTestCase.php:71
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:52
static getMutableTestUser($groups=[])
Convenience method for getting a mutable test user.