MediaWiki  1.23.3
StatusTest Class Reference
Inheritance diagram for StatusTest:
Collaboration diagram for StatusTest:

Public Member Functions

 testCanConstruct ()
 
 testCleanParams ( $cleanCallback, $params, $expected)
 @dataProvider provideCleanParams @covers Status::cleanParams More...
 
 testErrorWithMessage ( $mockDetails)
 @dataProvider provideMockMessageDetails @covers Status::error @covers Status::getErrorsArray @covers Status::getStatusArray More...
 
 testFatalWithMessage ( $mockDetails)
 @dataProvider provideMockMessageDetails @covers Status::fatal @covers Status::getErrorsArray @covers Status::getStatusArray More...
 
 testGetErrorMessage ()
 @covers Status::getErrorMessage More...
 
 testGetErrorMessageArray ()
 @covers Status::getErrorMessageArray More...
 
 testGetErrorsByType ()
 @covers Status::getErrorsByType More...
 
 testGetHtml (Status $status, $wikitext, $html)
 @dataProvider provideGetWikiTextAndHtml @covers Status::getHtml More...
 
 testGetMessage (Status $status, $expectedParams=array(), $expectedKey)
 @dataProvider provideGetMessage @covers Status::getMessage More...
 
 testGetStatusArrayWithNonObjectMessages ( $nonObjMsg)
 @dataProvider provideNonObjectMessages @covers Status::getStatusArray More...
 
 testGetValue ()
 @covers Status::getValue More...
 
 testGetWikiText (Status $status, $wikitext, $html)
 @dataProvider provideGetWikiTextAndHtml @covers Status::getWikiText More...
 
 testHasMessage ()
 @covers Status::hasMessage More...
 
 testIsGood ( $ok, $errors, $expected)
 @dataProvider provideIsGood @covers Status::isGood More...
 
 testIsOk ( $ok)
 @dataProvider provideIsOk @covers Status::isOk More...
 
 testMerge ()
 @covers Status::merge More...
 
 testMergeWithOverwriteValue ()
 @covers Status::merge More...
 
 testNewFatalWithMessage ()
 @covers Status::newFatal More...
 
 testNewFatalWithString ()
 @covers Status::newFatal More...
 
 testNewGood ( $value=null)
 @dataProvider provideValues @covers Status::newGood More...
 
 testReplaceMessage ()
 @covers Status::replaceMessage More...
 
 testSetResult ( $ok, $value=null)
 @dataProvider provideSetResult @covers Status::setResult More...
 
 testWakeUpSanitizesCallback ()
 @covers Status::__wakeup More...
 
 testWarningWithMessage ( $mockDetails)
 @dataProvider provideMockMessageDetails @covers Status::warning @covers Status::getWarningsArray @covers Status::getStatusArray More...
 
- Public Member Functions inherited from MediaWikiTestCase
 __call ( $func, $args)
 
 __construct ( $name=null, array $data=array(), $dataName='')
 
 addDBData ()
 Stub. More...
 
 dbPrefix ()
 
 getCliArg ( $offset)
 
 hideDeprecated ( $function)
 Don't throw a warning if $function is deprecated and called later. More...
 
 needsDB ()
 
 run (PHPUnit_Framework_TestResult $result=null)
 
 setCliArg ( $offset, $value)
 
 testMediaWikiTestCaseParentSetupCalled ()
 Make sure MediaWikiTestCase extending classes have called their parent setUp method. More...
 
 usesTemporaryTables ()
 

Static Public Member Functions

static provideCleanParams ()
 
static provideGetMessage ()
 
static provideGetWikiTextAndHtml ()
 
static provideIsGood ()
 
static provideIsOk ()
 
static provideMockMessageDetails ()
 
static provideNonObjectMessages ()
 
static provideSetResult ()
 
static provideValues ()
 
- Static Public Member Functions inherited from MediaWikiTestCase
static listTables ( $db)
 
static setupTestDB (DatabaseBase $db, $prefix)
 Creates an empty skeleton of the wiki database by cloning its structure to equivalent tables using the given $prefix. More...
 
static teardownTestDB ()
 Restores MediaWiki to using the table set (table prefix) it was using before setupTestDB() was called. More...
 

Protected Member Functions

 getMockMessage ( $key='key', $params=array())
 
 getMockMessages ( $messageDetails)
 
- Protected Member Functions inherited from MediaWikiLangTestCase
 setUp ()
 
- Protected Member Functions inherited from MediaWikiTestCase
 arrayWrap (array $elements)
 Utility method taking an array of elements and wrapping each element in it's own array. More...
 
 assertArrayEquals (array $expected, array $actual, $ordered=false, $named=false)
 Assert that two arrays are equal. More...
 
 assertException ( $code, $expected='Exception', $message='')
 Asserts that an exception of the specified type occurs when running the provided code. More...
 
 assertHTMLEquals ( $expected, $actual, $msg='')
 Put each HTML element on its own line and then equals() the results. More...
 
 assertSelect ( $table, $fields, $condition, array $expectedRows)
 Asserts that the given database query yields the rows given by $expectedRows. More...
 
 assertType ( $type, $actual, $message='')
 Asserts the type of the provided value. More...
 
 assertTypeOrValue ( $type, $actual, $value=false, $message='')
 Asserts that the provided variable is of the specified internal type or equals the $value argument. More...
 
 assertValidHtmlDocument ( $html)
 Asserts that the given string is valid HTML document. More...
 
 assertValidHtmlSnippet ( $html)
 Asserts that the given string is a valid HTML snippet. More...
 
 checkDbIsSupported ()
 
 checkHasDiff3 ()
 Check, if $wgDiff3 is set and ready to merge Will mark the calling test as skipped, if not ready. More...
 
 checkHasGzip ()
 Check whether we have the 'gzip' commandline utility, will skip the test whenever "gzip -V" fails. More...
 
 checkPHPExtension ( $extName)
 Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded. More...
 
 getDefaultWikitextNS ()
 Returns the ID of a namespace that defaults to Wikitext. More...
 
 getNewTempDirectory ()
 obtains a new temporary directory More...
 
 getNewTempFile ()
 Obtains a new temporary file name. More...
 
 isWikitextNS ( $ns)
 Returns true if the given namespace defaults to Wikitext according to $wgNamespaceContentModels. More...
 
 mergeMwGlobalArrayValue ( $name, $values)
 Merges the given values into a MW global array variable. More...
 
 objectAssociativeSort (array &$array)
 Does an associative sort that works for objects. More...
 
 setMwGlobals ( $pairs, $value=null)
 
 stashMwGlobals ( $globalKeys)
 Stashes the global, will be restored in tearDown() More...
 
 tearDown ()
 

Additional Inherited Members

- Public Attributes inherited from MediaWikiTestCase
const DB_PREFIX = 'unittest_'
 Table name prefixes. More...
 
const ORA_DB_PREFIX = 'ut_'
 
- Static Public Attributes inherited from MediaWikiTestCase
static $users
 
- Static Protected Member Functions inherited from MediaWikiTestCase
static stripStringKeys (&$r)
 Utility function for eliminating all string keys from an array. More...
 
- Protected Attributes inherited from MediaWikiTestCase
DatabaseBase $db
 
array $supportedDBs
 
array $tablesUsed = array()
 

Detailed Description

Author
Adam Shorland

Definition at line 6 of file StatusTest.php.

Member Function Documentation

◆ getMockMessage()

StatusTest::getMockMessage (   $key = 'key',
  $params = array() 
)
protected

Definition at line 192 of file StatusTest.php.

References $params.

Referenced by getMockMessages(), testMerge(), and testMergeWithOverwriteValue().

◆ getMockMessages()

StatusTest::getMockMessages (   $messageDetails)
protected
Parameters
array$messageDetailseg. array( 'KEY' => array(/PARAMS/) )
Returns
Message[]

Definition at line 209 of file StatusTest.php.

References $messages, array(), as, and getMockMessage().

Referenced by testErrorWithMessage(), testFatalWithMessage(), and testWarningWithMessage().

◆ provideCleanParams()

static StatusTest::provideCleanParams ( )
static

Definition at line 279 of file StatusTest.php.

References $value, and array().

◆ provideGetMessage()

static StatusTest::provideGetMessage ( )
static
Returns
array of arrays with values; 0 => status object 1 => expected Message parameters (with no context) 2 => expected Message key

Definition at line 389 of file StatusTest.php.

References array(), and Status\warning().

◆ provideGetWikiTextAndHtml()

static StatusTest::provideGetWikiTextAndHtml ( )
static
Returns
array of arrays with values; 0 => status object 1 => expected string (with no context)

Definition at line 317 of file StatusTest.php.

References array().

◆ provideIsGood()

static StatusTest::provideIsGood ( )
static

Definition at line 116 of file StatusTest.php.

References array().

◆ provideIsOk()

static StatusTest::provideIsOk ( )
static

Definition at line 89 of file StatusTest.php.

References array().

◆ provideMockMessageDetails()

static StatusTest::provideMockMessageDetails ( )
static

Definition at line 217 of file StatusTest.php.

References array().

◆ provideNonObjectMessages()

static StatusTest::provideNonObjectMessages ( )
static

Definition at line 556 of file StatusTest.php.

References array().

◆ provideSetResult()

static StatusTest::provideSetResult ( )
static

Definition at line 70 of file StatusTest.php.

References array().

◆ provideValues()

static StatusTest::provideValues ( )
static

Definition at line 24 of file StatusTest.php.

References array().

◆ testCanConstruct()

StatusTest::testCanConstruct ( )

Definition at line 8 of file StatusTest.php.

◆ testCleanParams()

StatusTest::testCleanParams (   $cleanCallback,
  $params,
  $expected 
)

@dataProvider provideCleanParams @covers Status::cleanParams

Definition at line 270 of file StatusTest.php.

References $params.

◆ testErrorWithMessage()

StatusTest::testErrorWithMessage (   $mockDetails)

@dataProvider provideMockMessageDetails @covers Status::error @covers Status::getErrorsArray @covers Status::getStatusArray

Definition at line 153 of file StatusTest.php.

References $messages, array(), as, and getMockMessages().

◆ testFatalWithMessage()

StatusTest::testFatalWithMessage (   $mockDetails)

@dataProvider provideMockMessageDetails @covers Status::fatal @covers Status::getErrorsArray @covers Status::getStatusArray

Definition at line 175 of file StatusTest.php.

References $messages, array(), as, and getMockMessages().

◆ testGetErrorMessage()

StatusTest::testGetErrorMessage ( )

@covers Status::getErrorMessage

Definition at line 465 of file StatusTest.php.

References $params, and array().

◆ testGetErrorMessageArray()

StatusTest::testGetErrorMessageArray ( )

@covers Status::getErrorMessageArray

Definition at line 482 of file StatusTest.php.

References $params, array(), and as.

◆ testGetErrorsByType()

StatusTest::testGetErrorsByType ( )

◆ testGetHtml()

StatusTest::testGetHtml ( Status  $status,
  $wikitext,
  $html 
)

@dataProvider provideGetWikiTextAndHtml @covers Status::getHtml

Todo:
test long and short context messages generated through this method this can not really be done now due to use of $this->getWikiText using wfMessage()->plain() It is possible to mock such methods but only if namespaces are used

Definition at line 308 of file StatusTest.php.

References $html, and Status\getHTML().

◆ testGetMessage()

StatusTest::testGetMessage ( Status  $status,
  $expectedParams = array(),
  $expectedKey 
)

@dataProvider provideGetMessage @covers Status::getMessage

Todo:
test long and short context messages generated through this method

Definition at line 376 of file StatusTest.php.

References Status\getMessage().

◆ testGetStatusArrayWithNonObjectMessages()

StatusTest::testGetStatusArrayWithNonObjectMessages (   $nonObjMsg)

@dataProvider provideNonObjectMessages @covers Status::getStatusArray

Definition at line 542 of file StatusTest.php.

References Status\getWarningsArray(), and Status\warning().

◆ testGetValue()

StatusTest::testGetValue ( )

@covers Status::getValue

Definition at line 99 of file StatusTest.php.

◆ testGetWikiText()

StatusTest::testGetWikiText ( Status  $status,
  $wikitext,
  $html 
)

@dataProvider provideGetWikiTextAndHtml @covers Status::getWikiText

Todo:
test long and short context messages generated through this method this can not really be done now due to use of wfMessage()->plain() It is possible to mock such methods but only if namespaces are used

Definition at line 297 of file StatusTest.php.

References Status\getWikiText().

◆ testHasMessage()

StatusTest::testHasMessage ( )

@covers Status::hasMessage

Definition at line 259 of file StatusTest.php.

◆ testIsGood()

StatusTest::testIsGood (   $ok,
  $errors,
  $expected 
)

@dataProvider provideIsGood @covers Status::isGood

Definition at line 109 of file StatusTest.php.

References $ok.

◆ testIsOk()

StatusTest::testIsOk (   $ok)

@dataProvider provideIsOk @covers Status::isOk

Definition at line 83 of file StatusTest.php.

References $ok.

◆ testMerge()

StatusTest::testMerge ( )

@covers Status::merge

Definition at line 227 of file StatusTest.php.

References getMockMessage().

◆ testMergeWithOverwriteValue()

StatusTest::testMergeWithOverwriteValue ( )

@covers Status::merge

Definition at line 242 of file StatusTest.php.

References getMockMessage().

◆ testNewFatalWithMessage()

StatusTest::testNewFatalWithMessage ( )

@covers Status::newFatal

Definition at line 37 of file StatusTest.php.

References Status\newFatal().

◆ testNewFatalWithString()

StatusTest::testNewFatalWithString ( )

@covers Status::newFatal

Definition at line 51 of file StatusTest.php.

References Status\newFatal().

◆ testNewGood()

StatusTest::testNewGood (   $value = null)

@dataProvider provideValues @covers Status::newGood

Definition at line 17 of file StatusTest.php.

References $value, and Status\newGood().

◆ testReplaceMessage()

StatusTest::testReplaceMessage ( )

@covers Status::replaceMessage

Definition at line 451 of file StatusTest.php.

References array(), Status\error(), and Status\replaceMessage().

◆ testSetResult()

StatusTest::testSetResult (   $ok,
  $value = null 
)

@dataProvider provideSetResult @covers Status::setResult

Definition at line 63 of file StatusTest.php.

References $ok, and $value.

◆ testWakeUpSanitizesCallback()

StatusTest::testWakeUpSanitizesCallback ( )

@covers Status::__wakeup

Definition at line 529 of file StatusTest.php.

References $value, and Status\__wakeup().

◆ testWarningWithMessage()

StatusTest::testWarningWithMessage (   $mockDetails)

@dataProvider provideMockMessageDetails @covers Status::warning @covers Status::getWarningsArray @covers Status::getStatusArray

Definition at line 131 of file StatusTest.php.

References $messages, array(), as, and getMockMessages().


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