You are here

protected function WebformViewsTestBase::createWebformSubmissions in Webform Views Integration 8.5

Create webform submissions per provided submissions data.

Parameters

array $webform_submissions_data: Array of webform submissions data. Each sub array represents a single webform submission to create and contents of the subarray will be utilized for 'data' property of the created submission.

\Drupal\webform\WebformInterface $webform: Webform within which to create submissions.

8 calls to WebformViewsTestBase::createWebformSubmissions()
WebformViewsArgumentTestBase::testArgument in tests/src/Kernel/argument/WebformViewsArgumentTestBase.php
Test argument handler.
WebformViewsFieldTestBase::testClickSort in tests/src/Kernel/field/WebformViewsFieldTestBase.php
Test click sorting functionality.
WebformViewsFieldTestBase::testField in tests/src/Kernel/field/WebformViewsFieldTestBase.php
Test field rendering.
WebformViewsFieldTestBase::testMultiValueAllInOne in tests/src/Kernel/field/WebformViewsFieldTestBase.php
Test the multivalue element placing all values into single cell.
WebformViewsFieldTestBase::testMultiValueDeltaOffset in tests/src/Kernel/field/WebformViewsFieldTestBase.php
Test the multivalue element placing single value into a cell.

... See full list

File

tests/src/Kernel/WebformViewsTestBase.php, line 132

Class

WebformViewsTestBase
Reasonable starting point for testing integration between webform and views.

Namespace

Drupal\Tests\webform_views\Kernel

Code

protected function createWebformSubmissions(array $webform_submissions_data, WebformInterface $webform) {
  foreach ($webform_submissions_data as $submissions_data) {
    $webform_submission = WebformSubmission::create([
      'webform_id' => $webform
        ->id(),
    ]);
    $webform_submission
      ->setData($submissions_data);
    $webform_submission
      ->save();
  }
}