protected function WorkflowResourceTestBase::createEntity in Drupal 9
Same name and namespace in other branches
- 8 core/modules/workflows/tests/src/Functional/Rest/WorkflowResourceTestBase.php \Drupal\Tests\workflows\Functional\Rest\WorkflowResourceTestBase::createEntity()
Creates the entity to be tested.
Return value
\Drupal\Core\Entity\EntityInterface The entity to be tested.
Overrides EntityResourceTestBase::createEntity
File
- core/
modules/ workflows/ tests/ src/ Functional/ Rest/ WorkflowResourceTestBase.php, line 48
Class
- WorkflowResourceTestBase
- ResourceTestBase for Workflow entity.
Namespace
Drupal\Tests\workflows\Functional\RestCode
protected function createEntity() {
$workflow = Workflow::create([
'id' => 'rest_workflow',
'label' => 'REST Workflow',
'type' => 'workflow_type_complex_test',
]);
$workflow
->getTypePlugin()
->addState('draft', 'Draft')
->addState('published', 'Published');
$configuration = $workflow
->getTypePlugin()
->getConfiguration();
$configuration['example_setting'] = 'foo';
$configuration['states']['draft']['extra'] = 'bar';
$workflow
->getTypePlugin()
->setConfiguration($configuration);
$workflow
->save();
return $workflow;
}