public function LingotekContentTypeBulkTranslationTest::testCheckSourceStatusWithAnError in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 4.0.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testCheckSourceStatusWithAnError()
- 3.8.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testCheckSourceStatusWithAnError()
Test that we handle errors in update.
File
- tests/
src/ Functional/ LingotekContentTypeBulkTranslationTest.php, line 480
Class
- LingotekContentTypeBulkTranslationTest
- Tests translating a config entity using the bulk management form.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testCheckSourceStatusWithAnError() {
\Drupal::state()
->set('lingotek.must_error_in_check_source_status', TRUE);
// Set upload as manual.
$this
->saveLingotekConfigTranslationSettings([
'node_type' => 'manual',
]);
$this
->goToConfigBulkManagementForm('node_type');
// Upload the document, which must succeed.
$this
->clickLink('EN');
$this
->assertText('Article uploaded successfully');
// Check upload.
$this
->assertLingotekCheckSourceStatusLink();
$this
->clickLink('EN');
// 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
->assertNoSourceStatus('EN', Lingotek::STATUS_REQUEST);
$this
->assertSourceStatus('EN', Lingotek::STATUS_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);
}