public function DefaultConfigEntityInstallationTest::testNormalEntityCreation in Search API 8
Tests that creating new config entities directly works correctly.
File
- tests/
src/ Kernel/ ConfigEntity/ DefaultConfigEntityInstallationTest.php, line 64
Class
- DefaultConfigEntityInstallationTest
- Tests that installing config entities from an extension works correctly.
Namespace
Drupal\Tests\search_api\Kernel\ConfigEntityCode
public function testNormalEntityCreation() {
$dir = __DIR__ . '/../../../search_api_test_inconsistent_config/config/install/';
$yaml_file = $dir . 'search_api.server.inconsistent_search_server.yml';
$values = Yaml::decode(file_get_contents($yaml_file));
Server::create($values)
->save();
$yaml_file = $dir . 'search_api.index.inconsistent_search_index.yml';
$values = Yaml::decode(file_get_contents($yaml_file));
Index::create($values)
->save();
$index = Index::load('inconsistent_search_index');
$this
->assertNotNull($index);
$values = $index
->toArray();
// Make sure the index was not processed at all upon saving.
$this
->assertFalse($index
->status());
$this
->assertArrayHasKey('rendered_item', $values['processor_settings']);
$this
->assertArrayNotHasKey('unknown_property', $values['field_settings']);
$methods = $this
->getCalledMethods('processor');
$this
->assertContains('preIndexSave', $methods);
}