$this->
drupalGet('admin/config/regional/translate/settings'
);
$this->
submitForm($edit, 'Save configuration'
);
// Execute locale cron tasks to add tasks to the queue.
locale_cron();
// Check whether tasks are added to the queue.
$queue = \Drupal::
queue('locale_translation', TRUE
);
$this->
assertEquals(2,
$queue->
numberOfItems(), 'Queue holds tasks for one project.'
);
$item =
$queue->
claimItem();
$queue->
releaseItem($item);
$this->
assertEquals('contrib_module_two',
$item->data
[1
][0
], 'Queue holds tasks for contrib module one.'
);
// Test: Run cron for a second time and check if tasks are not added to
// the queue twice.
locale_cron();
// Check whether no more tasks are added to the queue.
$queue = \Drupal::
queue('locale_translation', TRUE
);
$this->
assertEquals(2,
$queue->
numberOfItems(), 'Queue holds tasks for one project.'
);
// Ensure last checked is updated to a greater time than the initial value.