public function DemoUmamiProfileTest::testEditNodesByAdmin in Drupal 9
Same name and namespace in other branches
- 8 core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php \Drupal\Tests\demo_umami\Functional\DemoUmamiProfileTest::testEditNodesByAdmin()
Tests the successful editing of nodes by admin.
File
- core/
profiles/ demo_umami/ tests/ src/ Functional/ DemoUmamiProfileTest.php, line 114
Class
- DemoUmamiProfileTest
- Tests demo_umami profile.
Namespace
Drupal\Tests\demo_umami\FunctionalCode
public function testEditNodesByAdmin() {
$permissions = [
'administer nodes',
'edit any recipe content',
'use editorial transition create_new_draft',
];
$account = $this
->drupalCreateUser($permissions);
$this
->drupalLogin($account);
$webassert = $this
->assertSession();
// Check that admin is able to edit the node.
$nodes = $this->container
->get('entity_type.manager')
->getStorage('node')
->loadByProperties([
'title' => 'Deep mediterranean quiche',
]);
$node = reset($nodes);
$this
->drupalGet($node
->toUrl('edit-form'));
$webassert
->statusCodeEquals('200');
$this
->submitForm([], "Save");
$webassert
->pageTextContains('Recipe Deep mediterranean quiche has been updated.');
}