You are here

protected function WebformScheduledEmailTest::purgeSubmissions in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_scheduled_email/tests/src/Functional/WebformScheduledEmailTest.php \Drupal\Tests\webform_scheduled_email\Functional\WebformScheduledEmailTest::purgeSubmissions()

Purge all submission before the webform.module is uninstalled.

Overrides WebformBrowserTestTrait::purgeSubmissions

1 call to WebformScheduledEmailTest::purgeSubmissions()
WebformScheduledEmailTest::testWebformScheduledEmail in modules/webform_scheduled_email/tests/src/Functional/WebformScheduledEmailTest.php
Tests webform schedule email handler.

File

modules/webform_scheduled_email/tests/src/Functional/WebformScheduledEmailTest.php, line 350

Class

WebformScheduledEmailTest
Tests for webform scheduled email handler.

Namespace

Drupal\Tests\webform_scheduled_email\Functional

Code

protected function purgeSubmissions() {

  // Manually purge submissions to trigger deletion of scheduled emails.
  $webform_submissions = WebformSubmission::loadMultiple();
  foreach ($webform_submissions as $webform_submission) {
    $webform_submission
      ->delete();
  }

  /** @var \Drupal\webform_scheduled_email\WebformScheduledEmailManagerInterface $scheduled_manager */
  $scheduled_manager = \Drupal::service('webform_scheduled_email.manager');
  $this
    ->assertEqual($scheduled_manager
    ->total(), 0);
}