/**
* @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' );
);
}
+ /**
+ * @covers CssContent::getModel
+ */
public function testGetModel() {
$content = $this->newContent( 'hello world.' );
$this->assertEquals( CONTENT_MODEL_CSS, $content->getModel() );
}
+ /**
+ * @covers CssContent::getContentHandler
+ */
public function testGetContentHandler() {
$content = $this->newContent( 'hello world.' );
/**
* @dataProvider dataEquals
+ * @covers CssContent::equals
*/
public function testEquals( Content $a, Content $b = null, $equal = false ) {
$this->assertEquals( $equal, $a->equals( $b ) );
);
}
+ /**
+ * @covers JavaScriptContent::addSectionHeader
+ */
public function testAddSectionHeader() {
$content = $this->newContent( 'hello world' );
$c = $content->addSectionHeader( 'test' );
);
}
+ /**
+ * @covers JavaScriptContent::matchMagicWord
+ */
public function testMatchMagicWord() {
$mw = MagicWord::get( "staticredirect" );
$this->assertFalse( $content->matchMagicWord( $mw ), "should not have matched magic word, since it's not wikitext" );
}
+ /**
+ * @covers JavaScriptContent::updateRedirect
+ */
public function testUpdateRedirect() {
$target = Title::newFromText( "testUpdateRedirect_target" );
$this->assertTrue( $content->equals( $newContent ), "content should be unchanged since it's not wikitext" );
}
+ /**
+ * @covers JavaScriptContent::getModel
+ */
public function testGetModel() {
$content = $this->newContent( "hello world." );
$this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $content->getModel() );
}
+ /**
+ * @covers JavaScriptContent::getContentHandler
+ */
public function testGetContentHandler() {
$content = $this->newContent( "hello world." );
/**
* @dataProvider dataGetParserOutput
+ * @covers TextContent::getParserOutput
*/
public function testGetParserOutput( $title, $model, $text, $expectedHtml, $expectedFields = null ) {
$title = Title::newFromText( $title );
/**
* @dataProvider dataPreSaveTransform
+ * @covers TextContent::preSaveTransform
*/
public function testPreSaveTransform( $text, $expected ) {
global $wgContLang;
/**
* @dataProvider dataPreloadTransform
+ * @covers TextContent::preloadTransform
*/
public function testPreloadTransform( $text, $expected ) {
global $wgContLang;
/**
* @dataProvider dataGetRedirectTarget
+ * @covers TextContent::getRedirectTarget
*/
public function testGetRedirectTarget( $text, $expected ) {
$content = $this->newContent( $text );
/**
* @dataProvider dataGetRedirectTarget
+ * @covers TextContent::isRedirect
*/
public function testIsRedirect( $text, $expected ) {
$content = $this->newContent( $text );
/**
* @dataProvider dataIsCountable
* @group Database
+ * @covers TextContent::isCountable
*/
public function testIsCountable( $text, $hasLinks, $mode, $expected ) {
$this->setMwGlobals( 'wgArticleCountMethod', $mode );
/**
* @dataProvider dataGetTextForSummary
+ * @covers TextContent::getTextForSummary
*/
public function testGetTextForSummary( $text, $maxlength, $expected ) {
$content = $this->newContent( $text );
$this->assertEquals( $expected, $content->getTextForSummary( $maxlength ) );
}
+ /**
+ * @covers TextContent::getTextForSearchIndex
+ */
public function testGetTextForSearchIndex() {
$content = $this->newContent( 'hello world.' );
$this->assertEquals( 'hello world.', $content->getTextForSearchIndex() );
}
+ /**
+ * @covers TextContent::copy
+ */
public function testCopy() {
$content = $this->newContent( 'hello world.' );
$copy = $content->copy();
$this->assertEquals( 'hello world.', $copy->getNativeData() );
}
+ /**
+ * @covers TextContent::getSize
+ */
public function testGetSize() {
$content = $this->newContent( 'hello world.' );
$this->assertEquals( 12, $content->getSize() );
}
+ /**
+ * @covers TextContent::getNativeData
+ */
public function testGetNativeData() {
$content = $this->newContent( 'hello world.' );
$this->assertEquals( 'hello world.', $content->getNativeData() );
}
+ /**
+ * @covers TextContent::getWikitextForTransclusion
+ */
public function testGetWikitextForTransclusion() {
$content = $this->newContent( 'hello world.' );
$this->assertEquals( 'hello world.', $content->getWikitextForTransclusion() );
}
+ /**
+ * @covers TextContent::getModel
+ */
public function testGetModel() {
$content = $this->newContent( "hello world." );
$this->assertEquals( CONTENT_MODEL_TEXT, $content->getModel() );
}
+ /**
+ * @covers TextContent::getContentHandler
+ */
public function testGetContentHandler() {
$content = $this->newContent( "hello world." );
/**
* @dataProvider dataIsEmpty
+ * @covers TextContent::isEmpty
*/
public function testIsEmpty( $text, $empty ) {
$content = $this->newContent( $text );
/**
* @dataProvider dataEquals
+ * @covers TextContent::equals
*/
public function testEquals( Content $a, Content $b = null, $equal = false ) {
$this->assertEquals( $equal, $a->equals( $b ) );
/**
* @dataProvider dataGetDeletionUpdates
+ * @covers TextContent::getDeletionUpdates
*/
public function testDeletionUpdates( $title, $model, $text, $expectedStuff ) {
$ns = $this->getDefaultWikitextNS();
/**
* @dataProvider provideConvert
+ * @covers TextContent::convert
*/
public function testConvert( $text, $model, $lossy, $expectedNative ) {
$content = $this->newContent( $text );
$this->handler = ContentHandler::getForModelID( CONTENT_MODEL_WIKITEXT );
}
+ /**
+ * @covers WikitextContentHandler::serializeContent
+ */
public function testSerializeContent() {
$content = new WikitextContent( 'hello world' );
}
}
+ /**
+ * @covers WikitextContentHandler::unserializeContent
+ */
public function testUnserializeContent() {
$content = $this->handler->unserializeContent( 'hello world' );
$this->assertEquals( 'hello world', $content->getNativeData() );
}
}
+ /**
+ * @covers WikitextContentHandler::makeEmptyContent
+ */
public function testMakeEmptyContent() {
$content = $this->handler->makeEmptyContent();
* @dataProvider provideMakeRedirectContent
* @param Title|string $title Title object or string for Title::newFromText()
* @param string $expected Serialized form of the content object built
+ * @covers WikitextContentHandler::makeRedirectContent
*/
public function testMakeRedirectContent( $title, $expected ) {
global $wgContLang;
/**
* @dataProvider dataIsSupportedFormat
+ * @covers WikitextContentHandler::isSupportedFormat
*/
public function testIsSupportedFormat( $format, $supported ) {
$this->assertEquals( $supported, $this->handler->isSupportedFormat( $format ) );
/**
* @dataProvider dataMerge3
+ * @covers WikitextContentHandler::merge3
*/
public function testMerge3( $old, $mine, $yours, $expected ) {
$this->checkHasDiff3();
/**
* @dataProvider dataGetAutosummary
+ * @covers WikitextContentHandler::getAutosummary
*/
public function testGetAutosummary( $old, $new, $flags, $expected ) {
$oldContent = is_null( $old ) ? null : new WikitextContent( $old );
/**
* @dataProvider dataGetSecondaryDataUpdates
* @group Database
+ * @covers WikitextContent::getSecondaryDataUpdates
*/
public function testGetSecondaryDataUpdates( $title, $model, $text, $expectedStuff ) {
$ns = $this->getDefaultWikitextNS();
/**
* @dataProvider dataGetSection
+ * @covers WikitextContent::getSection
*/
public function testGetSection( $text, $sectionId, $expectedText ) {
$content = $this->newContent( $text );
/**
* @dataProvider dataReplaceSection
+ * @covers WikitextContent::replaceSection
*/
public function testReplaceSection( $text, $section, $with, $sectionTitle, $expected ) {
$content = $this->newContent( $text );
$this->assertEquals( $expected, is_null( $c ) ? null : $c->getNativeData() );
}
+ /**
+ * @covers WikitextContent::addSectionHeader
+ */
public function testAddSectionHeader() {
$content = $this->newContent( 'hello world' );
$content = $content->addSectionHeader( 'test' );
);
}
+ /**
+ * @covers WikitextContent::matchMagicWord
+ */
public function testMatchMagicWord() {
$mw = MagicWord::get( "staticredirect" );
$this->assertFalse( $content->matchMagicWord( $mw ), "should not have matched magic word" );
}
+ /**
+ * @covers WikitextContent::updateRedirect
+ */
public function testUpdateRedirect() {
$target = Title::newFromText( "testUpdateRedirect_target" );
$this->assertEquals( $target->getFullText(), $newContent->getRedirectTarget()->getFullText() );
}
+ /**
+ * @covers WikitextContent::getModel
+ */
public function testGetModel() {
$content = $this->newContent( "hello world." );
$this->assertEquals( CONTENT_MODEL_WIKITEXT, $content->getModel() );
}
+ /**
+ * @covers WikitextContent::getContentHandler
+ */
public function testGetContentHandler() {
$content = $this->newContent( "hello world." );