function SearchByPageNodesTest::testSearchTypes in Search by Page 8
Tests that the content of the designated types only can be searched.
File
- tests/
src/ Functional/ search_by_page.test, line 204 - 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.
Namespace
Drupal\Tests\search_by_page\FunctionalCode
function testSearchTypes() {
$search_path = $this->envinfo1['page_path'];
$this
->drupalLogin($this->privuser);
$this
->drupalGet('node/' . $this->nodeid1);
$this
->assertText('streets', "Priv user can see first node page");
// Search for the word 'walk'
$this
->drupalPostForm($search_path, array(
'keys' => 'walk',
), t('Search pages'));
// Verify that the "indexed" pages are searchable, and the non-indexed not.
$this
->assertText('walk', "Walk appears in search results for walk");
$this
->assertText('streets', "First page was found");
$this
->assertText('north', "Second page was found");
$this
->assertNoText('people', "Non-searchable content was not found");
$this
->assertLink($this->nodetitle1, 0, "Link to first node is found");
// Try searching for something that isn't there
$this
->drupalPostForm($search_path, array(
'keys' => 'blsdfsdfsadf',
), t('Search pages'));
$this
->assertNoText('walk', "Walk does not appear in search results for gibberish");
$this
->assertText('no results', "No results appears on search results page for gibberish");
}