public function TaskRunnerTest::testMultipleTasksRun in Webform Scheduled Tasks 8.2
@covers ::executeTasks
File
- tests/
src/ Unit/ TaskRunnerTest.php, line 100
Class
- TaskRunnerTest
- @coversDefaultClass \Drupal\webform_scheduled_tasks\TaskRunner @group webform_scheduled_tasks
Namespace
Drupal\Tests\webform_scheduled_tasks\UnitCode
public function testMultipleTasksRun() {
$failing_task = $this
->prophesize(TaskPluginInterface::class);
$failing_task
->executeTask(Argument::any(), Argument::any())
->willThrow(new \Exception('Failed!'));
$failing_scheduled_task = $this
->createTestScheduledTask($failing_task);
$failing_scheduled_task
->registerFailedTask(Argument::any())
->shouldBeCalled();
$failing_scheduled_task
->halt(Argument::any())
->shouldBeCalled();
$passing_scheduled_task = $this
->createTestScheduledTask();
$passing_scheduled_task
->registerSuccessfulTask()
->shouldBeCalled();
$passing_scheduled_task
->incrementTaskRunDateByInterval()
->shouldBeCalled();
// One failed task should not impact the running of another.
$this->taskRunner
->executeTasks([
$failing_scheduled_task
->reveal(),
$passing_scheduled_task
->reveal(),
]);
}