function SearchByPagePathsTest::testSearchPages in Search by Page 8
Tests that pages can be searched.
File
- tests/
src/ Functional/ search_by_page.test, line 1153 - 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\FunctionalCode
function testSearchPages() {
// Non-privileged user - should only see the public pages
$search_path = $this->envinfo1['page_path'];
$this
->drupalLogin($this->noprivuser);
$this
->drupalPostForm($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
->drupalPostForm($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");
}