public function testGetFields_instanceOfSearchIndexField() { $wikibaseFieldDefinitions = new WikibaseFieldDefinitions(); foreach ($wikibaseFieldDefinitions->getFields() as $fieldName => $field) { $this->assertInstanceOf('Wikibase\\Repo\\Search\\Elastic\\Fields\\SearchIndexField', $field, "{$fieldName} must be instance of SearchIndexField"); } }
/** * @param array &$config * * @throws UnexpectedValueException */ public function addExtraFieldsToMappingConfig(array &$config) { $fields = $this->fieldDefinitions->getFields(); foreach ($fields as $fieldName => $field) { if (array_key_exists($fieldName, $config['page']['properties'])) { throw new UnexpectedValueException("{$fieldName} is already set in the mapping."); } $config['page']['properties'][$fieldName] = $field->getMapping(); } }