ScheduledTransitionsPermissionsTest.php in Scheduled Transitions 8
File
tests/src/Kernel/ScheduledTransitionsPermissionsTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\scheduled_transitions\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait;
use Drupal\Tests\scheduled_transitions\Traits\ScheduledTransitionTestTrait;
class ScheduledTransitionsPermissionsTest extends KernelTestBase {
use ContentModerationTestTrait;
use ScheduledTransitionTestTrait;
protected static $modules = [
'entity_test_revlog',
'entity_test',
'scheduled_transitions',
'content_moderation',
'workflows',
'dynamic_entity_reference',
'user',
'system',
];
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('entity_test_revlog');
}
public function testPermissions() : void {
$this
->enabledBundles([
[
'entity_test_revlog',
'entity_test_revlog',
],
]);
$workflow = $this
->createEditorialWorkflow();
$workflow
->getTypePlugin()
->addEntityTypeAndBundle('entity_test_revlog', 'entity_test_revlog');
$workflow
->save();
$permissionHandler = \Drupal::service('user.permissions');
$permissions = $permissionHandler
->getPermissions();
$this
->assertArrayHasKey('view scheduled transitions entity_test_revlog entity_test_revlog', $permissions);
$this
->assertArrayHasKey('add scheduled transitions entity_test_revlog entity_test_revlog', $permissions);
}
}