You are here

public function LingotekNodeBulkDisabledTargetOverrideTranslationTest::testNodeTranslationUsingLinks in Lingotek Translation 3.5.x

Same name and namespace in other branches
  1. 4.0.x tests/src/Functional/LingotekNodeBulkDisabledTargetOverrideTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkDisabledTargetOverrideTranslationTest::testNodeTranslationUsingLinks()
  2. 3.6.x tests/src/Functional/LingotekNodeBulkDisabledTargetOverrideTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkDisabledTargetOverrideTranslationTest::testNodeTranslationUsingLinks()
  3. 3.7.x tests/src/Functional/LingotekNodeBulkDisabledTargetOverrideTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkDisabledTargetOverrideTranslationTest::testNodeTranslationUsingLinks()
  4. 3.8.x tests/src/Functional/LingotekNodeBulkDisabledTargetOverrideTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeBulkDisabledTargetOverrideTranslationTest::testNodeTranslationUsingLinks()

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

File

tests/src/Functional/LingotekNodeBulkDisabledTargetOverrideTranslationTest.php, line 81

Class

LingotekNodeBulkDisabledTargetOverrideTranslationTest
Tests translating a node using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testNodeTranslationUsingLinks() {

  // Create a node.
  $edit = [];
  $edit['title[0][value]'] = 'Llamas are cool';
  $edit['body[0][value]'] = 'Llamas are very cool';
  $edit['langcode[0][value]'] = 'en';
  $edit['lingotek_translation_management[lingotek_translation_profile]'] = 'profile_with_disabled_targets';
  $this
    ->saveAndPublishNodeForm($edit);
  $this
    ->goToContentBulkManagementForm();

  // Clicking English must init the upload of content.
  $this
    ->assertLingotekUploadLink();

  // And we cannot request yet a translation.
  $this
    ->assertNoLingotekRequestTranslationLink('es_MX');
  $this
    ->clickLink('EN');
  $this
    ->assertText('Node Llamas are cool has been uploaded.');
  $this
    ->assertIdentical('en_US', \Drupal::state()
    ->get('lingotek.uploaded_locale'));

  // There is a link for checking status.
  $this
    ->assertLingotekCheckSourceStatusLink();

  // And we can already request a translation.
  $this
    ->assertNoLingotekRequestTranslationLink('ca_ES');
  $this
    ->assertLingotekRequestTranslationLink('es_MX');
  $this
    ->clickLink('EN');
  $this
    ->assertText('The import for node Llamas are cool is complete.');
  $this
    ->assertNoLingotekRequestTranslationLink('ca_ES');
  $this
    ->assertLingotekRequestTranslationLink('es_MX');
  $this
    ->assertTargetStatus('es', Lingotek::STATUS_REQUEST);
  $this
    ->assertTargetStatus('ca', Lingotek::STATUS_DISABLED);
}