You are here

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

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

Overrides LingotekTestBase::setUp

File

tests/src/Functional/LingotekWebformBulkTranslationTest.php, line 32

Class

LingotekWebformBulkTranslationTest
Tests translating a config entity using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $values = [
    'id' => 'test',
    'title' => 'Test',
  ];
  $elements = [
    'first_name' => [
      '#type' => 'textfield',
      '#title' => 'First name',
    ],
    'last_name' => [
      '#type' => 'textfield',
      '#title' => 'Last name',
    ],
    'sex' => [
      '#type' => 'webform_select_other',
      '#options' => 'sex',
      '#title' => 'Sex',
    ],
    'martial_status' => [
      '#type' => 'webform_select_other',
      '#options' => 'marital_status',
      '#title' => 'Martial status',
    ],
    'employment_status' => [
      '#type' => 'webform_select_other',
      '#options' => 'employment_status',
      '#title' => 'Employment status',
    ],
    'age' => [
      '#type' => 'number',
      '#title' => 'Age',
    ],
  ];
  $this->webform = $this
    ->createWebform($values, $elements);

  // Add a language.
  ConfigurableLanguage::createFromLangcode('es')
    ->setThirdPartySetting('lingotek', 'locale', 'es_MX')
    ->save();
  $this
    ->saveLingotekConfigTranslationSettings([
    'webform' => 'automatic',
  ]);

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