You are here

public function ConfigTranslationListUiTest::doCustomContentTypeListTest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php \Drupal\config_translation\Tests\ConfigTranslationListUiTest::doCustomContentTypeListTest()

Tests the custom block listing for the translate operation.

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

File

core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php, line 185
Contains \Drupal\config_translation\Tests\ConfigTranslationListUiTest.

Class

ConfigTranslationListUiTest
Visit all lists.

Namespace

Drupal\config_translation\Tests

Code

public function doCustomContentTypeListTest() {

  // Create a test custom block type to decouple looking for translate
  // operations link so this does not test more than necessary.
  $block_content_type = entity_create('block_content_type', array(
    'id' => Unicode::strtolower($this
      ->randomMachineName(16)),
    'label' => $this
      ->randomMachineName(),
    'revision' => FALSE,
  ));
  $block_content_type
    ->save();

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

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