function DemoUmamiProfileTest::assertDemonstrationWarningMessage
Same name and namespace in other branches
- 11.x core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php \Drupal\Tests\demo_umami\Functional\DemoUmamiProfileTest::assertDemonstrationWarningMessage()
Asserts if the demonstration warning message is displayed properly.
Parameters
array $permissions: The user permissions needed to make the assertions.
1 call to DemoUmamiProfileTest::assertDemonstrationWarningMessage()
- DemoUmamiProfileTest::testDemonstrationWarningMessage in core/
profiles/ demo_umami/ tests/ src/ Functional/ DemoUmamiProfileTest.php - Tests that the navigation warning only appears on the admin pages.
File
-
core/
profiles/ demo_umami/ tests/ src/ Functional/ DemoUmamiProfileTest.php, line 275
Class
- DemoUmamiProfileTest
- Tests demo_umami profile.
Namespace
Drupal\Tests\demo_umami\FunctionalCode
protected function assertDemonstrationWarningMessage(array $permissions) : void {
$account = $this->drupalCreateUser($permissions);
$this->drupalLogin($account);
$web_assert = $this->assertSession();
$nodes = $this->container
->get('entity_type.manager')
->getStorage('node')
->loadByProperties([
'title' => 'Deep mediterranean quiche',
]);
/** @var \Drupal\node\Entity\Node $recipe_node */
$recipe_node = reset($nodes);
// Check when editing a node, the warning is visible.
$this->drupalGet($recipe_node->toUrl('edit-form'));
$web_assert->statusCodeEquals(200);
$web_assert->pageTextContains('This site is intended for demonstration purposes.');
// Check when adding a node, the warning is visible.
$this->drupalGet('node/add/recipe');
$web_assert->statusCodeEquals(200);
$web_assert->pageTextContains('This site is intended for demonstration purposes.');
// Check when looking at admin/content, the warning is visible.
$this->drupalGet('admin/content');
$web_assert->statusCodeEquals(200);
$web_assert->pageTextContains('This site is intended for demonstration purposes.');
// Check when viewing a node, the warning is visible.
$this->drupalGet($recipe_node->toUrl());
$web_assert->statusCodeEquals(200);
$web_assert->pageTextContains('This site is intended for demonstration purposes.');
// Check when viewing the homepage, the warning is visible.
$this->drupalGet('<front>');
$web_assert->statusCodeEquals(200);
$web_assert->pageTextContains('This site is intended for demonstration purposes.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.