You are here

public function LingotekNodeBulkTranslationTest::testEditedTranslationIsMarkedAsTargetEditedAndNotTheSource in Lingotek Translation 3.0.x

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

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

File

tests/src/Functional/LingotekNodeBulkTranslationTest.php, line 674

Class

LingotekNodeBulkTranslationTest
Tests translating a node using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testEditedTranslationIsMarkedAsTargetEditedAndNotTheSource() {

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

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

  // Edit the node translation.
  $edit = [];
  $edit['title[0][value]'] = 'Las llamas son chulas EDITED';
  $this
    ->saveAndKeepPublishedThisTranslationNodeForm($edit, 1, 'es');
  $this
    ->assertText('Las llamas son chulas EDITED');

  // Login as translation manager.
  $this
    ->drupalLogin($this->translationManagerUser);
  $this
    ->goToContentBulkManagementForm();

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

  // Recheck status.
  $key = $this
    ->getBulkSelectionKey('en', 1);
  $edit = [
    $key => TRUE,
    $this
      ->getBulkOperationFormName() => $this
      ->getBulkOperationNameForCheckTranslations('node'),
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertTargetStatus('ES', Lingotek::STATUS_READY);

  // Download the translation.
  $this
    ->clickLink('ES');
  $this
    ->assertText('The translation of node Llamas are cool into es_MX has been downloaded.');
  $this
    ->assertTargetStatus('ES', Lingotek::STATUS_CURRENT);
  $this
    ->drupalGet('es/node/1');
  $this
    ->assertNoText('Las llamas son chulas EDITED');
}