You are here

function SearchByPageThemeTest::testTheme in Search by Page 8

Tests that the right theme was used to index the page.

File

tests/src/Functional/search_by_page.test, line 2898
Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com

Class

SearchByPageThemeTest
Tests that the right theme is used for indexing.

Namespace

Drupal\Tests\search_by_page\Functional

Code

function testTheme() {
  $search_path = $this->envinfo1['page_path'];

  // Search for Cat (block in the right theme) should be successful.
  $this
    ->drupalPostForm($search_path, array(
    'keys' => 'cat',
  ), t('Search pages'));
  $this
    ->assertText('Trees', "Found Trees on the search results page");
  $this
    ->assertText('cat', "Found cat block on the search results page");
  $this
    ->assertNoText('dog', "Did not find dog block on the search results page");

  // Search for Dog (block in the wrong theme) should not be successful.
  $this
    ->drupalPostForm($search_path, array(
    'keys' => 'dog',
  ), t('Search pages'));
  $this
    ->assertText('Your search yielded no results', 'Search for dog was unsuccessful');
}