diff options
author | thiemowmde <thiemo.kreuz@wikimedia.de> | 2023-10-20 18:28:56 +0200 |
---|---|---|
committer | thiemowmde <thiemo.kreuz@wikimedia.de> | 2023-10-20 18:30:29 +0200 |
commit | 669120b0896df22e00214574dd97da8b6832307c (patch) | |
tree | 642471e070817b76e07494b2d6ca9c26e866baa2 /tests/phpunit | |
parent | 343443a1cf097eb968010df4a43c91107c004917 (diff) | |
download | mediawikicore-669120b0896df22e00214574dd97da8b6832307c.tar.gz mediawikicore-669120b0896df22e00214574dd97da8b6832307c.zip |
Add missing hasContentModel to MockTitleTrait
I worked around this with a custom mock for the moment, but would
like to use the upstream trait in the future.
Change-Id: Idf28d905f9fd01c24f29ad6a60419bfb4896704c
Diffstat (limited to 'tests/phpunit')
-rw-r--r-- | tests/phpunit/mocks/MockTitleTrait.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/phpunit/mocks/MockTitleTrait.php b/tests/phpunit/mocks/MockTitleTrait.php index d13459bab516..c24134062832 100644 --- a/tests/phpunit/mocks/MockTitleTrait.php +++ b/tests/phpunit/mocks/MockTitleTrait.php @@ -72,8 +72,10 @@ trait MockTitleTrait { // TODO getPageLanguage should return a Language object, 'qqx' is a string $title->method( 'getPageLanguage' )->willReturn( $props['language'] ?? 'qqx' ); - $title->method( 'getContentModel' ) - ->willReturn( $props['contentModel'] ?? CONTENT_MODEL_WIKITEXT ); + $contentModel = $props['contentModel'] ?? CONTENT_MODEL_WIKITEXT; + $title->method( 'getContentModel' )->willReturn( $contentModel ); + $title->method( 'hasContentModel' )->willReturnCallback( + static fn ( $id ) => $id === $contentModel ); $title->method( 'getTitleProtection' )->willReturn( false ); $title->method( 'canExist' ) ->willReturn( $ns >= 0 && empty( $props['interwiki'] ) && $text !== '' ); |