protected function setUp(): void
{ parent::
setUp();
// Create a container so that the plugin manager and workflow type can be
// mocked.
$container =
new ContainerBuilder();
$workflow_manager =
$this->
prophesize(WorkflowTypeManager::
class);
$workflow_manager->
createInstance('content_moderation', Argument::
any())->
willReturn(new TestType([], '',
[]));
$container->
set('plugin.manager.workflows.type',
$workflow_manager->
reveal());
\Drupal::
setContainer($container);
$this->workflow =
new Workflow(['id' => 'process', 'type' => 'content_moderation'
], 'workflow'
);
$this->workflow
->
getTypePlugin() ->
addState('draft', 'draft'
) ->
addState('needs_review', 'needs_review'
) ->
addState('published', 'published'
) ->
addTransition('draft', 'draft',
['draft'
], 'draft'
) ->
addTransition('review', 'review',
['draft'
], 'needs_review'
) ->
addTransition('publish', 'publish',
['needs_review', 'published'
], 'published'
);
} /**
* Verifies user-aware transition validation.
*
* @param string $from_id
* The state to transition from.
* @param string $to_id
* The state to transition to.
* @param string $permission
* The permission to give the user, or not.
* @param bool $allowed
* Whether or not to grant a user this permission.
* @param bool $result
* Whether getValidTransitions() is expected to have the.
*
* @dataProvider userTransitionsProvider
*/