You are here

protected function EmailedExportTest::createTestWebform in Webform Scheduled Tasks 8.2

Create a test webform.

Parameters

array $values: Values to save with the webform.

Return value

\Drupal\Core\Entity\EntityInterface|\Drupal\webform\Entity\Webform A test webform.

1 call to EmailedExportTest::createTestWebform()
EmailedExportTest::setUp in tests/src/Kernel/EmailedExportTest.php

File

tests/src/Kernel/EmailedExportTest.php, line 407

Class

EmailedExportTest
Test the email export plugin.

Namespace

Drupal\Tests\webform_scheduled_tasks\Kernel

Code

protected function createTestWebform(array $values = []) {
  $webform = Webform::create($values + [
    'id' => 'foo',
    'title' => 'Test form',
  ]);
  $webform
    ->save();
  $elements = [
    'name' => [
      '#type' => 'textfield',
      '#title' => 'name',
    ],
    'test_file' => [
      '#type' => 'managed_file',
      '#title' => 'Important file',
    ],
  ];
  $webform
    ->setElements($elements);
  $webform
    ->save();
  return $webform;
}