You are here

protected function EmailedExportTest::createTestSubmissions in Webform Scheduled Tasks 8.2

Create test submissions.

9 calls to EmailedExportTest::createTestSubmissions()
EmailedExportTest::testArchiveBasedExport in tests/src/Kernel/EmailedExportTest.php
Test an archive based export.
EmailedExportTest::testBadExportsAreNotCompleted in tests/src/Kernel/EmailedExportTest.php
Test bad exports do not result in lost files.
EmailedExportTest::testExportRetainedSubmissions in tests/src/Kernel/EmailedExportTest.php
Test submissions are retained by default.
EmailedExportTest::testExportSubmissionsDelete in tests/src/Kernel/EmailedExportTest.php
Test deleting submissions after an export.
EmailedExportTest::testFileSystemExport in tests/src/Kernel/EmailedExportTest.php
Test exporting submissions to the file system.

... See full list

File

tests/src/Kernel/EmailedExportTest.php, line 378

Class

EmailedExportTest
Test the email export plugin.

Namespace

Drupal\Tests\webform_scheduled_tasks\Kernel

Code

protected function createTestSubmissions() {
  $submissions = [];
  foreach ([
    'FOO SUBMISSION CONTENT',
    'BAR SUBMISSION CONTENT',
  ] as $submission_content) {
    $test_file = $this->container
      ->get('plugin.manager.webform.element')
      ->createInstance('managed_file')
      ->getTestValues([
      '#webform_key' => 'test',
      '#file_extensions' => 'pdf',
    ], $this->testWebform, []);
    $submission = WebformSubmission::create([
      'webform_id' => 'foo',
      'data' => [
        'name' => $submission_content,
        'test_file' => array_shift($test_file),
      ],
    ]);
    $submission
      ->save();
    $submissions[] = $submission;
  }
  return $submissions;
}