You are here

protected function LingotekMediaBulkFormTest::setUp in Lingotek Translation 3.1.x

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

Overrides LingotekTestBase::setUp

File

tests/src/Functional/Form/LingotekMediaBulkFormTest.php, line 35

Class

LingotekMediaBulkFormTest
Tests the bulk management form integration with Media.

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,
  ]);
  $this
    ->createMediaType('image', [
    'id' => 'image',
    'label' => 'Image',
  ]);

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

  // We need to rebuild routes.
  $this
    ->rebuildAll();
  $this
    ->saveLingotekContentTranslationSettings([
    'media' => [
      'image' => [
        'fields' => [
          'name' => 1,
          'field_media_image' => [
            'title',
            'alt',
          ],
        ],
      ],
    ],
  ]);
}