Fix SanitizerTest for wikis with wgUseTidy = true;
authorumherirrender <umherirrender_de.wp@web.de>
Sun, 9 Dec 2012 10:03:03 +0000 (11:03 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Sun, 9 Dec 2012 10:03:03 +0000 (11:03 +0100)
testRemovehtmltagsOnHtml5Tags needs wgUseTidy = false;

3) SanitizerTest::testRemovehtmltagsOnHtml5Tags with data set #2
('time', false)

Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'<time></time>
-'
+'<time>'

Change-Id: Ib7e156293e2efae053b055e40393e442719eb5bd

tests/phpunit/includes/SanitizerTest.php

index 012c49d..5930d6c 100644 (file)
@@ -70,11 +70,11 @@ class SanitizerTest extends MediaWikiTestCase {
         * @param Boolean $escaped Wheter sanitizer let the tag in or escape it (ie: '&lt;video&gt;')
         */
        function testRemovehtmltagsOnHtml5Tags( $tag, $escaped ) {
-               global $wgHtml5;
-
-               # Enable HTML5 mode
-               $save = $wgHtml5;
-               $wgHtml5 = true;
+               $this->setMwGlobals( array(
+                       # Enable HTML5 mode
+                       'wgHtml5' => true,
+                       'wgUseTidy' => false
+               ));
 
                if( $escaped ) {
                        $this->assertEquals( "&lt;$tag&gt;",
@@ -85,7 +85,6 @@ class SanitizerTest extends MediaWikiTestCase {
                                Sanitizer::removeHTMLtags( "<$tag>" )
                        );
                }
-               $wgHtml5 = $save;
        }
 
        /**
@@ -103,7 +102,10 @@ class SanitizerTest extends MediaWikiTestCase {
        }
 
        function testSelfClosingTag() {
-               $GLOBALS['wgUseTidy'] = false;
+               $this->setMwGlobals( array(
+                       'wgUseTidy' => false
+               ));
+
                $this->assertEquals(
                        '<div>Hello world</div>',
                        Sanitizer::removeHTMLtags( '<div>Hello world</div />' ),