You are here

protected function LingotekNodeBulkFormTest::setUp in Lingotek Translation 3.4.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::setUp()
  2. 4.0.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::setUp()
  3. 3.0.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::setUp()
  4. 3.1.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::setUp()
  5. 3.2.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::setUp()
  6. 3.3.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::setUp()
  7. 3.5.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::setUp()
  8. 3.6.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::setUp()
  9. 3.7.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::setUp()
  10. 3.8.x tests/src/Functional/Form/LingotekNodeBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekNodeBulkFormTest::setUp()

Overrides LingotekTestBase::setUp

1 call to LingotekNodeBulkFormTest::setUp()
LingotekNodeBulkFormWithContentModerationTest::setUp in tests/src/Functional/Form/LingotekNodeBulkFormWithContentModerationTest.php
1 method overrides LingotekNodeBulkFormTest::setUp()
LingotekNodeBulkFormWithContentModerationTest::setUp in tests/src/Functional/Form/LingotekNodeBulkFormWithContentModerationTest.php

File

tests/src/Functional/Form/LingotekNodeBulkFormTest.php, line 35

Class

LingotekNodeBulkFormTest
Tests the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional\Form

Code

protected function setUp() : void {
  parent::setUp();

  // Create Article node types.
  $this
    ->drupalCreateContentType([
    'type' => 'article',
    'name' => 'Article',
  ]);
  $this
    ->drupalCreateContentType([
    'type' => 'custom_type',
    'name' => 'Custom Type',
  ]);
  $this
    ->drupalCreateContentType([
    'type' => 'not_configured',
    'name' => 'Not Configured',
  ]);

  // Add a language.
  ConfigurableLanguage::createFromLangcode('es')
    ->setThirdPartySetting('lingotek', 'locale', 'es_MX')
    ->save();

  // Enable translation for the current entity type and ensure the change is
  // picked up.
  ContentLanguageSettings::loadByEntityTypeBundle('node', 'article')
    ->setLanguageAlterable(TRUE)
    ->save();
  \Drupal::service('content_translation.manager')
    ->setEnabled('node', 'article', TRUE);
  ContentLanguageSettings::loadByEntityTypeBundle('node', 'custom_type')
    ->setLanguageAlterable(TRUE)
    ->save();
  \Drupal::service('content_translation.manager')
    ->setEnabled('node', 'custom_type', TRUE);
  ContentLanguageSettings::loadByEntityTypeBundle('node', 'not_configured')
    ->setLanguageAlterable(TRUE)
    ->save();
  \Drupal::service('content_translation.manager')
    ->setEnabled('node', 'not_configured', TRUE);
  drupal_static_reset();
  \Drupal::entityTypeManager()
    ->clearCachedDefinitions();
  $this
    ->applyEntityUpdates();

  // Rebuild the container so that the new languages are picked up by services
  // that hold a list of languages.
  $this
    ->rebuildContainer();
  $this
    ->saveLingotekContentTranslationSettingsForNodeTypes();
}