public function WebformScheduledTaskDependenciesTest::testDependenciesCalculation in Webform Scheduled Tasks 8.2
Test the dependencies calculation.
File
- tests/
src/ Kernel/ WebformScheduledTaskDependenciesTest.php, line 45
Class
- WebformScheduledTaskDependenciesTest
- Scheduled task dependencies test.
Namespace
Drupal\Tests\webform_scheduled_tasks\KernelCode
public function testDependenciesCalculation() {
$schedule_webform = Webform::create([
'id' => 'scheduled_webform',
]);
$schedule_webform
->save();
$schedule = WebformScheduledTask::create([
'id' => 'test_task',
'webform' => $schedule_webform
->id(),
'result_set_type' => 'all_submissions',
'task_type' => 'test_task',
]);
$schedule
->calculateDependencies();
$schedule
->save();
$this
->assertEquals($schedule
->getWebform()
->id(), $schedule
->getWebform()
->id());
$this
->assertTrue(in_array('webform.webform.scheduled_webform', $schedule
->getDependencies()['config']));
$schedule_webform
->delete();
$this
->assertNull(WebformScheduledTask::load('test_task'));
}