You are here

protected function ViewsDisplayCachingTest::getView in Search API 8

Loads a view from configuration and returns its executable object.

Parameters

string $id: The view ID to load.

string $display_id: The display ID to set.

Return value

\Drupal\views\ViewExecutable A view executable instance, from the loaded entity.

1 call to ViewsDisplayCachingTest::getView()
ViewsDisplayCachingTest::testDisplayCacheability in tests/src/Kernel/Views/ViewsDisplayCachingTest.php
Tests whether the search display plugin for a new view is available.

File

tests/src/Kernel/Views/ViewsDisplayCachingTest.php, line 248

Class

ViewsDisplayCachingTest
Tests the Search API caching plugins for Views.

Namespace

Drupal\Tests\search_api\Kernel\Views

Code

protected function getView($id, $display_id) {

  /** @var \Drupal\views\ViewEntityInterface $view */
  $view = $this->entityTypeManager
    ->getStorage('view')
    ->load($id);
  $executable = $this->viewExecutableFactory
    ->get($view);
  $executable
    ->setDisplay($display_id);
  $executable
    ->setExposedInput([
    'search_api_fulltext' => 'Glaive',
  ]);
  return $executable;
}