* @dataProvider provideAddWikiText
* @covers OutputPage::addWikiText
* @covers OutputPage::addWikiTextAsInterface
+ * @covers OutputPage::wrapWikiTextAsInterface
* @covers OutputPage::addWikiTextAsContent
* @covers OutputPage::addWikiTextWithTitle
* @covers OutputPage::addWikiTextTitle
'<div class="mw-editintro">' . "Some page\n</div>"
],
],
+ 'wrapWikiTextAsInterface' => [
+ 'Simple' => [
+ [ 'wrapperClass', 'text' ],
+ "<div class=\"wrapperClass\"><p>text\n</p></div>"
+ ], 'Spurious </div>' => [
+ [ 'wrapperClass', 'text</div><div>more' ],
+ "<div class=\"wrapperClass\"><p>text</p><div>more\n</div></div>"
+ ], 'Extra newlines would break <p> wrappers' => [
+ [ 'two classes', "1\n\n2\n\n3" ],
+ "<div class=\"two classes\"><p>1\n</p><p>2\n</p><p>3\n</p></div>"
+ ], 'Other unclosed tags' => [
+ [ 'error', 'a<b>c<i>d' ],
+ "<div class=\"error\"><p>a<b>c<i>d\n</i></b></p></div>"
+ ],
+ ],
];
// Test all the others on addWikiTextTitle as well
$op = $this->newInstance();
$this->assertSame( '', $op->getHTML() );
$op->addWikiMsg( 'parentheses', "<b>a" );
- // This is known to be bad unbalanced HTML; this will be fixed
- // by I743f4185a03403f8d9b9db010ff1ee4e9342e062 (T198214)
- $this->assertSame( "<p>(<b>a)\n</p>", $op->getHTML() );
+ // The input is bad unbalanced HTML, but the output is tidied
+ $this->assertSame( "<p>(<b>a)\n</b></p>", $op->getHTML() );
}
/**
$op = $this->newInstance();
$this->assertSame( '', $op->getHTML() );
$op->wrapWikiMsg( '[$1]', [ 'parentheses', "<b>a" ] );
- // This is known to be bad unbalanced HTML; this will be fixed
- // by I743f4185a03403f8d9b9db010ff1ee4e9342e062 (T198214)
- $this->assertSame( "<p>[(<b>a)]\n</p>", $op->getHTML() );
+ // The input is bad unbalanced HTML, but the output is tidied
+ $this->assertSame( "<p>[(<b>a)]\n</b></p>", $op->getHTML() );
}
/**