You are here

function ContentTmgmtEntitySourceListTest::setUp in Translation Management Tool 8

Overrides DrupalWebTestCase::setUp()

Overrides TMGMTTestBase::setUp

File

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

Class

ContentTmgmtEntitySourceListTest
Tests the user interface for entity translation lists.

Namespace

Drupal\Tests\tmgmt_content\Functional

Code

function setUp() : void {
  parent::setUp();
  $this
    ->loginAsAdmin();
  $this
    ->addLanguage('de');
  $this
    ->addLanguage('fr');
  $this
    ->addLanguage('it');
  $this
    ->createNodeType('article', 'Article', TRUE);
  $this
    ->createNodeType('page', 'Page', TRUE);

  // Enable entity translations for nodes and comments.
  $content_translation_manager = \Drupal::service('content_translation.manager');
  $content_translation_manager
    ->setEnabled('node', 'article', TRUE);
  $content_translation_manager
    ->setEnabled('node', 'page', FALSE);

  // Create nodes that will be used during tests.
  // NOTE that the order matters as results are read by xpath based on
  // position in the list.
  $this->nodes['page']['en'][] = $this
    ->createTranslatableNode('page');
  $this->nodes['article']['de'][0] = $this
    ->createTranslatableNode('article', 'de');
  $this->nodes['article']['fr'][0] = $this
    ->createTranslatableNode('article', 'fr');
  $this->nodes['article']['en'][3] = $this
    ->createTranslatableNode('article', 'en');
  $this->nodes['article']['en'][2] = $this
    ->createTranslatableNode('article', 'en');
  $this->nodes['article']['en'][1] = $this
    ->createTranslatableNode('article', 'en');
  $this->nodes['article']['en'][0] = $this
    ->createTranslatableNode('article', 'en');
  $this->nodes['article'][LanguageInterface::LANGCODE_NOT_SPECIFIED][0] = $this
    ->createTranslatableNode('article', LanguageInterface::LANGCODE_NOT_SPECIFIED);
  $this->nodes['article'][LanguageInterface::LANGCODE_NOT_APPLICABLE][0] = $this
    ->createTranslatableNode('article', LanguageInterface::LANGCODE_NOT_APPLICABLE);
}