protected function WebformSubmissionViewsAccessTest::createSubmissions in Webform 6.x
Same name and namespace in other branches
- 8.5 tests/src/Functional/WebformSubmissionViewsAccessTest.php \Drupal\Tests\webform\Functional\WebformSubmissionViewsAccessTest::createSubmissions()
Create test a submission for each account.
Parameters
\Drupal\webform\WebformInterface $webform: The webform.
array $accounts: An associative array of test users.
2 calls to WebformSubmissionViewsAccessTest::createSubmissions()
- WebformSubmissionViewsAccessTest::testEntityAccess in tests/
src/ Functional/ WebformSubmissionViewsAccessTest.php - Test webform submission entity access in a view query.
- WebformSubmissionViewsAccessTest::testPermissionAccess in tests/
src/ Functional/ WebformSubmissionViewsAccessTest.php - Tests webform submission views enforce access per user's permissions.
File
- tests/
src/ Functional/ WebformSubmissionViewsAccessTest.php, line 145
Class
- WebformSubmissionViewsAccessTest
- Tests access rules in the context of webform submission views access.
Namespace
Drupal\Tests\webform\FunctionalCode
protected function createSubmissions(WebformInterface $webform, array $accounts) {
/** @var \Drupal\webform\WebformSubmissionGenerateInterface $submission_generate */
$submission_generate = \Drupal::service('webform_submission.generate');
// Create a test submission for each user account.
foreach ($accounts as $account) {
WebformSubmission::create([
'webform_id' => $webform
->id(),
'uid' => $account
->id(),
'data' => $submission_generate
->getData($webform),
])
->save();
}
}