You are here

public function ViewsDisplayTest::testDependencyInfo in Search API 8

Tests the dependency information on the display.

File

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

Class

ViewsDisplayTest
Tests whether Views pages correctly create search display plugins.

Namespace

Drupal\Tests\search_api\Kernel\Views

Code

public function testDependencyInfo() {
  $this
    ->installConfig('search_api_test_views');

  /** @var \Drupal\search_api\Display\DisplayInterface $display */
  $display = $this->container
    ->get('plugin.manager.search_api.display')
    ->createInstance('views_page:search_api_test_view__page_1');
  $this
    ->assertEquals('views_page:search_api_test_view__page_1', $display
    ->getPluginId());
  $dependencies = $display
    ->calculateDependencies();
  $this
    ->assertArrayHasKey('module', $dependencies);
  $this
    ->assertArrayHasKey('config', $dependencies);
  $this
    ->assertContains('search_api', $dependencies['module']);
  $this
    ->assertContains('search_api.index.database_search_index', $dependencies['config']);
  $this
    ->assertContains('views.view.search_api_test_view', $dependencies['config']);
}