You are here

protected function PagesIntegrationTest::checkSearchPluginCacheClear in Search API Autocomplete 8

Tests whether the search plugin cache is cleared correctly.

1 call to PagesIntegrationTest::checkSearchPluginCacheClear()
PagesIntegrationTest::testModule in tests/src/FunctionalJavascript/PagesIntegrationTest.php
Tests autocomplete for search pages.

File

tests/src/FunctionalJavascript/PagesIntegrationTest.php, line 229

Class

PagesIntegrationTest
Tests integration with the Search API Pages module.

Namespace

Drupal\Tests\search_api_autocomplete\FunctionalJavascript

Code

protected function checkSearchPluginCacheClear() {
  $assert_session = $this
    ->assertSession();
  $search = Search::load($this->searchId);
  $this
    ->assertInstanceOf(SearchInterface::class, $search);
  $page = SearchApiPage::load($this->searchId);
  $page2 = $page
    ->createDuplicate();
  $page2
    ->set('id', 'foobar');
  $page2
    ->set('label', 'Foobar');
  $this
    ->drupalGet($this
    ->getAdminPath());
  $assert_session
    ->pageTextContains('Test search page');
  $assert_session
    ->pageTextNotContains('Foobar');
  $page2
    ->save();
  $this
    ->drupalGet($this
    ->getAdminPath());
  $assert_session
    ->pageTextContains('Test search page');
  $assert_session
    ->pageTextContains('Foobar');
  $page
    ->delete();
  $this
    ->drupalGet($this
    ->getAdminPath());
  $assert_session
    ->pageTextNotContains('Test search page');
  $assert_session
    ->pageTextContains('Foobar');
  $search = Search::load($this->searchId);
  $this
    ->assertNull($search);
}