public function WebformAccessSubmissionViewsTest::testWebformAccessSubmissionViewsTest in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_access/tests/src/Functional/WebformAccessSubmissionViewsTest.php \Drupal\Tests\webform_access\Functional\WebformAccessSubmissionViewsTest::testWebformAccessSubmissionViewsTest()
Tests webform access submission views.
File
- modules/
webform_access/ tests/ src/ Functional/ WebformAccessSubmissionViewsTest.php, line 26
Class
- WebformAccessSubmissionViewsTest
- Tests for webform access submission views.
Namespace
Drupal\Tests\webform_access\FunctionalCode
public function testWebformAccessSubmissionViewsTest() {
// Create a test submission for each node and user account.
$webform = Webform::load('contact');
/** @var \Drupal\webform\WebformSubmissionGenerateInterface $submission_generate */
$submission_generate = \Drupal::service('webform_submission.generate');
foreach ($this->nodes as $node) {
foreach ($this->users as $user) {
WebformSubmission::create([
'webform_id' => 'contact',
'entity_type' => 'node',
'entity_id' => $node
->id(),
'uid' => $user
->id(),
'data' => $submission_generate
->getData($webform),
])
->save();
}
}
$this
->checkUserSubmissionAccess($webform, $this->users);
}