You are here

protected function WebformNodeBrowserTestTrait::createWebformNode 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::createWebformNode()

Create a webform node.

Parameters

string $webform_id: A webform id.

array $settings: (optional) An associative array of settings for the node, as used in entity_create().

Return value

\Drupal\node\NodeInterface A webform node.

19 calls to WebformNodeBrowserTestTrait::createWebformNode()
WebformAccessBrowserTestBase::setUp in modules/webform_access/tests/src/Functional/WebformAccessBrowserTestBase.php
WebformAlterHooksTest::testWebformAlterHooks in tests/src/Functional/WebformAlterHooksTest.php
Tests webform alter hooks.
WebformGroupElementAccessTest::testGroupElementAccess in modules/webform_group/tests/src/Functional/WebformGroupElementAccessTest.php
Tests webform group element access.
WebformGroupFormAccessTest::testGroupFormAccess in modules/webform_group/tests/src/Functional/WebformGroupFormAccessTest.php
Tests webform group form access.
WebformGroupSubmissionAccessTest::testWebformGroupAccessSubmissionViewsTest in modules/webform_group/tests/src/Functional/WebformGroupSubmissionAccessTest.php
Tests webform group access submission views.

... See full list

File

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

Class

WebformNodeBrowserTestTrait
Provides convenience methods for webform node browser tests.

Namespace

Drupal\Tests\webform_node\Traits

Code

protected function createWebformNode($webform_id, array $settings = []) {
  $settings += [
    'type' => 'webform',
  ];
  $node = $this
    ->drupalCreateNode($settings);
  $node->webform->target_id = $webform_id;
  $node->webform->status = WebformInterface::STATUS_OPEN;
  $node->webform->open = '';
  $node->webform->close = '';
  $node
    ->save();
  return $node;
}