You are here

public function LingotekNodeBulkTranslationTest::testAddingContentInDifferentLocale in Lingotek Translation 3.8.x

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

Test that when a node is uploaded in a different locale that locale is used.

File

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

Class

LingotekNodeBulkTranslationTest
Tests translating a node using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testAddingContentInDifferentLocale() {

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

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

  // Clicking Spanish must init the upload of content.
  $this
    ->assertLingotekUploadLink(1, 'node', 'es');

  // And we cannot request yet a translation.
  $this
    ->assertNoLingotekRequestTranslationLink('en_US', 'dummy-document-hash-id', 'node', 'es');
  $this
    ->clickLink('ES');
  $this
    ->assertText('Node Llamas are cool es-MX has been uploaded.');
  $this
    ->assertIdentical('es_MX', \Drupal::state()
    ->get('lingotek.uploaded_locale'));
}