Merge "Tidy Message::parseAsBlock() by enabling tidy in MessageCache"
[lhc/web/wiklou.git] / tests / phpunit / includes / OutputPageTest.php
index b19cd2b..6b32c95 100644 (file)
@@ -1430,6 +1430,7 @@ class OutputPageTest extends MediaWikiTestCase {
         * @dataProvider provideAddWikiText
         * @covers OutputPage::addWikiText
         * @covers OutputPage::addWikiTextAsInterface
+        * @covers OutputPage::wrapWikiTextAsInterface
         * @covers OutputPage::addWikiTextAsContent
         * @covers OutputPage::addWikiTextWithTitle
         * @covers OutputPage::addWikiTextTitle
@@ -1545,6 +1546,21 @@ class OutputPageTest extends MediaWikiTestCase {
                                        '<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
@@ -1648,9 +1664,8 @@ class OutputPageTest extends MediaWikiTestCase {
                $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() );
        }
 
        /**