You are here

public function ViewsDisplayTest::testViewsPageDisplayPluginAvailable in Search API 8

Tests whether the search display plugin for a new view is available.

File

tests/src/Kernel/Views/ViewsDisplayTest.php, line 61

Class

ViewsDisplayTest
Tests whether Views pages correctly create search display plugins.

Namespace

Drupal\Tests\search_api\Kernel\Views

Code

public function testViewsPageDisplayPluginAvailable() {

  // Retrieve the display plugins once first, to fill the cache.
  $displays = $this->container
    ->get('plugin.manager.search_api.display')
    ->getDefinitions();
  $this
    ->assertArrayNotHasKey('views_page:search_api_test_view__page_1', $displays);

  // Then, install our test view and see whether its search display becomes
  // available right away, without manually clearing the cache first.
  $this
    ->installConfig('search_api_test_views');
  $displays = $this->container
    ->get('plugin.manager.search_api.display')
    ->getDefinitions();
  $this
    ->assertArrayHasKey('views_page:search_api_test_view__page_1', $displays);
}