You are here

public function LingotekContentTypeBulkTranslationTest::testEditedConfigTranslationUsingLinks 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::testEditedConfigTranslationUsingLinks()
  2. 4.0.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testEditedConfigTranslationUsingLinks()
  3. 3.0.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testEditedConfigTranslationUsingLinks()
  4. 3.1.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testEditedConfigTranslationUsingLinks()
  5. 3.2.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testEditedConfigTranslationUsingLinks()
  6. 3.3.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testEditedConfigTranslationUsingLinks()
  7. 3.4.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testEditedConfigTranslationUsingLinks()
  8. 3.5.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testEditedConfigTranslationUsingLinks()
  9. 3.7.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testEditedConfigTranslationUsingLinks()
  10. 3.8.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testEditedConfigTranslationUsingLinks()

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

File

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

Class

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

Namespace

Drupal\Tests\lingotek\Functional

Code

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

  // We need a node with translations first.
  $this
    ->testContentTypeTranslationUsingLinks();

  // Set upload as manual.
  $edit = [
    'table[article]' => TRUE,
    $this
      ->getBulkOperationFormName() => 'change_profile:manual',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Add a language so we can check that it's not marked as dirty if there are
  // no translations.
  ConfigurableLanguage::createFromLangcode('eu')
    ->setThirdPartySetting('lingotek', 'locale', 'eu_ES')
    ->save();

  // Add a language so we can check that it's not marked as for requesting if
  // it was already requested.
  ConfigurableLanguage::createFromLangcode('ko')
    ->setThirdPartySetting('lingotek', 'locale', 'ko_KR')
    ->save();

  // Edit the object
  $this
    ->drupalPostForm('/admin/structure/types/manage/article', [
    'name' => 'Article EDITED',
  ], t('Save content type'));

  // Go to the bulk config management page.
  $this
    ->goToConfigBulkManagementForm('node_type');

  // Check the source status is edited.
  $this
    ->assertSourceStatus('EN', Lingotek::STATUS_EDITED);
  $this
    ->assertTargetStatus('ES', Lingotek::STATUS_PENDING);

  // Check the status is not edited for Vasque, but available to request
  // translation.
  $this
    ->assertNoTargetStatus('EU', Lingotek::STATUS_EDITED);
  $this
    ->assertTargetStatus('EU', Lingotek::STATUS_REQUEST);

  // Request korean, with outdated content available.
  $this
    ->clickLink('KO');
  $this
    ->assertText("Translation to ko_KR requested successfully");

  // Reupload the content.
  $this
    ->clickLink('EN');
  $this
    ->assertText('Article EDITED has been updated.');

  // Recheck status.
  $this
    ->clickLink('EN');
  $this
    ->assertText('Article EDITED status checked successfully');

  // Korean should still be marked as requested, so we can check target.
  $this
    ->assertTargetStatus('KO', 'pending');

  // Check the translation after having been edited.
  $edit = [
    'table[article]' => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForCheckTranslations('node_type'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertText('Operations completed.');

  // Download the translation.
  $this
    ->clickLink('ES');
  $this
    ->assertText('Translation to es_MX downloaded successfully');
}