You are here

protected function SubmissionsCompletedSinceLastSuccessTest::setUp in Webform Scheduled Tasks 8.2

Overrides KernelTestBase::setUp

File

tests/src/Kernel/SubmissionsCompletedSinceLastSuccessTest.php, line 57

Class

SubmissionsCompletedSinceLastSuccessTest
Submissions since last success result set plugin test.

Namespace

Drupal\Tests\webform_scheduled_tasks\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installSchema('webform', [
    'webform',
  ]);
  $this
    ->installEntitySchema('webform_submission');
  $this
    ->installEntitySchema('user');
  $current_time =& $this->currentTime;
  $this->time = $this
    ->prophesize(TimeInterface::class);
  $this->time
    ->getRequestTime()
    ->will(function () use (&$current_time) {
    return $current_time;
  });
  $this->container
    ->set('datetime.time', $this->time
    ->reveal());
  $schedule_webform = Webform::create([
    'id' => 'scheduled_webform',
  ]);
  $schedule_webform
    ->save();
  $this->schedule = WebformScheduledTask::create([
    'id' => 'test_task',
    'webform' => $schedule_webform
      ->id(),
    'result_set_type' => 'submissions_completed_since_last_success',
    'task_type' => 'test_task',
  ]);
  $this->schedule
    ->save();
}