You are here

public function ViewsTest::testCreatingIndexClearsRowPluginCache in Search API 8

Verifies that our row plugin is available without clearing cache.

File

tests/src/Functional/ViewsTest.php, line 1151

Class

ViewsTest
Tests the Views integration of the Search API.

Namespace

Drupal\Tests\search_api\Functional

Code

public function testCreatingIndexClearsRowPluginCache() {
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'administer search_api',
    'access administration pages',
    'administer views',
  ]));
  $index_id = 'my_custom_index';
  Index::create([
    'name' => 'My custom index',
    'id' => $index_id,
    'status' => TRUE,
    'datasource_settings' => [
      'entity:node' => [],
      'entity:user' => [],
    ],
  ])
    ->save();
  $this
    ->drupalGet('/admin/structure/views/add');
  $this
    ->submitForm([
    'label' => 'Test view',
    'id' => 'test',
    'show[wizard_key]' => "standard:search_api_index_{$index_id}",
  ], 'Save and edit');
  $this
    ->drupalGet('/admin/structure/views/nojs/display/test/default/row');
  $this
    ->assertSession()
    ->elementExists('css', '#edit-row-type [value="search_api"]');
}