function ConfigTranslationListUiTest::doBlockListTest

Same name in other branches
  1. 8.9.x core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationListUiTest::doBlockListTest()
  2. 10 core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationListUiTest::doBlockListTest()
  3. 11.x 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.

1 call to ConfigTranslationListUiTest::doBlockListTest()
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 101

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>');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.