ContentModerationStateAccessControlHandlerTest.php in Drupal 8
File
core/modules/content_moderation/tests/src/Kernel/ContentModerationStateAccessControlHandlerTest.php
View source
<?php
namespace Drupal\Tests\content_moderation\Kernel;
use Drupal\content_moderation\Entity\ContentModerationState;
use Drupal\KernelTests\KernelTestBase;
class ContentModerationStateAccessControlHandlerTest extends KernelTestBase {
public static $modules = [
'content_moderation',
'workflows',
'user',
];
protected $accessControlHandler;
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('content_moderation_state');
$this
->installEntitySchema('user');
$this->accessControlHandler = $this->container
->get('entity_type.manager')
->getAccessControlHandler('content_moderation_state');
}
public function testHandler() {
$entity = ContentModerationState::create([]);
$this
->assertFalse($this->accessControlHandler
->access($entity, 'view'));
$this
->assertFalse($this->accessControlHandler
->access($entity, 'update'));
$this
->assertFalse($this->accessControlHandler
->access($entity, 'delete'));
$this
->assertFalse($this->accessControlHandler
->createAccess());
}
}