3 namespace Drupal\Tests\content_moderation\Kernel;
5 use Drupal\content_moderation\Permissions;
6 use Drupal\KernelTests\KernelTestBase;
7 use Drupal\workflows\Entity\Workflow;
10 * Test to ensure content moderation permissions are generated correctly.
12 * @group content_moderation
14 class ContentModerationPermissionsTest extends KernelTestBase {
21 public static $modules = [
30 protected function setUp() {
32 $this->installEntitySchema('workflow');
36 * Test permissions generated by content moderation.
38 * @dataProvider permissionsTestCases
40 public function testPermissions($workflow, $permissions) {
41 Workflow::create($workflow)->save();
42 $this->assertEquals($permissions, (new Permissions())->transitionPermissions());
46 * Test cases for ::testPermissions
49 * Content moderation permissions based test cases.
51 public function permissionsTestCases() {
53 'Simple Content Moderation Workflow' => [
55 'id' => 'simple_workflow',
56 'label' => 'Simple Workflow',
57 'type' => 'content_moderation',
66 'label' => 'Unpublish',
67 'from' => ['published'],
78 'label' => 'Published',
84 'use simple_workflow transition publish' => [
85 'title' => 'Use <em class="placeholder">Publish</em> transition from <em class="placeholder">Simple Workflow</em> workflow.',
87 'use simple_workflow transition unpublish' => [
88 'title' => 'Use <em class="placeholder">Unpublish</em> transition from <em class="placeholder">Simple Workflow</em> workflow.',
92 'Non Content Moderation Workflow' => [
96 'type' => 'workflow_type_test',
99 'label' => 'Drink Coffee',