diff options
Diffstat (limited to 'tests/phpunit/unit/includes/BadFileLookupTest.php')
-rw-r--r-- | tests/phpunit/unit/includes/BadFileLookupTest.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/phpunit/unit/includes/BadFileLookupTest.php b/tests/phpunit/unit/includes/BadFileLookupTest.php index 6eb24a96763a..1e08e0511fea 100644 --- a/tests/phpunit/unit/includes/BadFileLookupTest.php +++ b/tests/phpunit/unit/includes/BadFileLookupTest.php @@ -87,6 +87,11 @@ WIKITEXT; } private function getMockTitleParser() { + // We can't use a real MediaWikiTitleCode, eg from DummyServicesTrait, + // because actual MalformedTitleException objects cannot be constructed in unit + // tests, and the tests in this file cover the code in BadFileLookup that + // handles an exception being thrown. Instead, we use a mock that throws mock + // exceptions $mock = $this->createMock( TitleParser::class ); $mock->method( 'parseTitle' )->will( $this->returnCallback( function ( $text ) { if ( strpos( $text, '<' ) !== false ) { |