You are here

protected function IndexStorageTest::indexCreate in Search API 8

Tests whether creating an index works correctly.

Return value

\Drupal\search_api\IndexInterface The newly created search index.

1 call to IndexStorageTest::indexCreate()
IndexStorageTest::testIndexCrud in tests/src/Kernel/Index/IndexStorageTest.php
Tests all CRUD operations as a queue of operations.

File

tests/src/Kernel/Index/IndexStorageTest.php, line 62

Class

IndexStorageTest
Tests whether the storage of search indexes works correctly.

Namespace

Drupal\Tests\search_api\Kernel\Index

Code

protected function indexCreate() {
  $index_data = [
    'id' => 'test',
    'name' => 'Index test name',
  ];
  $index = $this->storage
    ->create($index_data);
  $this
    ->assertInstanceOf(IndexInterface::class, $index, 'The newly created entity is a search index.');
  $index
    ->save();
  return $index;
}