You are here

public function LingotekContentTypeTranslationTest::testCheckSourceStatusNotCompletedAndStillImporting in Lingotek Translation 3.7.x

Same name and namespace in other branches
  1. 4.0.x tests/src/Functional/LingotekContentTypeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeTranslationTest::testCheckSourceStatusNotCompletedAndStillImporting()
  2. 3.8.x tests/src/Functional/LingotekContentTypeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeTranslationTest::testCheckSourceStatusNotCompletedAndStillImporting()

Test that we handle errors in update.

File

tests/src/Functional/LingotekContentTypeTranslationTest.php, line 532

Class

LingotekContentTypeTranslationTest
Tests translating a content type.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testCheckSourceStatusNotCompletedAndStillImporting() {

  // Check that the translate tab is in the node type.
  $this
    ->drupalGet('/admin/config/regional/config-translation');
  $this
    ->drupalGet('/admin/config/regional/config-translation/node_type');
  $this
    ->clickLink(t('Translate'));

  // Upload the document, which must succeed.
  $this
    ->clickLink('Upload');
  $this
    ->checkForMetaRefresh();
  $this
    ->assertText('Article uploaded successfully');

  // The document has not been imported yet.
  \Drupal::state()
    ->set('lingotek.document_status_completion', FALSE);

  // Check that the upload succeeded.
  $this
    ->clickLink('Check upload status');
  $this
    ->assertText('The import for Article is still pending.');
  $nodeType = NodeType::load('article');

  /** @var \Drupal\lingotek\LingotekConfigTranslationServiceInterface $translation_service */
  $translation_service = \Drupal::service('lingotek.config_translation');
  $source_status = $translation_service
    ->getSourceStatus($nodeType);
  $this
    ->assertEqual(Lingotek::STATUS_IMPORTING, $source_status);
}