function SearchByPageNodesTest::testTeaserDisplay in Search by Page 6
Same name and namespace in other branches
- 7 tests/search_by_page.test \SearchByPageNodesTest::testTeaserDisplay()
Tests that the teaser display option works.
File
- tests/
search_by_page.test, line 598 - 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.
Code
function testTeaserDisplay() {
$this
->drupalLogin($this->superuser);
// Set display output to display teasers
$this
->drupalPost('admin/settings/search_by_page/edit/' . $this->envid1, array(
'sbp_nodes_display_type' => 'teasers',
), 'Save configuration');
cache_clear_all('variables', 'cache');
variable_init();
// Search for the word 'walk'
$search_path = $this->envinfo1['page_path'];
$this
->drupalPost($search_path, array(
'keys' => 'walk',
), t('Search pages'));
// Verify that teasers are displayed instead of excerpts
$this
->assertText('walk', "Walk appears in search results for walk");
$this
->assertNoText('streets', "First page excerpt not displayed");
$this
->assertText('path', "First page teaser displayed");
// Set display output to display excerpts
$this
->drupalLogin($this->superuser);
$this
->drupalPost('admin/settings/search_by_page/edit/' . $this->envid1, array(
'sbp_nodes_display_type' => 'excerpts',
), 'Save configuration');
cache_clear_all('variables', 'cache');
variable_init();
// Search for the word 'walk'
$this
->drupalPost($search_path, array(
'keys' => 'walk',
), t('Search pages'));
// Verify that excerpts are displayed instead of teasers
$this
->assertText('walk', "Walk appears in search results for walk");
$this
->assertText('streets', "First page excerpt displayed");
$this
->assertNoText('path', "First page teaser not displayed");
}