function ContentTmgmtEntitySourceListTest::testAvailabilityOfEntityLists

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('Comment overview (Content Entity)');

  // No comments yet - empty message is expected.
  $this
    ->assertSession()
    ->pageTextContains('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('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
    ->assertSession()
    ->pageTextNotContains($this->nodes['page']['en'][0]
    ->label());

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

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