You are here

public function LingotekTranslationStatusesFormatterTest::testStatusForMissingLanguage in Lingotek Translation 4.0.x

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

File

tests/src/Functional/FieldFormatters/LingotekTranslationStatusesFormatterTest.php, line 76

Class

LingotekTranslationStatusesFormatterTest
Tests the Lingotek translation statuses field formatter.

Namespace

Drupal\Tests\lingotek\Functional\FieldFormatters

Code

public function testStatusForMissingLanguage() {
  $basepath = \Drupal::request()
    ->getBasePath();

  // 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]'] = 'automatic';
  $this
    ->saveAndPublishNodeForm($edit);
  $this
    ->assertSession()
    ->addressEquals('/node/1');
  $node = Node::load(1);

  /** @var \Drupal\lingotek\LingotekContentTranslationServiceInterface $service */
  $service = \Drupal::service('lingotek.content_translation');
  $service
    ->setTargetStatus($node, 'nb_NO', Lingotek::STATUS_READY);
  $this
    ->drupalGet('/metadata/1');
  $this
    ->assertSession()
    ->responseNotContains('Lingotek translation status');
  $link = $this
    ->xpath("//a[@href='{$basepath}/admin/lingotek/entity/add_target/dummy-document-hash-id/de_DE?destination=" . $basepath . "/metadata/1' and @class='language-icon target-request' and @title='German - Request translation' and text()='DE']");
  $this
    ->assertEqual(count($link), 1, 'Link exists.');
  $link = $this
    ->xpath("//a[@href='{$basepath}/admin/lingotek/entity/add_target/dummy-document-hash-id/es_MX?destination=" . $basepath . "/metadata/1' and @class='language-icon target-request' and @title='Spanish - Request translation' and text()='ES']");
  $this
    ->assertEqual(count($link), 1, 'Link exists.');
}