function SearchByPageUsersTest::testSearchUsers in Search by Page 8
Tests that users can be searched.
File
- tests/
src/ Functional/ search_by_page.test, line 810 - Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com
Class
- SearchByPageUsersTest
- Functionality tests for Search by Page Users.
Namespace
Drupal\Tests\search_by_page\FunctionalCode
function testSearchUsers() {
// Search for user a
$search_path = $this->envinfo2['page_path'];
$this
->drupalLogin($this->superuser);
$this
->drupalPostForm($search_path, array(
'keys' => $this->usera->name,
), t('Search pages'));
// Verify we found user a
$this
->assertText($this->usera->name, "User a appears in search results");
$this
->assertLink($this->usera->name, 0, "Link to user a appears in search results");
// Search for user b
$this
->drupalPostForm($search_path, array(
'keys' => $this->userb->name,
), t('Search pages'));
// Verify we did not find user b, and have "no results"
$this
->assertNoText($this->userb->name, "User b does not appear in search results");
$this
->assertText('no results', "No results appears on search results page for user b");
}