You are here

public function LingotekFieldBodyBulkTranslationTest::testEditedConfigTranslationUsingLinksInAutomaticUploadMode in Lingotek Translation 3.5.x

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

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

File

tests/src/Functional/LingotekFieldBodyBulkTranslationTest.php, line 288

Class

LingotekFieldBodyBulkTranslationTest
Tests translating a field using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

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

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

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

  // 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();

  // Edit the object
  $this
    ->drupalPostForm('/admin/structure/types/manage/article/fields/node.article.body', [
    'label' => 'Body EDITED',
  ], t('Save settings'));

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

  // Check the source status is edited.
  $this
    ->assertSourceStatus('EN', Lingotek::STATUS_IMPORTING);
  $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);

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

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

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