protected function WebformNodeBrowserTestTrait::postNodeSubmissionTest in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_node/tests/src/Traits/WebformNodeBrowserTestTrait.php \Drupal\Tests\webform_node\Traits\WebformNodeBrowserTestTrait::postNodeSubmissionTest()
Post a new test submission to a webform node.
Parameters
\Drupal\node\NodeInterface $node: A Webform node.
array $edit: Submission values.
string $submit: Value of the submit button whose click is to be emulated.
array $options: Options to be forwarded to the url generator.
Return value
int The created submission's sid.
See also
\Drupal\webform\Tests\WebformTestBase::postSubmission
2 calls to WebformNodeBrowserTestTrait::postNodeSubmissionTest()
- WebformNodeBrowserTestBaseTest::testWebformNodeBase in modules/
webform_node/ tests/ src/ Functional/ WebformNodeBrowserTestBaseTest.php - Test base helper methods.
- WebformNodeVariantTest::testNodeVariant in modules/
webform_node/ tests/ src/ Functional/ WebformNodeVariantTest.php - Tests webform node variant.
File
- modules/
webform_node/ tests/ src/ Traits/ WebformNodeBrowserTestTrait.php, line 57
Class
- WebformNodeBrowserTestTrait
- Provides convenience methods for webform node browser tests.
Namespace
Drupal\Tests\webform_node\TraitsCode
protected function postNodeSubmissionTest(NodeInterface $node, array $edit = [], $submit = NULL, array $options = []) {
/** @var \Drupal\webform\WebformEntityReferenceManagerInterface $entity_reference_manager */
$entity_reference_manager = \Drupal::service('webform.entity_reference_manager');
$webform = $entity_reference_manager
->getWebform($node);
$submit = $this
->getWebformSubmitButtonLabel($webform, $submit);
$this
->drupalPostForm('/node/' . $node
->id() . '/webform/test', $edit, $submit, $options);
return $this
->getLastSubmissionId($webform);
}