diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/phpunit/includes/ParserOutputTransform/DefaultOutputTransformTest.php | 17 | ||||
-rw-r--r-- | tests/phpunit/includes/parser/ParserOutputTest.php | 16 |
2 files changed, 21 insertions, 12 deletions
diff --git a/tests/phpunit/includes/ParserOutputTransform/DefaultOutputTransformTest.php b/tests/phpunit/includes/ParserOutputTransform/DefaultOutputTransformTest.php index becd00a5a995..67eac105231b 100644 --- a/tests/phpunit/includes/ParserOutputTransform/DefaultOutputTransformTest.php +++ b/tests/phpunit/includes/ParserOutputTransform/DefaultOutputTransformTest.php @@ -6,6 +6,7 @@ use LogicException; use MediaWiki\MainConfigNames; use MediaWikiLangTestCase; use ParserOutput; +use RequestContext; use Wikimedia\Parsoid\Core\SectionMetadata; use Wikimedia\Parsoid\Core\TOCData; @@ -26,6 +27,10 @@ class DefaultOutputTransformTest extends MediaWikiLangTestCase { * @param string $expect Expected output */ public function testTransform( $options, $text, $expect ) { + // Avoid other skins affecting the section edit links + $this->overrideConfigValue( MainConfigNames::DefaultSkin, 'fallback' ); + RequestContext::resetMain(); + $this->overrideConfigValues( [ MainConfigNames::ArticlePath => '/wiki/$1', MainConfigNames::ScriptPath => '/w', @@ -125,16 +130,16 @@ EOF; </ul> </div> -<h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=1" title="Edit section: Section 1"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2> <p>One </p> -<h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=2" title="Edit section: Section 2"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2> <p>Two </p> <h3><span class="mw-headline" id="Section_2.1">Section 2.1</span></h3> <p>Two point one </p> -<h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=4" title="Edit section: Section 3"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=4" title="Edit section: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2> <p>Three </p> EOF @@ -174,16 +179,16 @@ EOF <div class="mw-parser-output"><p>Test document. </p> -<h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=1" title="Edit section: Section 1"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2> <p>One </p> -<h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=2" title="Edit section: Section 2"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2> <p>Two </p> <h3><span class="mw-headline" id="Section_2.1">Section 2.1</span></h3> <p>Two point one </p> -<h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=4" title="Edit section: Section 3"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=4" title="Edit section: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2> <p>Three </p></div> EOF diff --git a/tests/phpunit/includes/parser/ParserOutputTest.php b/tests/phpunit/includes/parser/ParserOutputTest.php index 0c7ae1a4b37b..88aa712e42ab 100644 --- a/tests/phpunit/includes/parser/ParserOutputTest.php +++ b/tests/phpunit/includes/parser/ParserOutputTest.php @@ -279,6 +279,10 @@ class ParserOutputTest extends MediaWikiLangTestCase { * @param string $expect Expected output */ public function testGetText( $options, $text, $expect ) { + // Avoid other skins affecting the section edit links + $this->overrideConfigValue( MainConfigNames::DefaultSkin, 'fallback' ); + RequestContext::resetMain(); + $this->overrideConfigValues( [ MainConfigNames::ArticlePath => '/wiki/$1', MainConfigNames::ScriptPath => '/w', @@ -377,16 +381,16 @@ EOF; </ul> </div> -<h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=1" title="Edit section: Section 1"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2> <p>One </p> -<h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=2" title="Edit section: Section 2"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2> <p>Two </p> <h3><span class="mw-headline" id="Section_2.1">Section 2.1</span></h3> <p>Two point one </p> -<h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=4" title="Edit section: Section 3"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=4" title="Edit section: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2> <p>Three </p> EOF @@ -426,16 +430,16 @@ EOF <div class="mw-parser-output"><p>Test document. </p> -<h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=1" title="Edit section: Section 1"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2> <p>One </p> -<h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=2" title="Edit section: Section 2"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2> <p>Two </p> <h3><span class="mw-headline" id="Section_2.1">Section 2.1</span></h3> <p>Two point one </p> -<h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=4" title="Edit section: Section 3"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></h2> +<h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Test_Page&action=edit&section=4" title="Edit section: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2> <p>Three </p></div> EOF |