diff --git a/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php index 7de3bb3..b0a67a2 100644 --- a/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php +++ b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php @@ -57,41 +57,42 @@ class ConfigTranslationListUITest extends WebTestBase { function testTranslateOperationInListUI() { $translate_operation_title = 'Translate'; - // All of them from config_translation_config_translation_group_info(). + // All lists from config_translation_config_translation_group_info(). // Block 'admin/structure/block'. // There are no blocks placed in the minimal profile. Add one, then check // for Translate operation. - // Add a test block, any block will do. - $this->drupalPlaceBlock('user_login_block'); + // Add a test block, any block will do. Take out the login block if can + // get a test block added so that the test here is independent of user + // login block. + // Set the machine name so later can know what the translate link is. + $block_machine_name = drupal_strtolower($this->randomName(16)); + $this->drupalPlaceBlock('user_login_block', array('machine_name' => $block_machine_name)); $list_url = 'admin/structure/block'; $this->drupalGet($list_url); + // Test if Translate appears anywhere on the page. $this->assertText($translate_operation_title); - // This shows the Translate operation with a minimal install locally. + + $translate_link = 'admin/structure/block/manage/stark.' . $block_machine_name . '/translate'; + // Test if the link to translate the block is on the page. + $this->assertLinkByHref($translate_link); // Custom block 'admin/structure/custom-blocks'. + // @todo Create a test custom block. + // Contact 'admin/structure/contact'. + // @todo Add tests for contact forms. + // Filter 'admin/config/content/formats'. + // @todo Add test for formats. // Menu 'admin/structure/menu'. - - // Simple test for 'Translate' anywhere on the menu list page. $list_url = 'admin/structure/menu'; $this->drupalGet($list_url); - $this->assertText($translate_operation_title); - - // Simple test for translate link for the administration menu. Take this out - // when adding a test menu works. See next chunk. - $translate_link = 'admin/structure/menu/manage/admin/translate'; - $this->assertLinkByHref($translate_link); - - // Translate links not showing on verbose. Try going to the link directly - // to see if permissions is a problem. - $translate_link = 'admin/structure/menu/manage/admin/translate'; - $this->drupalGet($translate_link); - // Add a test menu. + // Create a test menu to decouple looking for Translate operations + // link so this does not test more than necessary. $this->drupalGet('admin/structure/menu/add'); // Lowercase the machine name. Find the issue that is supposed to be making // randomMachineName(). @@ -104,32 +105,47 @@ class ConfigTranslationListUITest extends WebTestBase { ); $this->drupalPost('admin/structure/menu/add', $edit, t('Save')); $this->drupalGet($list_url); - // The above does not work, there is no new menu shown in the verbose - // web feedback from running the tests locally. - // Guess what translate url will be added for the test menu and find it. + // Simple test for 'Translate' anywhere on the menu list page. + $this->assertText($translate_operation_title); + $translate_link = 'admin/structure/menu/manage/' . $menu_name . '/translate'; + // Test if the link to translate the menu is on the page. $this->assertLinkByHref($translate_link); // Shortcut 'admin/config/user-interface/shortcut'. + // @todo Add test for shortcut list. + // System 'admin/config/development/maintenance' and // 'admin/config/system/site-information'. + // @todo Add test for system. // Taxonomy 'admin/structure/taxonomy'. - // Simple test for 'Translate' anywhere on the taxonomy list page. $list_url = 'admin/structure/taxonomy'; + + // Create a test vocabulary to decouple looking for Translate operations + // link so this does not test more than necessary. + $vocabulary = entity_create('taxonomy_vocabulary', array( + 'name' => $this->randomName(), + 'description' => $this->randomName(), + 'vid' => drupal_strtolower($this->randomName()), + )); + $vocabulary->save(); + + // Simple test for 'Translate' anywhere on the taxonomy list page. $this->drupalGet($list_url); $this->assertText($translate_operation_title); - // Add test vocabulary to decouple looking for Translate operations link - // so it does not test more than necessary. - // Figure out how to add a test vocabulary. + $translate_link = 'admin/structure/taxonomy/manage/' . $vocabulary->id() . '/translate'; + // Test if the link to translate the vocabulary is on the page. + $this->assertLinkByHref($translate_link); // User 'admin/config/people/accounts' and 'admin/people/roles'. + // @todo Add test for user. // Views 'admin/structure/views'. - // Menu is being difficult so try another listing to see if test verbose - // shows any Translate word/link. + // Frontpage view is enabled in test minimal profile, so do not need to add + // a test view. $list_url = 'admin/structure/views'; $this->drupalGet($list_url); $this->assertText($translate_operation_title);