You are here

function SearchByPageOutputTest::testSearchPages in Search by Page 8

Tests that pages can be searched.

File

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

Class

SearchByPageOutputTest
Tests that Search by Page doesn't get fooled by page output.

Namespace

Drupal\Tests\search_by_page\Functional

Code

function testSearchPages() {

  // Search and verify that the word "wrong" doesn't appear on the page.
  // It would appear if some of the bad output got through. Also make
  // sure that the correct output does appear.
  $search_path = $this->envinfo1['page_path'];
  $this
    ->drupalLogin($this->superuser);
  $this
    ->drupalPostForm($search_path, array(
    'keys' => 'Trees',
  ), t('Search pages'));
  $this
    ->assertText('Trees', "Found Trees on the search results page");
  $this
    ->assertText('Apple', "Found Apple on the search results page");
  $this
    ->assertNoText('Wrong', "Bad output did not make it to the results page");
}