You are here

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

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

Overrides LingotekFunctionalJavascriptTestBase::setUp

1 call to LingotekNodeParagraphsTranslationTest::setUp()
LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setUp in tests/src/FunctionalJavascript/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php
1 method overrides LingotekNodeParagraphsTranslationTest::setUp()
LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setUp in tests/src/FunctionalJavascript/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php

File

tests/src/FunctionalJavascript/LingotekNodeParagraphsTranslationTest.php, line 27

Class

LingotekNodeParagraphsTranslationTest
@group lingotek @group legacy

Namespace

Drupal\Tests\lingotek\FunctionalJavascript

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 locales.
  ConfigurableLanguage::createFromLangcode('es')
    ->setThirdPartySetting('lingotek', 'locale', 'es_ES')
    ->save();
  ConfigurableLanguage::createFromLangcode('es-ar')
    ->setThirdPartySetting('lingotek', 'locale', 'es_AR')
    ->save();

  // Enable translation for the current entity type and ensure the change is
  // picked up.
  ContentLanguageSettings::loadByEntityTypeBundle('node', 'paragraphed_content_demo')
    ->setLanguageAlterable(TRUE)
    ->save();
  ContentLanguageSettings::loadByEntityTypeBundle('paragraph', 'image_text')
    ->setLanguageAlterable(TRUE)
    ->save();
  \Drupal::service('content_translation.manager')
    ->setEnabled('node', 'paragraphed_content_demo', TRUE);
  if ($this->paragraphsTranslatable) {
    $this
      ->setParagraphFieldsTranslatability();
  }

  // Enable content moderation for articles.
  $workflow = $this
    ->createEditorialWorkflow();
  $workflow
    ->getTypePlugin()
    ->addEntityTypeAndBundle('node', 'paragraphed_content_demo');
  $workflow
    ->save();
  $this
    ->saveLingotekContentTranslationSettings([
    'node' => [
      'paragraphed_content_demo' => [
        'profiles' => 'automatic',
        'fields' => [
          'title' => 1,
          'field_paragraphs_demo' => 1,
        ],
        'moderation' => [
          'upload_status' => 'published',
          'download_transition' => 'publish',
        ],
      ],
    ],
    'paragraph' => [
      'image_text' => [
        'fields' => [
          'field_image_demo' => [
            'title',
            'alt',
          ],
          'field_text_demo' => 1,
        ],
      ],
    ],
  ]);

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