MediaWiki  1.23.1
TitleTest Class Reference

@group Database ^— needed for language cache stuff More...

Inheritance diagram for TitleTest:
Collaboration diagram for TitleTest:

Public Member Functions

 dataTestIsValidMoveOperation ()
 Provides test parameter values for testIsValidMoveOperation() More...
 
 dataWgWhitelistReadRegexp ()
 Provides test parameter values for testWgWhitelistReadRegexp() More...
 
 flattenErrorsArray ( $errors)
 
 provideGetFragment ()
 
 provideGetTitleValue ()
 
 provideNewFromTitleValue ()
 
 testBug31100FixSpecialName ( $text, $expectedParam)
 @dataProvider provideBug31100 @covers Title::fixSpecialName More...
 
 testConvertByteClassToUnicodeClass ( $byteClass, $unicodeClass)
 @dataProvider provideConvertByteClassToUnicodeClass @covers Title::convertByteClassToUnicodeClass More...
 
 testGetBaseText ( $title, $expected, $msg='')
 @dataProvider provideBaseTitleCases @covers Title::getBaseText More...
 
 testGetFragment ( $full, $fragment)
 @dataProvider provideGetFragment More...
 
 testGetPageViewLanguage ( $expected, $titleText, $contLang, $lang, $variant, $msg='')
 @dataProvider provideGetPageViewLanguage @covers Title::getPageViewLanguage More...
 
 testGetRootText ( $title, $expected, $msg='')
 @dataProvider provideRootTitleCases @covers Title::getRootText More...
 
 testGetSubpageText ( $title, $expected, $msg='')
 
 testGetTitleValue ( $text)
 @dataProvider provideGetTitleValue More...
 
 testIsValidMoveOperation ( $source, $target, $expected)
 Auth-less test of Title::isValidMoveOperation. More...
 
 testLegalChars ()
 @covers Title::legalChars More...
 
 testNewFromTitleValue (TitleValue $value)
 @dataProvider provideNewFromTitleValue More...
 
 testSecureAndSplit ()
 See also mediawiki.Title.test.js @covers Title::secureAndSplit. More...
 
 testWgWhitelistReadRegexp ( $whitelistRegexp, $source, $action, $expected)
 Auth-less test of Title::userCan. 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 provideBaseTitleCases ()
 
static provideBug31100 ()
 
static provideConvertByteClassToUnicodeClass ()
 
static provideGetPageViewLanguage ()
 
static provideRootTitleCases ()
 
static provideSubpageTitleCases ()
 
static provideTestIsValidMoveOperation ()
 
- 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

 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

@group Database ^— needed for language cache stuff

@group Title

Definition at line 9 of file TitleTest.php.

Member Function Documentation

◆ dataTestIsValidMoveOperation()

TitleTest::dataTestIsValidMoveOperation ( )

Provides test parameter values for testIsValidMoveOperation()

Definition at line 270 of file TitleTest.php.

References array().

◆ dataWgWhitelistReadRegexp()

TitleTest::dataWgWhitelistReadRegexp ( )

Provides test parameter values for testWgWhitelistReadRegexp()

Definition at line 345 of file TitleTest.php.

References array().

◆ flattenErrorsArray()

TitleTest::flattenErrorsArray (   $errors)

Definition at line 381 of file TitleTest.php.

References $error, array(), and as.

Referenced by testIsValidMoveOperation(), and testWgWhitelistReadRegexp().

◆ provideBaseTitleCases()

static TitleTest::provideBaseTitleCases ( )
static

Definition at line 472 of file TitleTest.php.

References array(), and message.

◆ provideBug31100()

static TitleTest::provideBug31100 ( )
static

Definition at line 235 of file TitleTest.php.

References array().

◆ provideConvertByteClassToUnicodeClass()

static TitleTest::provideConvertByteClassToUnicodeClass ( )
static

Definition at line 149 of file TitleTest.php.

References array().

◆ provideGetFragment()

TitleTest::provideGetFragment ( )

Definition at line 562 of file TitleTest.php.

References array().

◆ provideGetPageViewLanguage()

static TitleTest::provideGetPageViewLanguage ( )
static

Definition at line 421 of file TitleTest.php.

References array().

◆ provideGetTitleValue()

TitleTest::provideGetTitleValue ( )

Definition at line 541 of file TitleTest.php.

References array().

◆ provideNewFromTitleValue()

TitleTest::provideNewFromTitleValue ( )

Definition at line 521 of file TitleTest.php.

References array(), NS_MAIN, and NS_USER.

◆ provideRootTitleCases()

static TitleTest::provideRootTitleCases ( )
static

Definition at line 492 of file TitleTest.php.

References array(), and message.

◆ provideSubpageTitleCases()

static TitleTest::provideSubpageTitleCases ( )
static

Definition at line 513 of file TitleTest.php.

References array(), and message.

◆ provideTestIsValidMoveOperation()

static TitleTest::provideTestIsValidMoveOperation ( )
static

Definition at line 390 of file TitleTest.php.

References array().

◆ setUp()

TitleTest::setUp ( )
protected

Reimplemented from MediaWikiTestCase.

Definition at line 10 of file TitleTest.php.

References array(), Language\factory(), and MediaWikiTestCase\setMwGlobals().

◆ testBug31100FixSpecialName()

TitleTest::testBug31100FixSpecialName (   $text,
  $expectedParam 
)

@dataProvider provideBug31100 @covers Title::fixSpecialName

Todo:
give this test a real name explaining what is being tested here

Definition at line 223 of file TitleTest.php.

References $title, and Title\newFromText().

◆ testConvertByteClassToUnicodeClass()

TitleTest::testConvertByteClassToUnicodeClass (   $byteClass,
  $unicodeClass 
)

@dataProvider provideConvertByteClassToUnicodeClass @covers Title::convertByteClassToUnicodeClass

Definition at line 214 of file TitleTest.php.

References Title\convertByteClassToUnicodeClass().

◆ testGetBaseText()

TitleTest::testGetBaseText (   $title,
  $expected,
  $msg = '' 
)

@dataProvider provideBaseTitleCases @covers Title::getBaseText

Definition at line 464 of file TitleTest.php.

References $title, and Title\newFromText().

◆ testGetFragment()

TitleTest::testGetFragment (   $full,
  $fragment 
)

@dataProvider provideGetFragment

Parameters
$full
$fragment

Definition at line 586 of file TitleTest.php.

References $title, and Title\newFromText().

◆ testGetPageViewLanguage()

TitleTest::testGetPageViewLanguage (   $expected,
  $titleText,
  $contLang,
  $lang,
  $variant,
  $msg = '' 
)

@dataProvider provideGetPageViewLanguage @covers Title::getPageViewLanguage

Definition at line 401 of file TitleTest.php.

References $title, $wgContLang, $wgLang, Language\factory(), global, and Title\newFromText().

◆ testGetRootText()

TitleTest::testGetRootText (   $title,
  $expected,
  $msg = '' 
)

@dataProvider provideRootTitleCases @covers Title::getRootText

Definition at line 484 of file TitleTest.php.

References $title, and Title\newFromText().

◆ testGetSubpageText()

TitleTest::testGetSubpageText (   $title,
  $expected,
  $msg = '' 
)
Todo:
Handle $wgNamespacesWithSubpages cases @dataProvider provideSubpageTitleCases @covers Title::getSubpageText

Definition at line 505 of file TitleTest.php.

References $title, and Title\newFromText().

◆ testGetTitleValue()

TitleTest::testGetTitleValue (   $text)

@dataProvider provideGetTitleValue

Definition at line 552 of file TitleTest.php.

References $title, $value, and Title\newFromText().

◆ testIsValidMoveOperation()

TitleTest::testIsValidMoveOperation (   $source,
  $target,
  $expected 
)

Auth-less test of Title::isValidMoveOperation.

@group Database

Parameters
string$source
string$target
array | string | bool$expectedRequired error @dataProvider provideTestIsValidMoveOperation @covers Title::isValidMoveOperation

Definition at line 253 of file TitleTest.php.

References $error, $source, $title, array(), as, flattenErrorsArray(), and Title\newFromText().

◆ testLegalChars()

TitleTest::testLegalChars ( )

@covers Title::legalChars

Definition at line 26 of file TitleTest.php.

References as, and Title\legalChars().

◆ testNewFromTitleValue()

TitleTest::testNewFromTitleValue ( TitleValue  $value)

@dataProvider provideNewFromTitleValue

Definition at line 532 of file TitleTest.php.

References $title, $value, and Title\newFromTitleValue().

◆ testSecureAndSplit()

TitleTest::testSecureAndSplit ( )

See also mediawiki.Title.test.js @covers Title::secureAndSplit.

Todo:
This method should be split into 2 separate tests each with a provider
Note
: This mainly tests MediaWikiTitleCodec::parseTitle().

Definition at line 45 of file TitleTest.php.

References array(), as, Title\newFromText(), and MediaWikiTestCase\setMwGlobals().

◆ testWgWhitelistReadRegexp()

TitleTest::testWgWhitelistReadRegexp (   $whitelistRegexp,
  $source,
  $action,
  $expected 
)

Auth-less test of Title::userCan.

Parameters
array$whitelistRegexp
string$source
string$action
array | string | bool$expectedRequired error

@covers Title::checkReadPermissions @dataProvider dataWgWhitelistReadRegexp

Definition at line 288 of file TitleTest.php.

References $error, $source, $title, $wgUser, array(), as, flattenErrorsArray(), global, and Title\newFromDBkey().


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