You are here

protected function CacheInvalidationTest::setUp in Search API Autocomplete 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/CacheInvalidationTest.php, line 33

Class

CacheInvalidationTest
Tests whether caches are always invalidated correctly.

Namespace

Drupal\Tests\search_api_autocomplete\Functional

Code

protected function setUp() {
  parent::setUp();

  // Change the view to use an exposed form block.
  $view_id = 'search_api_autocomplete_test_view';
  $view = View::load($view_id);
  $displays = $view
    ->get('display');
  $displays['page']['display_options']['exposed_block'] = TRUE;
  $view
    ->set('display', $displays);
  $view
    ->save();

  // Enable the exposed form block.
  $this
    ->placeBlock("views_exposed_filter_block:{$view_id}-page");

  // @todo The Search API Pages part of this test have been commented out
  //   until #2924389 is resolved.
  // Enable the search page block.
  // $this->placeBlock('search_api_page_form_block', [
  //   'search_api_page' => 'test_search',
  // ]);
  // Enable the "Custom scripts" suggester.
  \Drupal::configFactory()
    ->getEditable('search_api_autocomplete.settings')
    ->set('enable_custom_scripts', TRUE)
    ->save();

  // Log in an admin user so we don't run into any access-related
  // difficulties.
  $this
    ->drupalLogin($this
    ->createUser([
    'administer search_api',
    'administer search_api_autocomplete',
    'administer search_api_page',
  ]));
}