From f3af39112386a2c6451421bc80aa24b8e2345b2b Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Sat, 6 Apr 2013 01:33:54 +0100 Subject: [PATCH] Issue #1943282 by eporama, RobLoach: Fixed User Account Links Tests assumes certain menu link IDs. --- .../lib/Drupal/user/Tests/UserAccountLinksTests.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/modules/user/lib/Drupal/user/Tests/UserAccountLinksTests.php b/core/modules/user/lib/Drupal/user/Tests/UserAccountLinksTests.php index 6780cf7c0e8d..deec20e6bfa0 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserAccountLinksTests.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserAccountLinksTests.php @@ -72,13 +72,17 @@ function testDisabledAccountLink() { // Create an admin user and log in. $this->drupalLogin($this->drupalCreateUser(array('access administration pages', 'administer menu'))); - // Verify that the 'My account' link is enabled. + // Verify that the 'My account' link is enabled. Do not assume the value of + // auto-increment is 1. Use XPath to obtain input element id and name using + // the consistent label text. $this->drupalGet('admin/structure/menu/manage/account'); - $this->assertFieldChecked('edit-links-mlid2-hidden', "The 'My account' link is enabled by default."); + $label = $this->xpath('//label[contains(.,:text)]/@for', array(':text' => 'Enable My account menu link')); + $this->assertFieldChecked((string) $label[0], "The 'My account' link is enabled by default."); // Disable the 'My account' link. + $input = $this->xpath('//input[@id=:field_id]/@name', array(':field_id' => (string)$label[0])); $edit = array( - 'links[mlid:2][hidden]' => FALSE, + (string) $input[0] => FALSE, ); $this->drupalPost('admin/structure/menu/manage/account', $edit, t('Save')); -- GitLab