Fix tests to pass after 58a161f in mediawiki/core

Status::getHtml now wraps the html in <p> tags, unwrapping
them for now, classic parseinline style..

Change-Id: Ic9b651cbd76752346ea7cbf230af49f09ef3ec12
This commit is contained in:
Timo Tijhof 2013-12-10 22:05:33 +01:00
parent 4cd9b6e00a
commit eb236e81de

View file

@ -347,6 +347,16 @@ class TemplateDataBlobTest extends MediaWikiTestCase {
return $calls;
}
protected static function getStatusText( Status $status ) {
$str = $status->getHtml();
// Based on wfMsgExt/parseinline
$m = array();
if ( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $str, $m ) ) {
$str = $m[1];
}
return $str;
}
protected function assertTemplateData( Array $case ) {
// Expand defaults
if ( !isset( $case['status'] ) ) {
@ -369,7 +379,7 @@ class TemplateDataBlobTest extends MediaWikiTestCase {
if ( !$status->isGood() ) {
$this->assertEquals(
$case['status'],
$status->getHtml(),
self::getStatusText( $status ),
'Status: ' . $case['msg']
);
} else {
@ -393,7 +403,7 @@ class TemplateDataBlobTest extends MediaWikiTestCase {
if ( !$status->isGood() ) {
$this->assertEquals(
$case['status'],
$status->getHtml(),
self::getStatusText( $status ),
'Roundtrip status: ' . $case['msg']
);
}
@ -654,7 +664,10 @@ class TemplateDataBlobTest extends MediaWikiTestCase {
$t = TemplateDataBlob::newFromJSON( $case['input'] );
$status = $t->getStatus();
$this->assertTrue( $status->isGood() ?: $status->getHtml(), 'Status is good: ' . $case['msg'] );
$this->assertTrue(
$status->isGood() ?: self::getStatusText( $status ),
'Status is good: ' . $case['msg']
);
$actual = $t->getDataInLanguage( $case['lang'] );
$this->assertJsonStringEqualsJsonString(