diff --git a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php index 48f936127cc62dbe74497c7d92be3a7481fa48a4..7c3cd6bdb71cc87a0f1a8e53e444613e380f1f8d 100644 --- a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php +++ b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php @@ -434,6 +434,28 @@ function testSystemMenuRename() { $this->assertText($edit['label']); } + /** + * Tests that menu items pointing to unpublished nodes are editable. + */ + function testUnpublishedNodeMenuItem() { + $this->drupalLogin($this->drupalCreateUser(array('access administration pages', 'administer blocks', 'administer menu', 'create article content', 'bypass node access'))); + // Create an unpublished node. + $node = $this->drupalCreateNode(array( + 'type' => 'article', + 'status' => NODE_NOT_PUBLISHED, + )); + + $item = $this->addMenuLink(0, 'node/' . $node->id()); + $this->modifyMenuLink($item); + + // Test that a user with 'administer menu' but without 'bypass node access' + // cannot see the menu item. + $this->drupalLogout(); + $this->drupalLogin($this->admin_user); + $this->drupalGet('admin/structure/menu/manage/' . $item['menu_name']); + $this->assertNoText($item['link_title'], "Menu link pointing to unpublished node is only visible to users with 'bypass node access' permission"); + } + /** * Tests the contextual links on a menu block. */