*/
class ContentHandlerTest extends MediaWikiTestCase {
- public function setUp() {
+ protected function setUp() {
global $wgContLang;
parent::setUp();
$wgContLang->resetNamespaces();
}
- public function tearDown() {
+ protected function tearDown() {
global $wgContLang;
// Reset namespace cache
/**
* @dataProvider dataGetDefaultModelFor
+ * @covers ContentHandler::getDefaultModelFor
*/
public function testGetDefaultModelFor( $title, $expectedModelId ) {
$title = Title::newFromText( $title );
/**
* @dataProvider dataGetDefaultModelFor
+ * @covers ContentHandler::getForTitle
*/
public function testGetForTitle( $title, $expectedContentModel ) {
$title = Title::newFromText( $title );
/**
* @dataProvider dataGetLocalizedName
+ * @covers ContentHandler::getLocalizedName
*/
public function testGetLocalizedName( $id, $expected ) {
$name = ContentHandler::getLocalizedName( $id );
/**
* @dataProvider dataGetPageLanguage
+ * @covers ContentHandler::getPageLanguage
*/
public function testGetPageLanguage( $title, $expected ) {
if ( is_string( $title ) ) {
/**
* @dataProvider dataGetContentText_Null
+ * @covers ContentHandler::getContentText
*/
public function testGetContentText_Null( $contentHandlerTextFallback ) {
$this->setMwGlobals( 'wgContentHandlerTextFallback', $contentHandlerTextFallback );
/**
* @dataProvider dataGetContentText_TextContent
+ * @covers ContentHandler::getContentText
*/
public function testGetContentText_TextContent( $contentHandlerTextFallback ) {
$this->setMwGlobals( 'wgContentHandlerTextFallback', $contentHandlerTextFallback );
/**
* ContentHandler::getContentText should have thrown an exception for non-text Content object
* @expectedException MWException
+ * @covers ContentHandler::getContentText
*/
public function testGetContentText_NonTextContent_fail() {
$this->setMwGlobals( 'wgContentHandlerTextFallback', 'fail' );
ContentHandler::getContentText( $content );
}
+ /**
+ * @covers ContentHandler::getContentText
+ */
public function testGetContentText_NonTextContent_serialize() {
$this->setMwGlobals( 'wgContentHandlerTextFallback', 'serialize' );
$this->assertEquals( $content->serialize(), $text );
}
+ /**
+ * @covers ContentHandler::getContentText
+ */
public function testGetContentText_NonTextContent_ignore() {
$this->setMwGlobals( 'wgContentHandlerTextFallback', 'ignore' );
/**
* @dataProvider dataMakeContent
+ * @covers ContentHandler::makeContent
*/
public function testMakeContent( $data, $title, $modelId, $format, $expectedModelId, $expectedNativeData, $shouldFail ) {
$title = Title::newFromText( $title );
}
*/
+ /**
+ * @covers ContentHandler::runLegacyHooks
+ */
public function testRunLegacyHooks() {
Hooks::register( 'testRunLegacyHooks', __CLASS__ . '::dummyHookHandler' );