You are here

function ContentTmgmtEntitySourceListTest::testAvailabilityOfEntityLists in Translation Management Tool 8

File

sources/content/tests/src/Functional/ContentTmgmtEntitySourceListTest.php, line 111

Class

ContentTmgmtEntitySourceListTest
Tests the user interface for entity translation lists.

Namespace

Drupal\Tests\tmgmt_content\Functional

Code

function testAvailabilityOfEntityLists() {
  $this
    ->drupalGet('admin/tmgmt/sources/content/comment');

  // Check if we are at comments page.
  $this
    ->assertSession()
    ->pageTextContains(t('Comment overview (Content Entity)'));

  // No comments yet - empty message is expected.
  $this
    ->assertSession()
    ->pageTextContains(t('No source items matching given criteria have been found.'));
  $this
    ->drupalGet('admin/tmgmt/sources/content/node');

  // Check if we are at nodes page.
  $this
    ->assertSession()
    ->pageTextContains(t('Content overview (Content Entity)'));

  // We expect article title as article node type is entity translatable.
  $this
    ->assertSession()
    ->pageTextContains($this->nodes['article']['en'][0]
    ->label());

  // Page node type should not be listed as it is not entity translatable.
  $this
    ->assertNoText($this->nodes['page']['en'][0]
    ->label());

  // If the source language is not defined, don't display it.
  $this
    ->assertNoText($this->nodes['article'][LanguageInterface::LANGCODE_NOT_SPECIFIED][0]
    ->label());

  // If the source language is not applicable, don't display it.
  $this
    ->assertNoText($this->nodes['article'][LanguageInterface::LANGCODE_NOT_APPLICABLE][0]
    ->label());
}