You are here

protected function ConfigTranslationListUiTest::doBlockListTest in Drupal 10

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

Tests the block listing for the translate operation.

There are no blocks placed in the testing profile. Add one, then check for Translate operation.

File

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

Class

ConfigTranslationListUiTest
Visit all lists.

Namespace

Drupal\Tests\config_translation\Functional

Code

protected function doBlockListTest() {

  // Add a test block, any block will do.
  // Set the machine name so the translate link can be built later.
  $id = mb_strtolower($this
    ->randomMachineName(16));
  $this
    ->drupalPlaceBlock('system_powered_by_block', [
    'id' => $id,
  ]);

  // Get the Block listing.
  $this
    ->drupalGet('admin/structure/block');
  $translate_link = 'admin/structure/block/manage/' . $id . '/translate';

  // Test if the link to translate the block is on the page.
  $this
    ->assertSession()
    ->linkByHrefExists($translate_link);

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