MediaWiki  1.23.6
ContentHandlerTest Class Reference

@group ContentHandler @group Database More...

Inheritance diagram for ContentHandlerTest:
Collaboration diagram for ContentHandlerTest:

Public Member Functions

 testGetContentText_NonTextContent_fail ()
 ContentHandler::getContentText should have thrown an exception for non-text Content object @expectedException MWException @covers ContentHandler::getContentText. More...
 
 testGetContentText_NonTextContent_ignore ()
 @covers ContentHandler::getContentText More...
 
 testGetContentText_NonTextContent_serialize ()
 @covers ContentHandler::getContentText More...
 
 testGetContentText_Null ( $contentHandlerTextFallback)
 @dataProvider dataGetContentText_Null @covers ContentHandler::getContentText More...
 
 testGetContentText_TextContent ( $contentHandlerTextFallback)
 @dataProvider dataGetContentText_TextContent @covers ContentHandler::getContentText More...
 
 testGetDefaultModelFor ( $title, $expectedModelId)
 @dataProvider dataGetDefaultModelFor @covers ContentHandler::getDefaultModelFor More...
 
 testGetForTitle ( $title, $expectedContentModel)
 @dataProvider dataGetDefaultModelFor @covers ContentHandler::getForTitle More...
 
 testGetLocalizedName ( $id, $expected)
 @dataProvider dataGetLocalizedName @covers ContentHandler::getLocalizedName More...
 
 testGetPageLanguage ( $title, $expected)
 @dataProvider dataGetPageLanguage @covers ContentHandler::getPageLanguage More...
 
 testMakeContent ( $data, $title, $modelId, $format, $expectedModelId, $expectedNativeData, $shouldFail)
 @dataProvider dataMakeContent @covers ContentHandler::makeContent More...
 
 testRunLegacyHooks ()
 @covers ContentHandler::runLegacyHooks 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 dataGetContentText_Null ()
 
static dataGetContentText_TextContent ()
 
static dataGetDefaultModelFor ()
 
static dataGetLocalizedName ()
 
static dataGetPageLanguage ()
 
static dataMakeContent ()
 
static dummyHookHandler ( $foo, &$text, $bar)
 
- 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 ()
 
 tearDown ()
 
- 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...
 

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 ContentHandler @group Database

Note
Declare that we are using the database, because otherwise we'll fail in the "databaseless" test run. This is because the LinkHolderArray used by the parser needs database access.

Definition at line 11 of file ContentHandlerTest.php.

Member Function Documentation

◆ dataGetContentText_Null()

static ContentHandlerTest::dataGetContentText_Null ( )
static

Definition at line 152 of file ContentHandlerTest.php.

References array().

◆ dataGetContentText_TextContent()

static ContentHandlerTest::dataGetContentText_TextContent ( )
static

Definition at line 173 of file ContentHandlerTest.php.

References array().

◆ dataGetDefaultModelFor()

static ContentHandlerTest::dataGetDefaultModelFor ( )
static

◆ dataGetLocalizedName()

static ContentHandlerTest::dataGetLocalizedName ( )
static

Definition at line 90 of file ContentHandlerTest.php.

References array(), and CONTENT_MODEL_JAVASCRIPT.

◆ dataGetPageLanguage()

static ContentHandlerTest::dataGetPageLanguage ( )
static

Definition at line 119 of file ContentHandlerTest.php.

References array(), CONTENT_MODEL_JAVASCRIPT, and global.

◆ dataMakeContent()

static ContentHandlerTest::dataMakeContent ( )
static

◆ dummyHookHandler()

static ContentHandlerTest::dummyHookHandler (   $foo,
$text,
  $bar 
)
static

Definition at line 300 of file ContentHandlerTest.php.

◆ setUp()

◆ tearDown()

ContentHandlerTest::tearDown ( )
protected

Reimplemented from MediaWikiTestCase.

Definition at line 41 of file ContentHandlerTest.php.

References $wgContLang, MWNamespace\getCanonicalNamespaces(), and global.

◆ testGetContentText_NonTextContent_fail()

ContentHandlerTest::testGetContentText_NonTextContent_fail ( )

ContentHandler::getContentText should have thrown an exception for non-text Content object @expectedException MWException @covers ContentHandler::getContentText.

Definition at line 199 of file ContentHandlerTest.php.

References ContentHandler\getContentText(), and MediaWikiTestCase\setMwGlobals().

◆ testGetContentText_NonTextContent_ignore()

ContentHandlerTest::testGetContentText_NonTextContent_ignore ( )

◆ testGetContentText_NonTextContent_serialize()

ContentHandlerTest::testGetContentText_NonTextContent_serialize ( )

◆ testGetContentText_Null()

ContentHandlerTest::testGetContentText_Null (   $contentHandlerTextFallback)

@dataProvider dataGetContentText_Null @covers ContentHandler::getContentText

Definition at line 164 of file ContentHandlerTest.php.

References ContentHandler\getContentText(), and MediaWikiTestCase\setMwGlobals().

◆ testGetContentText_TextContent()

ContentHandlerTest::testGetContentText_TextContent (   $contentHandlerTextFallback)

@dataProvider dataGetContentText_TextContent @covers ContentHandler::getContentText

Definition at line 185 of file ContentHandlerTest.php.

References ContentHandler\getContentText(), and MediaWikiTestCase\setMwGlobals().

◆ testGetDefaultModelFor()

ContentHandlerTest::testGetDefaultModelFor (   $title,
  $expectedModelId 
)

@dataProvider dataGetDefaultModelFor @covers ContentHandler::getDefaultModelFor

Definition at line 75 of file ContentHandlerTest.php.

References $title, ContentHandler\getDefaultModelFor(), and Title\newFromText().

◆ testGetForTitle()

ContentHandlerTest::testGetForTitle (   $title,
  $expectedContentModel 
)

@dataProvider dataGetDefaultModelFor @covers ContentHandler::getForTitle

Definition at line 84 of file ContentHandlerTest.php.

References $title, ContentHandler\getForTitle(), and Title\newFromText().

◆ testGetLocalizedName()

ContentHandlerTest::testGetLocalizedName (   $id,
  $expected 
)

@dataProvider dataGetLocalizedName @covers ContentHandler::getLocalizedName

Definition at line 104 of file ContentHandlerTest.php.

References $name, and ContentHandler\getLocalizedName().

◆ testGetPageLanguage()

ContentHandlerTest::testGetPageLanguage (   $title,
  $expected 
)

@dataProvider dataGetPageLanguage @covers ContentHandler::getPageLanguage

Definition at line 139 of file ContentHandlerTest.php.

References $title, ContentHandler\getForTitle(), Title\newFromText(), and wfGetLangObj().

◆ testMakeContent()

ContentHandlerTest::testMakeContent (   $data,
  $title,
  $modelId,
  $format,
  $expectedModelId,
  $expectedNativeData,
  $shouldFail 
)

@dataProvider dataMakeContent @covers ContentHandler::makeContent

Definition at line 259 of file ContentHandlerTest.php.

References $title, fail, ContentHandler\makeContent(), and Title\newFromText().

◆ testRunLegacyHooks()

ContentHandlerTest::testRunLegacyHooks ( )

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