overrideConfigValue( MainConfigNames::DefaultSkin, 'fallback' ); $this->clearHook( 'SkinEditSectionLinks' ); RequestContext::resetMain(); $this->overrideConfigValues( [ MainConfigNames::ScriptPath => '/w', MainConfigNames::Script => '/w/index.php', MainConfigNames::ParserEnableLegacyHeadingDOM => false, ] ); $po = new ParserOutput( $text ); TestUtils::initSections( $po ); $actual = $this->getServiceContainer()->getDefaultOutputPipeline() ->run( $po, null, $options )->getContentHolderText(); $this->assertSame( $expect, $actual ); } public static function provideTransform() { return [ 'No options' => [ [], TestUtils::TEST_DOC, <<Test document.

Section 1

[edit]

One

Section 2

[edit]

Two

Section 2.1

Two point one

Section 3

[edit]

Three

EOF ], 'Disable section edit links' => [ [ 'enableSectionEditLinks' => false ], TestUtils::TEST_DOC, <<Test document.

Section 1

One

Section 2

Two

Section 2.1

Two point one

Section 3

Three

EOF ], 'Disable TOC, but wrap' => [ [ 'allowTOC' => false, 'wrapperDivClass' => 'mw-parser-output' ], TestUtils::TEST_DOC, <<

Test document.

Section 1

[edit]

One

Section 2

[edit]

Two

Section 2.1

Two point one

Section 3

[edit]

Three

EOF ], 'Style deduplication disabled' => [ [ 'deduplicateStyles' => false ], TestUtils::TEST_TO_DEDUP, TestUtils::TEST_TO_DEDUP ], ]; // phpcs:enable } /** * @covers \MediaWiki\OutputTransform\DefaultOutputPipelineFactory::buildPipeline */ public function testTransform_failsIfNoText() { $po = new ParserOutput( null ); $this->expectException( LogicException::class ); $this->getServiceContainer()->getDefaultOutputPipeline() ->run( $po, null, [] ); } }