public function WebformSubmissionStorageTest::testStorage in Webform 8.5
Same name and namespace in other branches
- 6.x tests/src/Kernel/WebformSubmissionStorageTest.php \Drupal\Tests\webform\Kernel\WebformSubmissionStorageTest::testStorage()
Test webform submission storage.
File
- tests/
src/ Kernel/ WebformSubmissionStorageTest.php, line 39
Class
- WebformSubmissionStorageTest
- Tests webform submission storage.
Namespace
Drupal\Tests\webform\KernelCode
public function testStorage() {
$webform = Webform::create([
'id' => $this
->randomMachineName(),
]);
$webform
->save();
$webform_submission = WebformSubmission::create([
'webform_id' => $webform
->id(),
]);
$webform_submission
->save();
// Check load by entities.
$webform_submissions = \Drupal::entityTypeManager()
->getStorage('webform_submission')
->loadByEntities($webform);
$this
->assertEquals($webform_submission
->id(), key($webform_submissions));
}