You are here

function SearchByPagePathsTest::testSearchExclusions in Search by Page 8

Tests that the text in the excluded tag is actually excluded.

File

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

Class

SearchByPagePathsTest
Functionality tests for Search by Page Paths.

Namespace

Drupal\Tests\search_by_page\Functional

Code

function testSearchExclusions() {
  $search_path = $this->envinfo1['page_path'];
  $this
    ->drupalLogin($this->noprivuser);
  $this
    ->drupalPostForm($search_path, array(
    'keys' => 'Trees',
  ), t('Search pages'));
  $this
    ->assertNoText('Poplar', "Excluded text is not shown in search for Trees");
  $this
    ->assertText('Cottonwood', "Non-excluded text is shown in search for Trees");
  $this
    ->drupalPostForm($search_path, array(
    'keys' => 'Poplar',
  ), t('Search pages'));
  $this
    ->assertNoText('Poplar', "Excluded text is not shown in search for excluded text");
  $this
    ->assertNoText('Trees', "Trees is not shown in search for excluded text");
  $this
    ->assertNoText('Cottonwood', "Non-excluded text is not shown in search for excluded text");
}