You are here

public function ConfigTranslationListUiTest::doShortcutListTest in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationListUiTest::doShortcutListTest()

Tests the shortcut listing for the translate operation.

1 call to ConfigTranslationListUiTest::doShortcutListTest()
ConfigTranslationListUiTest::testTranslateOperationInListUi in core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php
Tests if translate link is added to operations in all configuration lists.

File

core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php, line 287

Class

ConfigTranslationListUiTest
Visit all lists.

Namespace

Drupal\Tests\config_translation\Functional

Code

public function doShortcutListTest() {

  // Create a test shortcut to decouple looking for translate operations
  // link so this does not test more than necessary.
  $shortcut = ShortcutSet::create([
    'id' => mb_strtolower($this
      ->randomMachineName(16)),
    'label' => $this
      ->randomString(),
  ]);
  $shortcut
    ->save();

  // Get the shortcut listing.
  $this
    ->drupalGet('admin/config/user-interface/shortcut');
  $translate_link = 'admin/config/user-interface/shortcut/manage/' . $shortcut
    ->id() . '/translate';

  // Test if the link to translate the shortcut is on the page.
  $this
    ->assertLinkByHref($translate_link);

  // Test if the link to translate actually goes to the translate page.
  $this
    ->drupalGet($translate_link);
  $this
    ->assertRaw('<th>' . t('Language') . '</th>');
}