function SearchByPagePathsTest::testSearchPages in Search by Page 6
Same name and namespace in other branches
- 7 tests/search_by_page.test \SearchByPagePathsTest::testSearchPages()
Tests that pages can be searched.
File
- tests/search_by_page.test, line 1300 
- 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");
  // 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");
}