protected function ModeratedNodeResourceTestBase::createEntity in Drupal 10
Same name and namespace in other branches
- 8 core/modules/rest/tests/src/Functional/EntityResource/ModeratedNode/ModeratedNodeResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\ModeratedNode\ModeratedNodeResourceTestBase::createEntity()
- 9 core/modules/rest/tests/src/Functional/EntityResource/ModeratedNode/ModeratedNodeResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\ModeratedNode\ModeratedNodeResourceTestBase::createEntity()
Creates the entity to be tested.
Return value
\Drupal\Core\Entity\EntityInterface The entity to be tested.
Overrides NodeResourceTestBase::createEntity
File
- core/
modules/ rest/ tests/ src/ Functional/ EntityResource/ ModeratedNode/ ModeratedNodeResourceTestBase.php, line 45
Class
- ModeratedNodeResourceTestBase
- Extend the Node resource test base and apply moderation to the entity.
Namespace
Drupal\Tests\rest\Functional\EntityResource\ModeratedNodeCode
protected function createEntity() {
$entity = parent::createEntity();
if (!$this->workflow) {
$this->workflow = $this
->createEditorialWorkflow();
}
$this->workflow
->getTypePlugin()
->addEntityTypeAndBundle($entity
->getEntityTypeId(), $entity
->bundle());
$this->workflow
->save();
return $entity;
}