diff --git a/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php new file mode 100644 index 0000000..7de3bb3 --- /dev/null +++ b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php @@ -0,0 +1,138 @@ + 'Configuration translation lists', + 'description' => 'Visit all lists.', + 'group' => 'Configuration translation lists', + ); + } + + function setUp() { + parent::setUp(); + + // If using standard profile doesn't help, try user 1, see node access patch + // for example, older one. + + $permissions = array( + 'access site-wide contact form', + 'administer blocks', + 'administer contact forms', + 'administer menu', + 'administer site configuration', + 'administer taxonomy', + 'administer views', + 'translate configuration', + ); + + // 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'; + + // All of them 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'); + + $list_url = 'admin/structure/block'; + $this->drupalGet($list_url); + $this->assertText($translate_operation_title); + // This shows the Translate operation with a minimal install locally. + + // Custom block 'admin/structure/custom-blocks'. + // Contact 'admin/structure/contact'. + // Filter 'admin/config/content/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. + $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); + + // Shortcut 'admin/config/user-interface/shortcut'. + // System 'admin/config/development/maintenance' and + // 'admin/config/system/site-information'. + + // Taxonomy 'admin/structure/taxonomy'. + // 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. + + // User 'admin/config/people/accounts' and 'admin/people/roles'. + + // Views 'admin/structure/views'. + // Menu is being difficult so try another listing to see if test verbose + // shows any Translate word/link. + $list_url = 'admin/structure/views'; + $this->drupalGet($list_url); + $this->assertText($translate_operation_title); + } + +}