diff --git a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarMenuTranslationTest.php b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarMenuTranslationTest.php index 5ba2430..f303f5e 100644 --- a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarMenuTranslationTest.php +++ b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarMenuTranslationTest.php @@ -24,7 +24,7 @@ class ToolbarMenuTranslationTest extends WebTestBase { public static function getInfo() { return array( 'name' => 'Toolbar menu translation', - 'description' => "Tests that toolbar classes don't change when adding a translation.", + 'description' => 'Tests that the toolbar icon class remains for translated menu items.', 'group' => 'Toolbar', ); } @@ -41,24 +41,17 @@ function setUp() { * Tests that toolbar classes don't change when adding a translation. */ function testToolbarClasses() { - $langcode = 'xx'; - // The English name for the language. - $name = $this->randomName(16); + $langcode = 'es'; - // Add custom language. - $edit = array( - 'predefined_langcode' => 'custom', - 'langcode' => $langcode, - 'name' => $name, - 'direction' => '0', - ); - $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); + // Add Spanish. + $edit['predefined_langcode'] = $langcode; + $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language')); - // Add string 'Structure' so it is translatable. + // The menu item 'Structure' in the toolbar will be translated. $menu_item = 'Structure'; - t($menu_item, array(), array('langcode' => $langcode)); - // Reset locale cache. - locale_reset(); + + // Visit a page that has the string on it so it can be translated. + $this->drupalGet($langcode . '/admin/structure'); // Search for the menu item. $search = array( @@ -72,10 +65,10 @@ function testToolbarClasses() { // Check that the class is on the item before we translate it. $xpath = $this->xpath('//a[contains(@class, "icon-structure")]'); - $this->assertEqual(count($xpath), 1, "The menu item class ok before translation."); + $this->assertEqual(count($xpath), 1, 'The menu item class ok before translation.'); // Translate the menu item. - $menu_item_translated=$this->randomName(); + $menu_item_translated = $this->randomName(); $textarea = current($this->xpath('//textarea')); $lid = (string) $textarea[0]['name']; $edit = array( @@ -101,7 +94,7 @@ function testToolbarClasses() { // The icons are included based on the menu item class link title. Test that // class remains the same after translation. $xpath = $this->xpath('//a[contains(@class, "icon-structure")]'); - $this->assertEqual(count($xpath), 1, "The menu item class is the same."); + $this->assertEqual(count($xpath), 1, 'The menu item class is the same.'); } }