public function IndexChangesTest::testPropertyProcessorRemoved in Search API 8
Tests correct reaction when a processor adding a property is removed.
File
- tests/
src/ Kernel/ Index/ IndexChangesTest.php, line 307
Class
- IndexChangesTest
- Tests correct reactions to changes for the index.
Namespace
Drupal\Tests\search_api\Kernel\IndexCode
public function testPropertyProcessorRemoved() {
$processor = $this->container
->get('plugin.manager.search_api.processor')
->createInstance('add_url', [
'#index' => $this->index,
]);
$this->index
->addProcessor($processor);
$fields_helper = \Drupal::getContainer()
->get('search_api.fields_helper');
$info = [
'datasource_id' => 'entity:entity_test_mulrev_changed',
'property_path' => 'id',
];
$this->index
->addField($fields_helper
->createField($this->index, 'id', $info));
$info = [
'property_path' => 'search_api_url',
];
$this->index
->addField($fields_helper
->createField($this->index, 'url', $info));
$this->index
->save();
$fields = array_keys($this->index
->getFields());
sort($fields);
$this
->assertEquals([
'id',
'url',
], $fields);
$this->index
->removeProcessor('add_url')
->save();
$fields = array_keys($this->index
->getFields());
$this
->assertEquals([
'id',
], $fields);
}