MediaWiki  master
LogFormatterTest Class Reference

Database. More...

Inheritance diagram for LogFormatterTest:
Collaboration diagram for LogFormatterTest:

Public Member Functions

 newLogEntry ( $action, $params)
 
 testApiParamFormatting ( $key, $value, $expected)
 provideApiParamFormatting LogFormatter::formatParametersForApi LogFormatter::formatParameterValueForApi More...
 
 testGetPerformerElement ()
 LogFormatter::getPerformerElement. More...
 
 testIrcMsgForLogTypeBlock ()
 The testIrcMsgForAction* tests are supposed to cover the hacky LogFormatter::getIRCActionText / T36508. More...
 
 testIrcMsgForLogTypeDelete ()
 LogFormatter::getIRCActionComment LogFormatter::getIRCActionText. More...
 
 testIrcMsgForLogTypeImport ()
 LogFormatter::getIRCActionComment LogFormatter::getIRCActionText. More...
 
 testIrcMsgForLogTypeMerge ()
 LogFormatter::getIRCActionComment LogFormatter::getIRCActionText. More...
 
 testIrcMsgForLogTypeMove ()
 LogFormatter::getIRCActionComment LogFormatter::getIRCActionText. More...
 
 testIrcMsgForLogTypeNewusers ()
 LogFormatter::getIRCActionComment LogFormatter::getIRCActionText. More...
 
 testIrcMsgForLogTypePatrol ()
 LogFormatter::getIRCActionComment LogFormatter::getIRCActionText. More...
 
 testIrcMsgForLogTypeProtect ()
 LogFormatter::getIRCActionComment LogFormatter::getIRCActionText. More...
 
 testIrcMsgForLogTypeUpload ()
 LogFormatter::getIRCActionComment LogFormatter::getIRCActionText. More...
 
 testLogComment ()
 LogFormatter::newFromEntry LogFormatter::getComment. More...
 
 testLogParamsTypeMsg ()
 LogFormatter::newFromEntry LogFormatter::getActionText. More...
 
 testLogParamsTypeMsgContent ()
 LogFormatter::newFromEntry LogFormatter::getActionText. More...
 
 testLogParamsTypeNumber ()
 LogFormatter::newFromEntry LogFormatter::getActionText. More...
 
 testLogParamsTypePlain ()
 LogFormatter::newFromEntry LogFormatter::getActionText. More...
 
 testLogParamsTypeRaw ()
 LogFormatter::newFromEntry LogFormatter::getActionText. More...
 
 testLogParamsTypeTitleLink ()
 LogFormatter::newFromEntry LogFormatter::getActionText. More...
 
 testLogParamsTypeUserLink ()
 LogFormatter::newFromEntry LogFormatter::getActionText. More...
 
 testLogParamsTypeUserLink_empty ()
 LogFormatter::newFromEntry LogFormatter::getActionText. More...
 
 testNormalLogParams ()
 LogFormatter::newFromEntry. More...
 

Static Public Member Functions

static provideApiParamFormatting ()
 
static setUpBeforeClass ()
 
static tearDownAfterClass ()
 

Protected Member Functions

 assertIRCComment ( $expected, $type, $action, $params, $comment=null, $msg='', $legacy=false)
 
 setUp ()
 
- Protected Member Functions inherited from MediaWikiLangTestCase
 setUp ()
 

Protected Attributes

RequestContext $context
 
Title $target
 
Title $title
 
User $user
 
string $user_comment
 

Static Private Attributes

static $oldExtMsgFiles
 

Detailed Description

Database.

Definition at line 8 of file LogFormatterTest.php.

Member Function Documentation

◆ assertIRCComment()

LogFormatterTest::assertIRCComment (   $expected,
  $type,
  $action,
  $params,
  $comment = null,
  $msg = '',
  $legacy = false 
)
protected
Parameters
string$expectedExpected IRC text without colors codes
string$typeLog type (move, delete, suppress, patrol ...)
string$actionA log type action
array$params
string$comment(optional) A comment for the log action
string$msg(optional) A message for PHPUnit :-)

Definition at line 674 of file LogFormatterTest.php.

References $params, $type, IRCColourfulRCFeedFormatter\cleanupForIRC(), LogFormatter\newFromEntry(), null, title, and user.

Referenced by testIrcMsgForLogTypeBlock(), testIrcMsgForLogTypeDelete(), testIrcMsgForLogTypeImport(), testIrcMsgForLogTypeMerge(), testIrcMsgForLogTypeMove(), testIrcMsgForLogTypeNewusers(), testIrcMsgForLogTypePatrol(), testIrcMsgForLogTypeProtect(), and testIrcMsgForLogTypeUpload().

◆ newLogEntry()

◆ provideApiParamFormatting()

static LogFormatterTest::provideApiParamFormatting ( )
static

◆ setUp()

LogFormatterTest::setUp ( )
protected

◆ setUpBeforeClass()

static LogFormatterTest::setUpBeforeClass ( )
static

◆ tearDownAfterClass()

static LogFormatterTest::tearDownAfterClass ( )
static

◆ testApiParamFormatting()

LogFormatterTest::testApiParamFormatting (   $key,
  $value,
  $expected 
)

◆ testGetPerformerElement()

LogFormatterTest::testGetPerformerElement ( )

◆ testIrcMsgForLogTypeBlock()

LogFormatterTest::testIrcMsgForLogTypeBlock ( )

The testIrcMsgForAction* tests are supposed to cover the hacky LogFormatter::getIRCActionText / T36508.

Third parties bots listen to those messages. They are clever enough to fetch the i18n messages from the wiki and then analyze the IRC feed to reverse engineer the $1, $2 messages. One thing bots can not detect is when MediaWiki change the meaning of a message like what happened when we deployed 1.19. $1 became the user performing the action which broke basically all bots around.

Should cover the following log actions (which are most commonly used by bots):

  • block/block
  • block/unblock
  • block/reblock
  • delete/delete
  • delete/restore
  • newusers/create
  • newusers/create2
  • newusers/autocreate
  • move/move
  • move/move_redir
  • protect/protect
  • protect/modifyprotect
  • protect/unprotect
  • protect/move_prot
  • upload/upload
  • merge/merge
  • import/upload
  • import/interwiki

As well as the following Auto Edit Summaries:

Definition at line 397 of file LogFormatterTest.php.

References $user_comment, assertIRCComment(), and true.

◆ testIrcMsgForLogTypeDelete()

LogFormatterTest::testIrcMsgForLogTypeDelete ( )

◆ testIrcMsgForLogTypeImport()

LogFormatterTest::testIrcMsgForLogTypeImport ( )

◆ testIrcMsgForLogTypeMerge()

LogFormatterTest::testIrcMsgForLogTypeMerge ( )

◆ testIrcMsgForLogTypeMove()

LogFormatterTest::testIrcMsgForLogTypeMove ( )

◆ testIrcMsgForLogTypeNewusers()

LogFormatterTest::testIrcMsgForLogTypeNewusers ( )

◆ testIrcMsgForLogTypePatrol()

LogFormatterTest::testIrcMsgForLogTypePatrol ( )

◆ testIrcMsgForLogTypeProtect()

LogFormatterTest::testIrcMsgForLogTypeProtect ( )

◆ testIrcMsgForLogTypeUpload()

LogFormatterTest::testIrcMsgForLogTypeUpload ( )

◆ testLogComment()

LogFormatterTest::testLogComment ( )

◆ testLogParamsTypeMsg()

LogFormatterTest::testLogParamsTypeMsg ( )

◆ testLogParamsTypeMsgContent()

LogFormatterTest::testLogParamsTypeMsgContent ( )

◆ testLogParamsTypeNumber()

LogFormatterTest::testLogParamsTypeNumber ( )

◆ testLogParamsTypePlain()

LogFormatterTest::testLogParamsTypePlain ( )

◆ testLogParamsTypeRaw()

LogFormatterTest::testLogParamsTypeRaw ( )

◆ testLogParamsTypeTitleLink()

LogFormatterTest::testLogParamsTypeTitleLink ( )

◆ testLogParamsTypeUserLink()

LogFormatterTest::testLogParamsTypeUserLink ( )

◆ testLogParamsTypeUserLink_empty()

LogFormatterTest::testLogParamsTypeUserLink_empty ( )

◆ testNormalLogParams()

Member Data Documentation

◆ $context

RequestContext LogFormatterTest::$context
protected

Definition at line 24 of file LogFormatterTest.php.

◆ $oldExtMsgFiles

LogFormatterTest::$oldExtMsgFiles
staticprivate

Definition at line 9 of file LogFormatterTest.php.

◆ $target

Title LogFormatterTest::$target
protected

Definition at line 29 of file LogFormatterTest.php.

◆ $title

Title LogFormatterTest::$title
protected

Definition at line 19 of file LogFormatterTest.php.

◆ $user

User LogFormatterTest::$user
protected

Definition at line 14 of file LogFormatterTest.php.

◆ $user_comment


The documentation for this class was generated from the following file: