You are here

protected function LingotekConfigBulkFormTest::setUp in Lingotek Translation 4.0.x

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

Overrides LingotekTestBase::setUp

File

tests/src/Functional/Form/LingotekConfigBulkFormTest.php, line 25

Class

LingotekConfigBulkFormTest
Tests the config 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' => 'page',
    'name' => 'Page',
  ]);

  // 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();
  ContentLanguageSettings::loadByEntityTypeBundle('node', 'page')
    ->setLanguageAlterable(TRUE)
    ->save();
  \Drupal::service('content_translation.manager')
    ->setEnabled('node', 'article', TRUE);
  \Drupal::service('content_translation.manager')
    ->setEnabled('node', 'page', 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([
    'article',
    'page',
  ]);
  $this
    ->saveLingotekConfigTranslationSettings([
    'node_type' => 'automatic',
  ]);
}