X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FMediaWikiTestCase.php;h=87e214cb9e03f90d0508428dbc1ee32e4133f1eb;hb=a51ae81f11bd9abb4bb8e2a4924b6117f0ae2537;hp=7a7ec8f0c13709937e93cbb0c3a9936702b7b0d4;hpb=8318bde3a8df0b8dad649b4e05c008333b1404b4;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 7a7ec8f0c1..87e214cb9e 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -53,7 +53,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { /** * Holds original values of MediaWiki configuration settings * to be restored in tearDown(). - * See also setMwGlobal(). + * See also setMwGlobals(). * @var array */ private $mwGlobals = array(); @@ -966,4 +966,55 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { $this->assertInstanceOf( $expected, $pokemons, $message ); } + + /** + * Asserts that the given string is a valid HTML snippet. + * Wraps the given string in the required top level tags and + * then calls assertValidHtmlDocument(). + * The snippet is expected to be HTML 5. + * + * @note: Will mark the test as skipped if the "tidy" module is not installed. + * @note: This ignores $wgUseTidy, so we can check for valid HTML even (and especially) + * when automatic tidying is disabled. + * + * @param string $html An HTML snippet (treated as the contents of the body tag). + */ + protected function assertValidHtmlSnippet( $html ) { + $html = '