You are here

public function SubmissionsCompletedSinceLastSuccessTest::testBasicIncrementalSubmissions in Webform Scheduled Tasks 8.2

@covers ::getResultSet

File

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

Class

SubmissionsCompletedSinceLastSuccessTest
Submissions since last success result set plugin test.

Namespace

Drupal\Tests\webform_scheduled_tasks\Kernel

Code

public function testBasicIncrementalSubmissions() {
  $published_submissions = [
    $this
      ->createTestSubmission(),
    $this
      ->createTestSubmission(),
    $this
      ->createTestSubmission(),
  ];
  $draft_submission = $this
    ->createTestSubmission([
    'in_draft' => TRUE,
  ]);
  $this
    ->timePasses();
  $this
    ->assertSubmissionResults($published_submissions);
  $this->schedule
    ->registerSuccessfulTask();
  $new_submissions = [
    $this
      ->createTestSubmission(),
    $this
      ->createTestSubmission(),
    $this
      ->createTestSubmission(),
  ];
  $this
    ->timePasses();
  $this
    ->assertSubmissionResults($new_submissions);
  $this->schedule
    ->registerSuccessfulTask();

  // Draft submissions created previously, will be included in the list of
  // submissions once they are out of draft status.
  $draft_submission->in_draft = FALSE;
  $draft_submission
    ->save();
  $this
    ->timePasses();
  $this
    ->assertSubmissionResults([
    $draft_submission,
  ]);
  $this->schedule
    ->registerSuccessfulTask();
}