diff options
author | daniel <dkinzler@wikimedia.org> | 2023-11-20 11:32:09 +0100 |
---|---|---|
committer | James D. Forrester <jforrester@wikimedia.org> | 2024-04-30 17:45:13 +0100 |
commit | 67f047bb32194f981abbf64de986c33d397986b6 (patch) | |
tree | dcf557d8244ca6cb61ebeb3a43b9e31a8f10f50e /tests/phpunit/includes/content/WikitextContentHandlerTest.php | |
parent | f4b0b0a347b4757c3966ad7df8dad67ffd94ae84 (diff) | |
download | mediawikicore-67f047bb32194f981abbf64de986c33d397986b6.tar.gz mediawikicore-67f047bb32194f981abbf64de986c33d397986b6.zip |
tests: Remove usage of deprecated methods on ContentHandler
Prepare for hard deprecation of static ContentHandler methods.
Change-Id: Ie37937da26630d4c9782f2ac4aa413e9c18ea535
Diffstat (limited to 'tests/phpunit/includes/content/WikitextContentHandlerTest.php')
-rw-r--r-- | tests/phpunit/includes/content/WikitextContentHandlerTest.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/phpunit/includes/content/WikitextContentHandlerTest.php b/tests/phpunit/includes/content/WikitextContentHandlerTest.php index b14f6c9ab8f7..e52288a23719 100644 --- a/tests/phpunit/includes/content/WikitextContentHandlerTest.php +++ b/tests/phpunit/includes/content/WikitextContentHandlerTest.php @@ -238,6 +238,29 @@ class WikitextContentHandlerTest extends MediaWikiLangTestCase { /** * @covers \WikitextContentHandler::getDataForSearchIndex + * @covers \ContentHandler::getFieldsForSearchIndex + */ + public function testGetFieldsForSearchIndex() { + $searchEngine = $this->createMock( SearchEngine::class ); + + $searchEngine->method( 'makeSearchFieldMapping' ) + ->willReturnCallback( static function ( $name, $type ) { + return new DummySearchIndexFieldDefinition( $name, $type ); + } ); + + $this->hideDeprecated( 'ContentHandler::getForModelID' ); + + $fields = $this->handler->getFieldsForSearchIndex( $searchEngine ); + + $this->assertArrayHasKey( 'category', $fields ); + $this->assertArrayHasKey( 'external_link', $fields ); + $this->assertArrayHasKey( 'outgoing_link', $fields ); + $this->assertArrayHasKey( 'template', $fields ); + $this->assertArrayHasKey( 'content_model', $fields ); + } + + /** + * @covers WikitextContentHandler::getDataForSearchIndex */ public function testDataIndexFieldsFile() { $mockEngine = $this->createMock( SearchEngine::class ); |