protected function WebformViewsTestBase::createWebform in Webform Views Integration 8.5
Create a new webform with provided elements.
Parameters
array $webform_elements: Array of elements to place into the webform.
Return value
\Drupal\webform\WebformInterface Created and saved webform.
8 calls to WebformViewsTestBase::createWebform()
- WebformViewsArgumentTestBase::testArgument in tests/
src/ Kernel/ argument/ WebformViewsArgumentTestBase.php - Test argument handler.
- WebformViewsFieldTestBase::testClickSort in tests/
src/ Kernel/ field/ WebformViewsFieldTestBase.php - Test click sorting functionality.
- WebformViewsFieldTestBase::testField in tests/
src/ Kernel/ field/ WebformViewsFieldTestBase.php - Test field rendering.
- WebformViewsFieldTestBase::testMultiValueAllInOne in tests/
src/ Kernel/ field/ WebformViewsFieldTestBase.php - Test the multivalue element placing all values into single cell.
- WebformViewsFieldTestBase::testMultiValueDeltaOffset in tests/
src/ Kernel/ field/ WebformViewsFieldTestBase.php - Test the multivalue element placing single value into a cell.
File
- tests/
src/ Kernel/ WebformViewsTestBase.php, line 109
Class
- WebformViewsTestBase
- Reasonable starting point for testing integration between webform and views.
Namespace
Drupal\Tests\webform_views\KernelCode
protected function createWebform(array $webform_elements) {
$webform_entity_type = \Drupal::entityTypeManager()
->getDefinition('webform');
$webform = Webform::create([
$webform_entity_type
->getKey('id') => 'webform',
$webform_entity_type
->getKey('label') => $this
->randomString(),
]);
$webform
->setElements($webform_elements);
$webform
->save();
return $webform;
}