ContentHandler implementations were not including fields
defined by their parent ContentHandler classes.
merge method is added to the SearchIndexFieldDefinition
mock in SearchEngineTest, to allow merges of fields
in the way that SearchIndexFieldDefition implementation does.
Change-Id: Id04a51528f566da2666bad0394a2f61c949c69b4
throw new MWException( 'Subclass must override' );
}
- /**
- * @param SearchEngine $engine
- * @return array
- */
- public function getFieldsForSearchIndex( SearchEngine $engine ) {
- return [];
- }
}
}
public function getFieldsForSearchIndex( SearchEngine $engine ) {
- $fields = [];
+ $fields = parent::getFieldsForSearchIndex( $engine );
$fields['language'] =
$engine->makeSearchFieldMapping( 'language', SearchIndexField::INDEX_TYPE_KEYWORD );
+
return $fields;
}
}
public function getFieldsForSearchIndex( SearchEngine $engine ) {
- $fields = [];
+ $fields = parent::getFieldsForSearchIndex( $engine );
$fields['category'] =
$engine->makeSearchFieldMapping( 'category', SearchIndexField::INDEX_TYPE_TEXT );
$name,
$type
] )->getMock();
+
$mockField->expects( $this->any() )->method( 'getMapping' )->willReturn( [
'testData' => 'test',
'name' => $name,
'type' => $type,
] );
+
+ $mockField->expects( $this->any() )
+ ->method( 'merge' )
+ ->willReturn( $mockField );
+
return $mockField;
};