You are here

protected function WebformNodeBrowserTestTrait::postNodeSubmission in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_node/tests/src/Traits/WebformNodeBrowserTestTrait.php \Drupal\Tests\webform_node\Traits\WebformNodeBrowserTestTrait::postNodeSubmission()

Post a new 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

11 calls to WebformNodeBrowserTestTrait::postNodeSubmission()
WebformAccessTokensTest::testWebformAccessTokens in modules/webform_access/tests/src/Functional/WebformAccessTokensTest.php
Tests webform access tokens.
WebformGroupTokensTest::testWebformAccessTokens in modules/webform_group/tests/src/Functional/WebformGroupTokensTest.php
Tests webform access tokens.
WebformNodeAccessPermissionsTest::testAccessPermissions in modules/webform_node/tests/src/Functional/Access/WebformNodeAccessPermissionsTest.php
Tests webform node access permissions.
WebformNodeAccessRulesTest::testAccessRules in modules/webform_node/tests/src/Functional/Access/WebformNodeAccessRulesTest.php
Tests webform node access rules.
WebformNodeResultsTest::testResults in modules/webform_node/tests/src/Functional/WebformNodeResultsTest.php
Tests webform node results.

... See full list

File

modules/webform_node/tests/src/Traits/WebformNodeBrowserTestTrait.php, line 30

Class

WebformNodeBrowserTestTrait
Provides convenience methods for webform node browser tests.

Namespace

Drupal\Tests\webform_node\Traits

Code

protected function postNodeSubmission(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(), $edit, $submit, $options);
  return $this
    ->getLastSubmissionId($webform);
}