public function CrudTest::testContinuousTranslators in Translation Management Tool 8
Test crud operations of jobs.
File
- tests/
src/ Kernel/ CrudTest.php, line 614
Class
- CrudTest
- Basic crud operations for jobs and translators
Namespace
Drupal\Tests\tmgmt\KernelCode
public function testContinuousTranslators() {
$translator = $this
->createTranslator();
$this
->assertTrue($translator
->getPlugin() instanceof ContinuousTranslatorInterface);
$job = $this
->createJob('en', 'de', 0, [
'job_type' => Job::TYPE_CONTINUOUS,
]);
$this
->assertEqual(Job::TYPE_CONTINUOUS, $job
->getJobType());
$job->translator = $translator
->id();
$job
->save();
// Add a test item.
$item = $job
->addItem('test_source', 'test', 1);
/** @var ContinuousTranslatorInterface $plugin */
$plugin = $job
->getTranslatorPlugin();
$plugin
->requestJobItemsTranslation([
$item,
]);
$this
->assertEqual($item
->getData()['dummy']['deep_nesting']['#translation']['#text'], 'de(de-ch): Text for job item with type test and id 1.');
}