X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fcontent%2FWikitextContentHandlerTest.php;h=9d4abe857dc8581353108335258c3368bbf0c806;hp=f6328821e463913bb86a58be9fbef428a7b9efec;hb=add1ebe2ab7cbbaf27f8f60a2d0b05769dff71a2;hpb=b7c4c8717f964d1890d185ec3e6e9481fcb734e4 diff --git a/tests/phpunit/includes/content/WikitextContentHandlerTest.php b/tests/phpunit/includes/content/WikitextContentHandlerTest.php index f6328821e4..9d4abe857d 100644 --- a/tests/phpunit/includes/content/WikitextContentHandlerTest.php +++ b/tests/phpunit/includes/content/WikitextContentHandlerTest.php @@ -243,4 +243,20 @@ class WikitextContentHandlerTest extends MediaWikiLangTestCase { ) { } */ + + public function testDataIndexFieldsFile() { + $mockEngine = $this->getMock( 'SearchEngine' ); + $title = Title::newFromText( 'Somefile.jpg', NS_FILE ); + $page = new WikiPage( $title ); + + $handler = $this->getMockBuilder( WikitextContentHandler::class ) + ->disableOriginalConstructor() + ->setMethods( [ 'getFileText' ] ) + ->getMock(); + $handler->method( 'getFileText' )->will( $this->returnValue( 'This is file content' ) ); + + $data = $handler->getDataForSearchIndex( $page, new ParserOutput(), $mockEngine ); + $this->assertArrayHasKey( 'file_text', $data ); + $this->assertEquals( 'This is file content', $data['file_text'] ); + } }