public function LingotekEntityTestBulkTranslationTest::testCheckSourceStatusNotCompleted in Lingotek Translation 8
Tests that all the statuses are set when using the Check Translations action.
File
- src/
Tests/ LingotekEntityTestBulkTranslationTest.php, line 244
Class
- LingotekEntityTestBulkTranslationTest
- Tests translating the entity test using the bulk management form.
Namespace
Drupal\lingotek\TestsCode
public function testCheckSourceStatusNotCompleted() {
// Create a entity_test_mul.
$edit = [];
$edit['name[0][value]'] = 'Llamas are cool';
$edit['field_test_text[0][value]'] = 'Llamas are very cool';
$edit['langcode[0][value]'] = 'en';
$edit['lingotek_translation_profile'] = 'manual';
$this
->drupalPostForm('/entity_test_mul/add/entity_test_mul', $edit, t('Save'));
$this
->goToContentBulkManagementForm('entity_test_mul');
$basepath = \Drupal::request()
->getBasePath();
// I can init the upload of content.
$this
->assertLinkByHref($basepath . '/admin/lingotek/entity/upload/entity_test_mul/1?destination=' . $basepath . '/admin/lingotek/manage/entity_test_mul');
$edit = [
'table[1]' => TRUE,
'operation' => 'upload',
];
$this
->drupalPostForm(NULL, $edit, t('Execute'));
$this
->assertIdentical('en_US', \Drupal::state()
->get('lingotek.uploaded_locale'));
// I can check current status.
$this
->assertLinkByHref($basepath . '/admin/lingotek/entity/check_upload/dummy-document-hash-id?destination=' . $basepath . '/admin/lingotek/manage/entity_test_mul');
// The document has not been imported yet.
\Drupal::state()
->set('lingotek.document_status_completion', FALSE);
$edit = [
'table[1]' => TRUE,
'operation' => 'check_upload',
];
$this
->drupalPostForm(NULL, $edit, t('Execute'));
// I can check current status, because it wasn't imported but it's not marked
// as an error.
$this
->assertLinkByHref($basepath . '/admin/lingotek/entity/check_upload/dummy-document-hash-id?destination=' . $basepath . '/admin/lingotek/manage/entity_test_mul');
// Check again, it succeeds.
\Drupal::state()
->set('lingotek.document_status_completion', TRUE);
$edit = [
'table[1]' => TRUE,
'operation' => 'check_upload',
];
$this
->drupalPostForm(NULL, $edit, t('Execute'));
// Assert that targets can be requested.
$this
->assertLinkByHref($basepath . '/admin/lingotek/entity/add_target/dummy-document-hash-id/es_MX?destination=' . $basepath . '/admin/lingotek/manage/entity_test_mul');
}