You are here

protected function LingotekEntityTestBulkTranslationTest::setUp in Lingotek Translation 3.6.x

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

Overrides LingotekTestBase::setUp

File

tests/src/Functional/LingotekEntityTestBulkTranslationTest.php, line 25

Class

LingotekEntityTestBulkTranslationTest
Tests translating the entity test using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

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

  // Place the actions and title block.
  $this
    ->drupalPlaceBlock('page_title_block', [
    'region' => 'content',
    'weight' => -5,
  ]);
  $this
    ->drupalPlaceBlock('local_tasks_block', [
    'region' => 'content',
    'weight' => -10,
  ]);

  // 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('entity_test_mul', 'entity_test_mul')
    ->setLanguageAlterable(TRUE)
    ->save();
  \Drupal::service('content_translation.manager')
    ->setEnabled('entity_test_mul', 'entity_test_mul', 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
    ->saveLingotekContentTranslationSettings([
    'entity_test_mul' => [
      'entity_test_mul' => [
        'profiles' => 'automatic',
        'fields' => [
          'name' => 1,
        ],
      ],
    ],
  ]);

  // This is a hack for avoiding writing different lingotek endpoint mocks.
  \Drupal::state()
    ->set('lingotek.uploaded_content_type', 'entity_test_mul');
}