diff --git a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php index 00cc6c1c50..f136c6941c 100644 --- a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php +++ b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php @@ -157,6 +157,7 @@ public function importRecipes() { // Set article author. if (!empty($data['author'])) { $values['uid'] = $this->getUser($data['author']); + $values['field_author'] = $values['uid']; } // Set node alias if exists. if (!empty($data['slug'])) { @@ -348,6 +349,7 @@ protected function getUser($name) { // Creating user without any email/password. $user = $user_storage->create([ 'name' => $name, + 'status' => 1, ]); $user->enforceIsNew(); $user->save(); diff --git a/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php b/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php index 1ef139eaf0..2bc976d80c 100644 --- a/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php +++ b/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php @@ -91,4 +91,21 @@ protected function assertDefaultConfig(StorageInterface $default_config_storage, } } + /** + * Tests the successful editing of nodes by admin. + */ + public function testEditNodesByAdmin() { + $account = $this->drupalCreateUser(['administer nodes', 'edit any recipe content']); + $this->drupalLogin($account); + $webassert = $this->assertSession(); + + // Check that admin is able to edit the node. + $nodes = entity_load_multiple_by_properties('node', ['title' => 'Deep mediterranean quiche']); + $node = reset($nodes); + $this->drupalGet('node/' . $node->id() . '/edit'); + $webassert->statusCodeEquals('200'); + $this->submitForm([], "Save"); + $webassert->pageTextContains('Recipe Deep mediterranean quiche has been updated.'); + } + }