You are here

function SearchByPagePathsTest::testSearchPages in Search by Page 7

Same name and namespace in other branches
  1. 6 tests/search_by_page.test \SearchByPagePathsTest::testSearchPages()

Tests that pages can be searched.

File

tests/search_by_page.test, line 1478
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.

Code

function testSearchPages() {

  // Non-privileged user - should only see the public pages
  $search_path = $this->envinfo1['page_path'];
  $this
    ->drupalLogin($this->noprivuser);
  $this
    ->drupalPost($search_path, array(
    'keys' => 'Trees',
  ), t('Search pages'));
  $this
    ->assertText('Trees', "Found Trees on the search results page");
  $this
    ->assertNoText('Pine', "Cannot see private page in search results");
  $this
    ->assertText('Oak', "Can see public page in search results");
  $this
    ->assertText('Orange', "Snippet override is shown");
  $this
    ->assertNoText('Apple', "Overridden excerpt is not shown");
  $this
    ->assertText('Walnut', "Page with query is shown");
  $this
    ->assertText('three', "Page with query shows query text");
  $this
    ->assertText('four', "Second page with query shows query text");

  // Privileged user - should see the public and private pages
  $this
    ->drupalLogin($this->privuser);
  $this
    ->drupalPost($search_path, array(
    'keys' => 'Trees',
  ), t('Search pages'));
  $this
    ->assertText('Trees', "Found Trees on the search results page");
  $this
    ->assertText('Pine', "Can see private page in search results");
  $this
    ->assertText('Oak', "Can see public page in search results");
  $this
    ->assertText('Orange', "Snippet override is shown");
  $this
    ->assertNoText('Apple', "Overridden excerpt is not shown");
  $this
    ->assertText('Walnut', "Page with query is shown");
  $this
    ->assertText('three', "Page with query shows query text");
  $this
    ->assertText('four', "Second page with query shows query text");
}