You are here

public function ConfigTranslationListUiTest::doContentTypeListTest in Drupal 9

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

Tests the content type listing for the translate operation.

1 call to ConfigTranslationListUiTest::doContentTypeListTest()
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 241

Class

ConfigTranslationListUiTest
Visit all lists.

Namespace

Drupal\Tests\config_translation\Functional

Code

public function doContentTypeListTest() {

  // Create a test content type to decouple looking for translate operations
  // link so this does not test more than necessary.
  $content_type = $this
    ->drupalCreateContentType([
    'type' => mb_strtolower($this
      ->randomMachineName(16)),
    'name' => $this
      ->randomMachineName(),
  ]);

  // Get the content type listing.
  $this
    ->drupalGet('admin/structure/types');
  $translate_link = 'admin/structure/types/manage/' . $content_type
    ->id() . '/translate';

  // Test if the link to translate the content 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>');
}