public function LingotekContentTypeTranslationTest::testCheckSourceStatusWithAnError in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 4.0.x tests/src/Functional/LingotekContentTypeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeTranslationTest::testCheckSourceStatusWithAnError()
- 3.8.x tests/src/Functional/LingotekContentTypeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeTranslationTest::testCheckSourceStatusWithAnError()
Test that we handle errors in update.
File
- tests/
src/ Functional/ LingotekContentTypeTranslationTest.php, line 502
Class
- LingotekContentTypeTranslationTest
- Tests translating a content type.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testCheckSourceStatusWithAnError() {
\Drupal::state()
->set('lingotek.must_error_in_check_source_status', TRUE);
// 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');
// Check that the upload succeeded.
$this
->clickLink('Check upload status');
// We failed at checking status, but we don't know what happened.
// So we don't mark as error but keep it on importing.
$this
->assertText('Article status check failed. Please try again.');
$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);
}