protected function SerializationTest::setUp in Search API 8
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ System/ SerializationTest.php, line 40
Class
- SerializationTest
- Tests that various classes can be properly serialized and/or cloned.
Namespace
Drupal\Tests\search_api\Kernel\SystemCode
protected function setUp() {
parent::setUp();
$this
->installSchema('search_api', [
'search_api_item',
]);
$this
->installEntitySchema('search_api_task');
$this
->installEntitySchema('node');
$this
->installConfig('search_api');
// As our test index, just use the one from the DB Defaults module.
$path = __DIR__ . '/../../../../modules/search_api_db/search_api_db_defaults/config/optional/search_api.index.default_index.yml';
$index_values = Yaml::decode(file_get_contents($path));
$this->index = Index::create($index_values);
$server = Server::create([
'id' => 'test_server',
'name' => 'Test Server',
'status' => TRUE,
'backend' => 'search_api_test',
]);
$server
->save();
$this->index
->setServer($server)
->save();
$this->index = Index::load($this->index
->id());
}