You are here

public function LingotekFieldBodyExistingBulkTranslationTest::testBodyFieldIsUntracked in Lingotek Translation 8.2

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

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

File

tests/src/Functional/LingotekFieldBodyExistingBulkTranslationTest.php, line 51

Class

LingotekFieldBodyExistingBulkTranslationTest
Tests translating a field using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testBodyFieldIsUntracked() {

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

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

  // Assert the untracked translation is shown.
  $this
    ->assertTargetStatus('ES', 'untracked');

  // Clicking English must init the upload of content.
  $this
    ->assertLinkByHref($basepath . '/admin/lingotek/config/upload/field_config/node.article.body?destination=' . $basepath . '/admin/lingotek/config/manage');

  // And we cannot request yet a translation.
  $this
    ->assertNoLinkByHref($basepath . '/admin/lingotek/config/request/field_config/node.article.body/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $this
    ->clickLink('EN');
  $this
    ->assertText(t('Body uploaded successfully'));
  $this
    ->assertIdentical('en_US', \Drupal::state()
    ->get('lingotek.uploaded_locale'));

  // Assert the untracked translation is shown.
  $this
    ->assertTargetStatus('ES', 'untracked');

  // There is a link for checking status.
  $this
    ->assertLinkByHref($basepath . '/admin/lingotek/config/check_upload/field_config/node.article.body?destination=' . $basepath . '/admin/lingotek/config/manage');

  // And we can already request a translation.
  $this
    ->assertLinkByHref($basepath . '/admin/lingotek/config/request/field_config/node.article.body/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $this
    ->clickLink('EN');
  $this
    ->assertText('Body status checked successfully');

  // Request the Spanish translation.
  $this
    ->assertLinkByHref($basepath . '/admin/lingotek/config/request/field_config/node.article.body/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $this
    ->clickLink('ES');
  $this
    ->assertText("Translation to es_MX requested successfully");
  $this
    ->assertIdentical('es_MX', \Drupal::state()
    ->get('lingotek.added_target_locale'));

  // Check status of the Spanish translation.
  $this
    ->assertLinkByHref($basepath . '/admin/lingotek/config/check_download/field_config/node.article.body/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $this
    ->clickLink('ES');
  $this
    ->assertIdentical('es_MX', \Drupal::state()
    ->get('lingotek.checked_target_locale'));
  $this
    ->assertText("Translation to es_MX status checked successfully");

  // Download the Spanish translation.
  $this
    ->assertLinkByHref($basepath . '/admin/lingotek/config/download/field_config/node.article.body/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $this
    ->clickLink('ES');
  $this
    ->assertText('Translation to es_MX downloaded successfully');
  $this
    ->assertIdentical('es_MX', \Drupal::state()
    ->get('lingotek.downloaded_locale'));

  // Now the link is to the workbench, and it opens in a new tab.
  $this
    ->assertLingotekWorkbenchLink('es_MX');
}