abstract class WorkflowResourceTestBase in Drupal 10
Same name and namespace in other branches
- 8 core/modules/workflows/tests/src/Functional/Rest/WorkflowResourceTestBase.php \Drupal\Tests\workflows\Functional\Rest\WorkflowResourceTestBase
- 9 core/modules/workflows/tests/src/Functional/Rest/WorkflowResourceTestBase.php \Drupal\Tests\workflows\Functional\Rest\WorkflowResourceTestBase
ResourceTestBase for Workflow entity.
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\rest\Functional\ResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase
- class \Drupal\Tests\workflows\Functional\Rest\WorkflowResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
- class \Drupal\Tests\rest\Functional\ResourceTestBase
Expanded class hierarchy of WorkflowResourceTestBase
File
- core/
modules/ workflows/ tests/ src/ Functional/ Rest/ WorkflowResourceTestBase.php, line 11
Namespace
Drupal\Tests\workflows\Functional\RestView source
abstract class WorkflowResourceTestBase extends ConfigEntityResourceTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'workflows',
'workflow_type_test',
];
/**
* {@inheritdoc}
*/
protected static $entityTypeId = 'workflow';
/**
* {@inheritdoc}
*/
protected static $patchProtectedFieldNames = [];
/**
* The Workflow entity.
*
* @var \Drupal\workflows\WorkflowInterface
*/
protected $entity;
/**
* {@inheritdoc}
*/
protected function setUpAuthorization($method) {
$this
->grantPermissionsToTestedRole([
'administer workflows',
]);
}
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
protected function getExpectedNormalizedEntity() {
return [
'dependencies' => [
'module' => [
'workflow_type_test',
],
],
'id' => 'rest_workflow',
'label' => 'REST Workflow',
'langcode' => 'en',
'status' => TRUE,
'type' => 'workflow_type_complex_test',
'type_settings' => [
'states' => [
'draft' => [
'extra' => 'bar',
'label' => 'Draft',
'weight' => 0,
],
'published' => [
'label' => 'Published',
'weight' => 1,
],
],
'transitions' => [],
'example_setting' => 'foo',
],
'uuid' => $this->entity
->uuid(),
];
}
/**
* {@inheritdoc}
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
return [];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WorkflowResourceTestBase:: |
protected | property | The Workflow entity. | |
WorkflowResourceTestBase:: |
protected static | property | ||
WorkflowResourceTestBase:: |
protected static | property | 2 | |
WorkflowResourceTestBase:: |
protected static | property | ||
WorkflowResourceTestBase:: |
protected | function | ||
WorkflowResourceTestBase:: |
protected | function | ||
WorkflowResourceTestBase:: |
protected | function | ||
WorkflowResourceTestBase:: |
protected | function |