diff --git a/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php new file mode 100644 index 0000000..8790c9b --- /dev/null +++ b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php @@ -0,0 +1,99 @@ + 'Configuration translation lists', + 'description' => 'Visit all lists.', + 'group' => 'Configuration translation', + ); + } + + function setUp() { + parent::setUp(); + $permissions = array( + 'translate configuration', + 'administer site configuration', + 'administer contact forms', + 'access site-wide contact form', + 'administer menu', + 'administer taxonomy', + ); + + // Create and log in user. + $admin_user = $this->drupalCreateUser($permissions); + $this->drupalLogin($admin_user); + } + + /* + * Tests all lists of config to see if Translate link is added to operations. + */ + function testTranslateOperationInListUI() { + $translate_operation_title = 'Translate'; + + // Simple test for 'Translate' anywhere on the taxonomy list page. + $list_url = 'admin/structure/taxonomy'; + $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. + + // 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. + $this->drupalGet('admin/structure/menu/add'); + // Lowercase the machine name. Find the issue that is supposed to be making + // randomMachineName(). + $menu_name = drupal_strtolower($this->randomName(16)); + $label = $this->randomName(16); + $edit = array( + 'id' => $menu_name, + 'description' => '', + 'label' => $label, + ); + $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. + $translate_link = 'admin/structure/menu/manage/' . $menu_name . '/translate'; + $this->assertLinkByHref($translate_link); + } + +}