You are here

function SearchByPageNodesTest::testSearchExclude in Search by Page 6

Same name and namespace in other branches
  1. 7 tests/search_by_page.test \SearchByPageNodesTest::testSearchExclude()

Tests that the excluded tag is excluded from search.

File

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

Class

SearchByPageNodesTest
Functionality tests for Search by Page Nodes.

Code

function testSearchExclude() {

  // Make sure to use environment 1, since that has the exclude tags.
  $search_path = $this->envinfo1['page_path'];
  $excluded = search_by_page_setting_get('exclude_tags', $this->envid1, '');
  $this
    ->assertEqual($excluded, 'tagtoexclude', 'Correct tag is marked excluded');
  $this
    ->drupalLogin($this->privuser);

  // Search for the word 'walk'.
  $this
    ->drupalPost($search_path, array(
    'keys' => 'walk',
  ), t('Search pages'));

  // Verify that the "excluded" page doesn't show up.
  $this
    ->assertNoText($this->exclnodetitle, "Excluded node was not found in search for walk");
  $this
    ->assertNoText('gobble', "Gobble is not shown on the page in search for walk");

  // Search for the word 'gobble'
  $this
    ->drupalPost($search_path, array(
    'keys' => 'gobble',
  ), t('Search pages'));

  // Verify that the "excluded" page does show up, but not with the word walk showing.
  $this
    ->assertText($this->exclnodetitle, "Excluded node was found in search for gobble");
  $this
    ->assertNoText('walk', "Walk is not shown on the page");
}