installEntitySchema('workflow'); } /** * Test permissions generated by content moderation. * * @dataProvider permissionsTestCases */ public function testPermissions($workflow, $permissions) { Workflow::create($workflow)->save(); $this->assertEquals($permissions, (new Permissions())->transitionPermissions()); } /** * Test cases for ::testPermissions * * @return array * Content moderation permissions based test cases. */ public function permissionsTestCases() { return [ 'Simple Content Moderation Workflow' => [ [ 'id' => 'simple_workflow', 'label' => 'Simple Workflow', 'type' => 'content_moderation', ], [ 'use simple_workflow transition publish' => [ 'title' => 'Simple Workflow workflow: Use Publish transition.', ], 'use simple_workflow transition create_new_draft' => [ 'title' => 'Simple Workflow workflow: Use Create New Draft transition.', ], ], ], 'Non Content Moderation Workflow' => [ [ 'id' => 'morning', 'label' => 'Morning', 'type' => 'workflow_type_test', 'transitions' => [ 'drink_coffee' => [ 'label' => 'Drink Coffee', 'from' => ['tired'], 'to' => 'awake', 'weight' => 0, ], ], 'states' => [ 'awake' => [ 'label' => 'Awake', 'weight' => -5, ], 'tired' => [ 'label' => 'Tired', 'weight' => -0, ], ], ], [] ], ]; } }