public function SearchByPageThemeTest::setUp in Search by Page 8
Overrides SearchByPageTesterTest::setUp
File
- tests/
src/ Functional/ search_by_page.test, line 2835 - Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com
Class
- SearchByPageThemeTest
- Tests that the right theme is used for indexing.
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',
'administer themes',
'view the administration theme',
));
$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_pub_page',
'title' => t("Public page"),
'type' => t('Page'),
'snippet' => 'yes',
'role' => $this
->getNewRoleID($this->superuser),
), 'Create new indexed page');
// Turn on the administrative theme.
$this
->drupalPostForm('admin/appearance', array(
'admin_theme' => 'seven',
), t('Save configuration'));
// Add different blocks to the Content region in the admin and regular
// themes.
$this
->drupalPostForm('admin/structure/block', array(
'blocks[search_by_page_test_cat][region]' => 'content',
), t('Save blocks'));
$this
->drupalPostForm('admin/structure/block/list/seven', array(
'blocks[search_by_page_test_dog][region]' => 'content',
), t('Save blocks'));
\Drupal::service('cache.bootstrap')
->invalidateAll();
variable_initialize();
// Run cron by clicking on the Status Report link.
$this
->drupalGet('admin/reports/status');
$this
->clickLink('run cron manually');
$this
->drupalGet('admin/reports/dblog');
$this
->assertText(t('Cron run completed'), 'Log shows cron run completed');
$this
->assertText('dog', 'Dog block is showing on admin page');
}