You are here

public function LingotekContentTypeBulkTranslationTest::testContentTypeMultipleLanguageTranslationUsingActions in Lingotek Translation 3.6.x

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

Tests that a config entity can be translated using the actions on the management page.

File

tests/src/Functional/LingotekContentTypeBulkTranslationTest.php, line 171

Class

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

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testContentTypeMultipleLanguageTranslationUsingActions() {
  $assert_session = $this
    ->assertSession();

  // Login as admin.
  $this
    ->drupalLogin($this->rootUser);

  // Set upload as manual.
  $this
    ->saveLingotekConfigTranslationSettings([
    'node_type' => 'manual',
  ]);

  // Add a language.
  ConfigurableLanguage::createFromLangcode('de')
    ->setThirdPartySetting('lingotek', 'locale', 'de_AT')
    ->save();

  // Create another node type
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Page',
  ]);

  // Go to the bulk config management page.
  $this
    ->goToConfigBulkManagementForm('node_type');
  $basepath = \Drupal::request()
    ->getBasePath();

  // I can init the upload of content.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/upload/node_type/article?destination=' . $basepath . '/admin/lingotek/config/manage');
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/upload/node_type/page?destination=' . $basepath . '/admin/lingotek/config/manage');
  $edit = [
    'table[article]' => TRUE,
    'table[page]' => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForUpload('node_type'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // I can check current status.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/check_upload/node_type/article?destination=' . $basepath . '/admin/lingotek/config/manage');
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/check_upload/node_type/page?destination=' . $basepath . '/admin/lingotek/config/manage');
  $edit = [
    'table[article]' => TRUE,
    'table[page]' => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForCheckUpload('node_type'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Request all the translations.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/request/node_type/article/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/request/node_type/page/de_AT?destination=' . $basepath . '/admin/lingotek/config/manage');
  $edit = [
    'table[article]' => TRUE,
    'table[page]' => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForRequestTranslations('node_type'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Check status of all the translations.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/check_download/node_type/article/de_AT?destination=' . $basepath . '/admin/lingotek/config/manage');
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/check_download/node_type/page/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $edit = [
    'table[article]' => TRUE,
    'table[page]' => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForCheckTranslations('node_type'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Download all the translations.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/download/node_type/article/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/download/node_type/page/de_AT?destination=' . $basepath . '/admin/lingotek/config/manage');
  $edit = [
    'table[article]' => TRUE,
    'table[page]' => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForDownloadTranslations('node_type'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
}