public function SearchByPagePathsReindexTest::setUp in Search by Page 8
Overrides SearchByPageTesterTest::setUp
File
- tests/
src/ Functional/ search_by_page.test, line 1643 - Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com
Class
- SearchByPagePathsReindexTest
- Reindexing test for Search by Page Paths.
Namespace
Drupal\Tests\search_by_page\FunctionalCode
public function setUp() {
parent::setUp('search', 'search_by_page', 'search_by_page_paths', 'search_by_page_test', 'dblog');
$this
->setUpEnvironments();
$this->superuser = $this
->drupalCreateUser(array(
'administer nodes',
'access content',
'administer content types',
'administer blocks',
'administer search',
'search content',
'administer search by page',
$this
->searchPerm($this->envinfo1),
'access administration pages',
'administer site configuration',
'administer users',
'administer permissions',
'view test private content',
'access site reports',
));
$this->noprivuser = $this
->drupalCreateUser(array(
$this
->searchPerm($this->envinfo1),
'access content',
'search content',
));
$this->privuser = $this
->drupalCreateUser(array(
'access content',
'search content',
$this
->searchPerm($this->envinfo1),
'view test private content',
));
$this
->drupalLogin($this->superuser);
// Set up indexing of pages.
$this
->drupalPostForm('admin/config/search/search_by_page/edit/' . $this->envid1, array(
'button_label' => t('Search pages'),
), 'Save configuration');
$path_add_path = 'admin/config/search/search_by_page/edit/' . $this->envid1 . '/paths/add';
$this
->drupalPostForm($path_add_path, array(
'path' => 'search_by_page_test_priv_page',
'title' => t("Private page"),
'type' => t('Page'),
'snippet' => 'yes',
'role' => $this
->getNewRoleID($this->privuser),
), 'Create new indexed page');
$this
->drupalPostForm($path_add_path, array(
'path' => 'search_by_page_test_pub_page',
'title' => t("Public page"),
'type' => t('Page'),
'snippet' => 'yes',
'role' => $this
->getNewRoleID($this->noprivuser),
), 'Create new indexed page');
$this
->drupalPostForm($path_add_path, array(
'path' => 'search_by_page_test_another_page',
'title' => t("Public page"),
'type' => t('Page'),
'snippet' => t('Trees: Orange and Lemon'),
'role' => $this
->getNewRoleID($this->noprivuser),
), 'Create new indexed page');
drupal_flush_all_caches();
variable_initialize();
$this
->doCronrun();
$this
->drupalLogin($this->superuser);
$this
->drupalGet('admin/reports/dblog');
$this
->assertText(t('Cron run completed'), 'Log shows cron run completed');
}