MediaWiki  master
LogFormatterTest.php
Go to the documentation of this file.
1 <?php
2 
4 
9  private static $oldExtMsgFiles;
10 
14  protected $user;
15 
19  protected $title;
20 
24  protected $context;
25 
29  protected $target;
30 
34  protected $user_comment;
35 
36  public static function setUpBeforeClass() {
37  parent::setUpBeforeClass();
38 
40  self::$oldExtMsgFiles = $wgExtensionMessagesFiles;
41  $wgExtensionMessagesFiles['LogTests'] = __DIR__ . '/LogTests.i18n.php';
43  }
44 
45  public static function tearDownAfterClass() {
47  $wgExtensionMessagesFiles = self::$oldExtMsgFiles;
49 
50  parent::tearDownAfterClass();
51  }
52 
53  protected function setUp() {
54  parent::setUp();
55 
56  $this->setMwGlobals( [
57  'wgLogTypes' => [ 'phpunit' ],
58  'wgLogActionsHandlers' => [ 'phpunit/test' => LogFormatter::class,
59  'phpunit/param' => LogFormatter::class ],
60  'wgUser' => User::newFromName( 'Testuser' ),
61  ] );
62 
63  $this->user = User::newFromName( 'Testuser' );
64  $this->title = Title::newFromText( 'SomeTitle' );
65  $this->target = Title::newFromText( 'TestTarget' );
66 
67  $this->context = new RequestContext();
68  $this->context->setUser( $this->user );
69  $this->context->setTitle( $this->title );
70  $this->context->setLanguage( RequestContext::getMain()->getLanguage() );
71 
72  $this->user_comment = '<User comment about action>';
73  }
74 
75  public function newLogEntry( $action, $params ) {
76  $logEntry = new ManualLogEntry( 'phpunit', $action );
77  $logEntry->setPerformer( $this->user );
78  $logEntry->setTarget( $this->title );
79  $logEntry->setComment( 'A very good reason' );
80 
81  $logEntry->setParameters( $params );
82 
83  return $logEntry;
84  }
85 
89  public function testNormalLogParams() {
90  $entry = $this->newLogEntry( 'test', [] );
91  $formatter = LogFormatter::newFromEntry( $entry );
92  $formatter->setContext( $this->context );
93 
94  $formatter->setShowUserToolLinks( false );
95  $paramsWithoutTools = $formatter->getMessageParametersForTesting();
96 
97  $formatter2 = LogFormatter::newFromEntry( $entry );
98  $formatter2->setContext( $this->context );
99  $formatter2->setShowUserToolLinks( true );
100  $paramsWithTools = $formatter2->getMessageParametersForTesting();
101 
102  $userLink = Linker::userLink(
103  $this->user->getId(),
104  $this->user->getName()
105  );
106 
108  $this->user->getId(),
109  $this->user->getName(),
110  $this->user->getEditCount(),
111  false
112  );
113 
114  $titleLink = Linker::link( $this->title, null, [], [] );
115 
116  // $paramsWithoutTools and $paramsWithTools should be only different
117  // in index 0
118  $this->assertEquals( $paramsWithoutTools[1], $paramsWithTools[1] );
119  $this->assertEquals( $paramsWithoutTools[2], $paramsWithTools[2] );
120 
121  $this->assertEquals( $userLink, $paramsWithoutTools[0]['raw'] );
122  $this->assertEquals( $userLink . $userTools, $paramsWithTools[0]['raw'] );
123 
124  $this->assertEquals( $this->user->getName(), $paramsWithoutTools[1] );
125 
126  $this->assertEquals( $titleLink, $paramsWithoutTools[2]['raw'] );
127  }
128 
133  public function testLogParamsTypeRaw() {
134  $params = [ '4:raw:raw' => Linker::link( $this->title, null, [], [] ) ];
135  $expected = Linker::link( $this->title, null, [], [] );
136 
137  $entry = $this->newLogEntry( 'param', $params );
138  $formatter = LogFormatter::newFromEntry( $entry );
139  $formatter->setContext( $this->context );
140 
141  $logParam = $formatter->getActionText();
142 
143  $this->assertEquals( $expected, $logParam );
144  }
145 
150  public function testLogParamsTypeMsg() {
151  $params = [ '4:msg:msg' => 'log-description-phpunit' ];
152  $expected = wfMessage( 'log-description-phpunit' )->text();
153 
154  $entry = $this->newLogEntry( 'param', $params );
155  $formatter = LogFormatter::newFromEntry( $entry );
156  $formatter->setContext( $this->context );
157 
158  $logParam = $formatter->getActionText();
159 
160  $this->assertEquals( $expected, $logParam );
161  }
162 
167  public function testLogParamsTypeMsgContent() {
168  $params = [ '4:msg-content:msgContent' => 'log-description-phpunit' ];
169  $expected = wfMessage( 'log-description-phpunit' )->inContentLanguage()->text();
170 
171  $entry = $this->newLogEntry( 'param', $params );
172  $formatter = LogFormatter::newFromEntry( $entry );
173  $formatter->setContext( $this->context );
174 
175  $logParam = $formatter->getActionText();
176 
177  $this->assertEquals( $expected, $logParam );
178  }
179 
184  public function testLogParamsTypeNumber() {
185  global $wgLang;
186 
187  $params = [ '4:number:number' => 123456789 ];
188  $expected = $wgLang->formatNum( 123456789 );
189 
190  $entry = $this->newLogEntry( 'param', $params );
191  $formatter = LogFormatter::newFromEntry( $entry );
192  $formatter->setContext( $this->context );
193 
194  $logParam = $formatter->getActionText();
195 
196  $this->assertEquals( $expected, $logParam );
197  }
198 
203  public function testLogParamsTypeUserLink() {
204  $params = [ '4:user-link:userLink' => $this->user->getName() ];
205  $expected = Linker::userLink(
206  $this->user->getId(),
207  $this->user->getName()
208  );
209 
210  $entry = $this->newLogEntry( 'param', $params );
211  $formatter = LogFormatter::newFromEntry( $entry );
212  $formatter->setContext( $this->context );
213 
214  $logParam = $formatter->getActionText();
215 
216  $this->assertEquals( $expected, $logParam );
217  }
218 
224  $params = [ '4:user-link:userLink' => ':' ];
225 
226  $entry = $this->newLogEntry( 'param', $params );
227  $formatter = LogFormatter::newFromEntry( $entry );
228 
229  $this->context->setLanguage( Language::factory( 'qqx' ) );
230  $formatter->setContext( $this->context );
231 
232  $logParam = $formatter->getActionText();
233  $this->assertContains( '(empty-username)', $logParam );
234  }
235 
240  public function testLogParamsTypeTitleLink() {
241  $params = [ '4:title-link:titleLink' => $this->title->getText() ];
242  $expected = Linker::link( $this->title, null, [], [] );
243 
244  $entry = $this->newLogEntry( 'param', $params );
245  $formatter = LogFormatter::newFromEntry( $entry );
246  $formatter->setContext( $this->context );
247 
248  $logParam = $formatter->getActionText();
249 
250  $this->assertEquals( $expected, $logParam );
251  }
252 
257  public function testLogParamsTypePlain() {
258  $params = [ '4:plain:plain' => 'Some plain text' ];
259  $expected = 'Some plain text';
260 
261  $entry = $this->newLogEntry( 'param', $params );
262  $formatter = LogFormatter::newFromEntry( $entry );
263  $formatter->setContext( $this->context );
264 
265  $logParam = $formatter->getActionText();
266 
267  $this->assertEquals( $expected, $logParam );
268  }
269 
273  public function testGetPerformerElement() {
274  $entry = $this->newLogEntry( 'param', [] );
275  $entry->setPerformer( new UserIdentityValue( 1328435, 'Test', 0 ) );
276 
277  $formatter = LogFormatter::newFromEntry( $entry );
278  $formatter->setContext( $this->context );
279 
280  $element = $formatter->getPerformerElement();
281  $this->assertContains( 'User:Test', $element );
282  }
283 
288  public function testLogComment() {
289  $entry = $this->newLogEntry( 'test', [] );
290  $formatter = LogFormatter::newFromEntry( $entry );
291  $formatter->setContext( $this->context );
292 
293  $comment = ltrim( Linker::commentBlock( $entry->getComment() ) );
294 
295  $this->assertEquals( $comment, $formatter->getComment() );
296  }
297 
303  public function testApiParamFormatting( $key, $value, $expected ) {
304  $entry = $this->newLogEntry( 'param', [ $key => $value ] );
305  $formatter = LogFormatter::newFromEntry( $entry );
306  $formatter->setContext( $this->context );
307 
308  ApiResult::setIndexedTagName( $expected, 'param' );
309  ApiResult::setArrayType( $expected, 'assoc' );
310 
311  $this->assertEquals( $expected, $formatter->formatParametersForApi() );
312  }
313 
314  public static function provideApiParamFormatting() {
315  return [
316  [ 0, 'value', [ 'value' ] ],
317  [ 'named', 'value', [ 'named' => 'value' ] ],
318  [ '::key', 'value', [ 'key' => 'value' ] ],
319  [ '4::key', 'value', [ 'key' => 'value' ] ],
320  [ '4:raw:key', 'value', [ 'key' => 'value' ] ],
321  [ '4:plain:key', 'value', [ 'key' => 'value' ] ],
322  [ '4:bool:key', '1', [ 'key' => true ] ],
323  [ '4:bool:key', '0', [ 'key' => false ] ],
324  [ '4:number:key', '123', [ 'key' => 123 ] ],
325  [ '4:number:key', '123.5', [ 'key' => 123.5 ] ],
326  [ '4:array:key', [], [ 'key' => [ ApiResult::META_TYPE => 'array' ] ] ],
327  [ '4:assoc:key', [], [ 'key' => [ ApiResult::META_TYPE => 'assoc' ] ] ],
328  [ '4:kvp:key', [], [ 'key' => [ ApiResult::META_TYPE => 'kvp' ] ] ],
329  [ '4:timestamp:key', '20150102030405', [ 'key' => '2015-01-02T03:04:05Z' ] ],
330  [ '4:msg:key', 'parentheses', [
331  'key_key' => 'parentheses',
332  'key_text' => wfMessage( 'parentheses' )->text(),
333  ] ],
334  [ '4:msg-content:key', 'parentheses', [
335  'key_key' => 'parentheses',
336  'key_text' => wfMessage( 'parentheses' )->inContentLanguage()->text(),
337  ] ],
338  [ '4:title:key', 'project:foo', [
339  'key_ns' => NS_PROJECT,
340  'key_title' => Title::newFromText( 'project:foo' )->getFullText(),
341  ] ],
342  [ '4:title-link:key', 'project:foo', [
343  'key_ns' => NS_PROJECT,
344  'key_title' => Title::newFromText( 'project:foo' )->getFullText(),
345  ] ],
346  [ '4:title-link:key', '<invalid>', [
347  'key_ns' => NS_SPECIAL,
348  'key_title' => SpecialPage::getTitleFor( 'Badtitle', '<invalid>' )->getFullText(),
349  ] ],
350  [ '4:user:key', 'foo', [ 'key' => 'Foo' ] ],
351  [ '4:user-link:key', 'foo', [ 'key' => 'Foo' ] ],
352  ];
353  }
354 
397  public function testIrcMsgForLogTypeBlock() {
398  $sep = $this->context->msg( 'colon-separator' )->text();
399 
400  # block/block
401  $this->assertIRCComment(
402  $this->context->msg( 'blocklogentry', 'SomeTitle', 'duration', '(flags)' )->plain()
403  . $sep . $this->user_comment,
404  'block', 'block',
405  [
406  '5::duration' => 'duration',
407  '6::flags' => 'flags',
408  ],
410  );
411  # block/block - legacy
412  $this->assertIRCComment(
413  $this->context->msg( 'blocklogentry', 'SomeTitle', 'duration', '(flags)' )->plain()
414  . $sep . $this->user_comment,
415  'block', 'block',
416  [
417  'duration',
418  'flags',
419  ],
421  '',
422  true
423  );
424  # block/unblock
425  $this->assertIRCComment(
426  $this->context->msg( 'unblocklogentry', 'SomeTitle' )->plain() . $sep . $this->user_comment,
427  'block', 'unblock',
428  [],
430  );
431  # block/reblock
432  $this->assertIRCComment(
433  $this->context->msg( 'reblock-logentry', 'SomeTitle', 'duration', '(flags)' )->plain()
434  . $sep . $this->user_comment,
435  'block', 'reblock',
436  [
437  '5::duration' => 'duration',
438  '6::flags' => 'flags',
439  ],
441  );
442  }
443 
448  public function testIrcMsgForLogTypeDelete() {
449  $sep = $this->context->msg( 'colon-separator' )->text();
450 
451  # delete/delete
452  $this->assertIRCComment(
453  $this->context->msg( 'deletedarticle', 'SomeTitle' )->plain() . $sep . $this->user_comment,
454  'delete', 'delete',
455  [],
457  );
458 
459  # delete/restore
460  $this->assertIRCComment(
461  $this->context->msg( 'undeletedarticle', 'SomeTitle' )->plain() . $sep . $this->user_comment,
462  'delete', 'restore',
463  [],
465  );
466  }
467 
472  public function testIrcMsgForLogTypeNewusers() {
473  $this->assertIRCComment(
474  'New user account',
475  'newusers', 'newusers',
476  []
477  );
478  $this->assertIRCComment(
479  'New user account',
480  'newusers', 'create',
481  []
482  );
483  $this->assertIRCComment(
484  'created new account SomeTitle',
485  'newusers', 'create2',
486  []
487  );
488  $this->assertIRCComment(
489  'Account created automatically',
490  'newusers', 'autocreate',
491  []
492  );
493  }
494 
499  public function testIrcMsgForLogTypeMove() {
500  $move_params = [
501  '4::target' => $this->target->getPrefixedText(),
502  '5::noredir' => 0,
503  ];
504  $sep = $this->context->msg( 'colon-separator' )->text();
505 
506  # move/move
507  $this->assertIRCComment(
508  $this->context->msg( '1movedto2', 'SomeTitle', 'TestTarget' )
509  ->plain() . $sep . $this->user_comment,
510  'move', 'move',
511  $move_params,
513  );
514 
515  # move/move_redir
516  $this->assertIRCComment(
517  $this->context->msg( '1movedto2_redir', 'SomeTitle', 'TestTarget' )
518  ->plain() . $sep . $this->user_comment,
519  'move', 'move_redir',
520  $move_params,
522  );
523  }
524 
529  public function testIrcMsgForLogTypePatrol() {
530  # patrol/patrol
531  $this->assertIRCComment(
532  $this->context->msg( 'patrol-log-line', 'revision 777', '[[SomeTitle]]', '' )->plain(),
533  'patrol', 'patrol',
534  [
535  '4::curid' => '777',
536  '5::previd' => '666',
537  '6::auto' => 0,
538  ]
539  );
540  }
541 
546  public function testIrcMsgForLogTypeProtect() {
547  $protectParams = [
548  '4::description' => '[edit=sysop] (indefinite) ‎[move=sysop] (indefinite)'
549  ];
550  $sep = $this->context->msg( 'colon-separator' )->text();
551 
552  # protect/protect
553  $this->assertIRCComment(
554  $this->context->msg( 'protectedarticle', 'SomeTitle ' . $protectParams['4::description'] )
555  ->plain() . $sep . $this->user_comment,
556  'protect', 'protect',
557  $protectParams,
559  );
560 
561  # protect/unprotect
562  $this->assertIRCComment(
563  $this->context->msg( 'unprotectedarticle', 'SomeTitle' )->plain() . $sep . $this->user_comment,
564  'protect', 'unprotect',
565  [],
567  );
568 
569  # protect/modify
570  $this->assertIRCComment(
571  $this->context->msg(
572  'modifiedarticleprotection',
573  'SomeTitle ' . $protectParams['4::description']
574  )->plain() . $sep . $this->user_comment,
575  'protect', 'modify',
576  $protectParams,
578  );
579 
580  # protect/move_prot
581  $this->assertIRCComment(
582  $this->context->msg( 'movedarticleprotection', 'SomeTitle', 'OldTitle' )
583  ->plain() . $sep . $this->user_comment,
584  'protect', 'move_prot',
585  [
586  '4::oldtitle' => 'OldTitle'
587  ],
589  );
590  }
591 
596  public function testIrcMsgForLogTypeUpload() {
597  $sep = $this->context->msg( 'colon-separator' )->text();
598 
599  # upload/upload
600  $this->assertIRCComment(
601  $this->context->msg( 'uploadedimage', 'SomeTitle' )->plain() . $sep . $this->user_comment,
602  'upload', 'upload',
603  [],
605  );
606 
607  # upload/overwrite
608  $this->assertIRCComment(
609  $this->context->msg( 'overwroteimage', 'SomeTitle' )->plain() . $sep . $this->user_comment,
610  'upload', 'overwrite',
611  [],
613  );
614  }
615 
620  public function testIrcMsgForLogTypeMerge() {
621  $sep = $this->context->msg( 'colon-separator' )->text();
622 
623  # merge/merge
624  $this->assertIRCComment(
625  $this->context->msg( 'pagemerge-logentry', 'SomeTitle', 'Dest', 'timestamp' )->plain()
626  . $sep . $this->user_comment,
627  'merge', 'merge',
628  [
629  '4::dest' => 'Dest',
630  '5::mergepoint' => 'timestamp',
631  ],
633  );
634  }
635 
640  public function testIrcMsgForLogTypeImport() {
641  $sep = $this->context->msg( 'colon-separator' )->text();
642 
643  # import/upload
644  $msg = $this->context->msg( 'import-logentry-upload', 'SomeTitle' )->plain() .
645  $sep .
647  $this->assertIRCComment(
648  $msg,
649  'import', 'upload',
650  [],
651  $this->user_comment
652  );
653 
654  # import/interwiki
655  $msg = $this->context->msg( 'import-logentry-interwiki', 'SomeTitle' )->plain() .
656  $sep .
658  $this->assertIRCComment(
659  $msg,
660  'import', 'interwiki',
661  [],
662  $this->user_comment
663  );
664  }
665 
674  protected function assertIRCComment( $expected, $type, $action, $params,
675  $comment = null, $msg = '', $legacy = false
676  ) {
677  $logEntry = new ManualLogEntry( $type, $action );
678  $logEntry->setPerformer( $this->user );
679  $logEntry->setTarget( $this->title );
680  if ( $comment !== null ) {
681  $logEntry->setComment( $comment );
682  }
683  $logEntry->setParameters( $params );
684  $logEntry->setLegacy( $legacy );
685 
686  $formatter = LogFormatter::newFromEntry( $logEntry );
687  $formatter->setContext( $this->context );
688 
689  // Apply the same transformation as done in IRCColourfulRCFeedFormatter::getLine for rc_comment
690  $ircRcComment = IRCColourfulRCFeedFormatter::cleanupForIRC( $formatter->getIRCActionComment() );
691 
692  $this->assertEquals(
693  $expected,
694  $ircRcComment,
695  $msg
696  );
697  }
698 
699 }
magicword txt Magic Words are some phrases used in the wikitext They are used for two that looks like templates but that don t accept any parameter *Parser functions(like {{fullurl:...}}, {{#special:...}}) $wgExtensionMessagesFiles['ExtensionNameMagic']
Definition: magicword.txt:43
testIrcMsgForLogTypeBlock()
The testIrcMsgForAction* tests are supposed to cover the hacky LogFormatter::getIRCActionText / T3650...
testIrcMsgForLogTypePatrol()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
testIrcMsgForLogTypeDelete()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:193
testLogParamsTypeRaw()
LogFormatter::newFromEntry LogFormatter::getActionText.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static newFromEntry(LogEntry $entry)
Constructs a new formatter suitable for given entry.
static provideApiParamFormatting()
static userToolLinksRedContribs( $userId, $userText, $edits=null, $useParentheses=true)
Alias for userToolLinks( $userId, $userText, true );.
Definition: Linker.php:1021
$value
const NS_SPECIAL
Definition: Defines.php:49
const META_TYPE
Key for the &#39;type&#39; metadata item.
Definition: ApiResult.php:110
testNormalLogParams()
LogFormatter::newFromEntry.
title
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:616
static cleanupForIRC( $text)
Remove newlines, carriage returns and decode html entites.
testLogParamsTypePlain()
LogFormatter::newFromEntry LogFormatter::getActionText.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
Definition: hooks.txt:1983
const NS_PROJECT
Definition: Defines.php:64
$wgLang
Definition: Setup.php:922
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt
static getMain()
Get the RequestContext object associated with the main request.
testIrcMsgForLogTypeMerge()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
testIrcMsgForLogTypeUpload()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
testLogParamsTypeUserLink_empty()
LogFormatter::newFromEntry LogFormatter::getActionText.
testIrcMsgForLogTypeNewusers()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
Wikitext formatted, in the key only.
Definition: distributors.txt:9
$params
testLogParamsTypeNumber()
LogFormatter::newFromEntry LogFormatter::getActionText.
testApiParamFormatting( $key, $value, $expected)
provideApiParamFormatting LogFormatter::formatParametersForApi LogFormatter::formatParameterValueForA...
static tearDownAfterClass()
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
Definition: hooks.txt:773
Value object representing a user&#39;s identity.
testIrcMsgForLogTypeProtect()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
static factory( $code)
Get a cached or new language object for a given language code.
Definition: Language.php:215
testLogComment()
LogFormatter::newFromEntry LogFormatter::getComment.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don&#39;t need a full Title object...
Definition: SpecialPage.php:83
testLogParamsTypeTitleLink()
LogFormatter::newFromEntry LogFormatter::getActionText.
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
Definition: Linker.php:895
testIrcMsgForLogTypeImport()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
testGetPerformerElement()
LogFormatter::getPerformerElement.
newLogEntry( $action, $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
testLogParamsTypeUserLink()
LogFormatter::newFromEntry LogFormatter::getActionText.
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
testLogParamsTypeMsgContent()
LogFormatter::newFromEntry LogFormatter::getActionText.
testIrcMsgForLogTypeMove()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
static clearCaches()
Intended for tests that may change configuration in a way that invalidates caches.
Definition: Language.php:285
testLogParamsTypeMsg()
LogFormatter::newFromEntry LogFormatter::getActionText.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:535
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
Definition: ApiResult.php:728
static link( $target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
Definition: Linker.php:85
RequestContext $context
static commentBlock( $comment, $title=null, $local=false, $wikiId=null, $useParentheses=true)
Wrap a comment in standard punctuation and formatting if it&#39;s non-empty, otherwise return empty strin...
Definition: Linker.php:1544
assertIRCComment( $expected, $type, $action, $params, $comment=null, $msg='', $legacy=false)
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:322