public function RequestBulkTranslationTest::testRequestBulkTranslationSkippingNodeInOneLanguage in TMGMT Extension Suite 8
Test request bulk translation with conflicting item.
File
- src/
Tests/ RequestBulkTranslationTest.php, line 177
Class
- RequestBulkTranslationTest
- Class RequestBulkTranslationTest
Namespace
Drupal\tmgmt_extension_suit\TestsCode
public function testRequestBulkTranslationSkippingNodeInOneLanguage() {
// Let's get a conflicting job item.
$this
->requestTranslation([
1,
], 'fr', 1);
// Request bulk translation including conflicting job item.
$this
->requestBulkTranslation([
1,
2,
3,
], [
'fr',
], 'local', [
'settings[translator]' => 1,
'settings[job_comment]' => 'Comment',
]);
$this
->assertText('1 item conflicted with pending item and was skipped. Existing job item:');
$this
->assertText('Job item with source language = "en" and target language = "fr" for entity "node" with id = "1".');
$this
->assertText('Translation request queued for 2 jobs. Return to "Sources" page.');
// In upload queue should be 2 jobs: 2 nodes in fr.
$this
->assertEqual($this
->getCountOfItemsInQueue('tmgmt_extension_suit_upload'), 2);
$jobs = Job::loadMultiple([
1,
2,
3,
]);
// Check source language.
$this
->assertEqual($jobs[1]
->getSourceLangcode(), 'en');
$this
->assertEqual($jobs[2]
->getSourceLangcode(), 'en');
$this
->assertEqual($jobs[3]
->getSourceLangcode(), 'en');
// Check target language.
$this
->assertEqual($jobs[1]
->getTargetLangcode(), 'fr');
$this
->assertEqual($jobs[2]
->getTargetLangcode(), 'fr');
$this
->assertEqual($jobs[3]
->getTargetLangcode(), 'fr');
// Check job settings.
$this
->assertEqual($jobs[1]
->get('settings')
->getValue(), [
[
'translator' => '',
'job_comment' => '',
],
]);
$this
->assertEqual($jobs[2]
->get('settings')
->getValue(), [
[
'translator' => 1,
'job_comment' => 'Comment',
],
]);
$this
->assertEqual($jobs[3]
->get('settings')
->getValue(), [
[
'translator' => 1,
'job_comment' => 'Comment',
],
]);
}