CONTENT_MODEL_CSS => 'CssContentHandler',
CONTENT_MODEL_TEXT => 'TextContentHandler',
'testing' => 'DummyContentHandlerForTesting',
- 'testing-callbacks' => function( $modelId ) {
+ 'testing-callbacks' => function ( $modelId ) {
return new DummyContentHandlerForTesting( $modelId );
}
],
$searchEngine->expects( $this->any() )
->method( 'makeSearchFieldMapping' )
- ->will( $this->returnCallback( function( $name, $type ) {
+ ->will( $this->returnCallback( function ( $name, $type ) {
return new DummySearchIndexFieldDefinition( $name, $type );
} ) );
* @covers ContentHandler::getDataForSearchIndex
*/
public function testDataIndexFields() {
- $mockEngine = $this->getMock( 'SearchEngine' );
+ $mockEngine = $this->createMock( 'SearchEngine' );
$title = Title::newFromText( 'Not_Main_Page', NS_MAIN );
$page = new WikiPage( $title );
$this->setTemporaryHook( 'SearchDataForIndex',
- function ( &$fields, ContentHandler $handler, WikiPage $page, ParserOutput $output,
- SearchEngine $engine ) {
+ function (
+ &$fields,
+ ContentHandler $handler,
+ WikiPage $page,
+ ParserOutput $output,
+ SearchEngine $engine
+ ) {
$fields['testDataField'] = 'test content';
} );
$this->assertContains( 'one who smiths', $out->getRawText() );
}
+ /**
+ * @covers ContentHandler::getContentModels
+ */
+ public function testGetContentModelsHook() {
+ $this->setTemporaryHook( 'GetContentModels', function ( &$models ) {
+ $models[] = 'Ferrari';
+ } );
+ $this->assertContains( 'Ferrari', ContentHandler::getContentModels() );
+ }
}