You are here

protected function LingotekFieldBodyBulkDisabledTargetOverrideTranslationTest::setUp in Lingotek Translation 3.7.x

Same name and namespace in other branches
  1. 4.0.x tests/src/Functional/LingotekFieldBodyBulkDisabledTargetOverrideTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyBulkDisabledTargetOverrideTranslationTest::setUp()
  2. 3.5.x tests/src/Functional/LingotekFieldBodyBulkDisabledTargetOverrideTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyBulkDisabledTargetOverrideTranslationTest::setUp()
  3. 3.6.x tests/src/Functional/LingotekFieldBodyBulkDisabledTargetOverrideTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyBulkDisabledTargetOverrideTranslationTest::setUp()
  4. 3.8.x tests/src/Functional/LingotekFieldBodyBulkDisabledTargetOverrideTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldBodyBulkDisabledTargetOverrideTranslationTest::setUp()

Overrides LingotekTestBase::setUp

File

tests/src/Functional/LingotekFieldBodyBulkDisabledTargetOverrideTranslationTest.php, line 24

Class

LingotekFieldBodyBulkDisabledTargetOverrideTranslationTest
Tests translating a field using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

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

  // Create Article node types.
  $type = $this
    ->drupalCreateContentType([
    'type' => 'article',
    'name' => 'Article',
  ]);
  node_add_body_field($type);

  // Add a language.
  ConfigurableLanguage::createFromLangcode('es')
    ->setThirdPartySetting('lingotek', 'locale', 'es_MX')
    ->save();
  ConfigurableLanguage::createFromLangcode('ca')
    ->setThirdPartySetting('lingotek', 'locale', 'ca_ES')
    ->save();
  $profile = LingotekProfile::create([
    'label' => 'Profile with disabled targets',
    'id' => 'profile_with_disabled_targets',
    'project' => 'test_project',
    'vault' => 'test_vault',
    'auto_upload' => FALSE,
    'workflow' => 'test_workflow',
    'language_overrides' => [
      'es' => [
        'overrides' => 'custom',
        'custom' => [
          'auto_request' => TRUE,
          'workflow' => 'test_workflow',
          'vault' => 'test_vault',
        ],
      ],
      'ca' => [
        'overrides' => 'disabled',
      ],
    ],
  ]);
  $profile
    ->save();
  $this
    ->saveLingotekConfigTranslationSettings([
    'node_fields' => 'profile_with_disabled_targets',
  ]);

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