You are here

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

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

Overrides LingotekTestBase::setUp

File

tests/src/Functional/Form/LingotekParagraphsBulkFormTest.php, line 32

Class

LingotekParagraphsBulkFormTest
Tests the bulk management form integration with Paragraphs.

Namespace

Drupal\Tests\lingotek\Functional\Form

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('node', 'paragraphed_content_demo')
    ->setLanguageAlterable(TRUE)
    ->save();
  \Drupal::service('content_translation.manager')
    ->setEnabled('node', 'paragraphed_content_demo', TRUE);
  drupal_static_reset();
  \Drupal::entityTypeManager()
    ->clearCachedDefinitions();
  $this
    ->applyEntityUpdates();

  // We need to rebuild routes.
  $this
    ->rebuildAll();
  $this
    ->saveLingotekContentTranslationSettings([
    'node' => [
      'paragraphed_content_demo' => [
        'profiles' => 'automatic',
        'fields' => [
          'title' => 1,
          'field_paragraphs_demo' => 1,
        ],
      ],
    ],
  ]);
  $this
    ->saveLingotekContentTranslationSettings([
    'paragraph' => [
      'image_text' => [
        'fields' => [
          'field_image_demo' => [
            'title',
            'alt',
          ],
          'field_text_demo' => 1,
        ],
      ],
    ],
  ]);
}