true ] ); $body = DOMCompat::getBody( $doc ); $env = new MockEnv( [] ); $removeRedLinks = new RemoveRedLinks( $env ); $removeRedLinks->run( $body ); $actual = ContentUtils::ppToXML( $body, [ 'discardDataParsoid' => true, 'innerXML' => true ] ); $this->assertEquals( $expected, $actual, $message ); } public function provideRedLinks(): array { return [ [ 'Hello', 'Hello', 'No redlink' ], [ 'Hello', 'Hello', 'Redlink with ./ title syntax' ], [ 'Hello', 'Hello', 'Redlink with index.php? title syntax' ], [ 'Hello', 'Hello', 'Redlink with index.php? title syntax in another order' ], [ 'Hello', 'Hello', 'Redlink with ./ title syntax' ], [ 'Hello', 'Hello', 'Not a wikilink' ], [ '
' . '', '' . '', 'Two redlinks' ], [ 'Hello', 'Hello', 'Redlink with fragment' ], [ 'Hello', 'Hello', 'Redlink with fragment with a question mark' ], [ 'Hello', 'Hello', 'Not a redlink, with fragment with a question mark' ], // The code that allows for the creation of such an URL should be fixed; in the // meantime we still want to avoid breaking links that may still cached. [ 'Hello', 'Hello', 'Redlink with buggy fragment' ], [ 'Hello', 'Hello', 'Redlink with a fragment containing action=edit&redlink=1' ], [ 'Hello', 'Hello', 'Redlink with escaped &' ], ]; } }