function ConfigTranslationListUiTest::doCustomContentTypeListTest

Tests the content block listing for the translate operation.

1 call to ConfigTranslationListUiTest::doCustomContentTypeListTest()
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 203

Class

ConfigTranslationListUiTest
Visit all lists.

Namespace

Drupal\Tests\config_translation\Functional

Code

public function doCustomContentTypeListTest() {
  // Create a test block type to decouple looking for translate
  // operations link so this does not test more than necessary.
  $block_content_type = BlockContentType::create([
    'id' => $this->randomMachineName(16),
    'label' => $this->randomMachineName(),
    'revision' => FALSE,
  ]);
  $block_content_type->save();
  // Get the block type listing.
  $this->drupalGet('admin/structure/block-content');
  $translate_link = 'admin/structure/block-content/manage/' . $block_content_type->id() . '/translate';
  // Test if the link to translate the block type 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.