class ContentModerationStateAccessControlHandlerTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/content_moderation/tests/src/Kernel/ContentModerationStateAccessControlHandlerTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationStateAccessControlHandlerTest
- 9 core/modules/content_moderation/tests/src/Kernel/ContentModerationStateAccessControlHandlerTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationStateAccessControlHandlerTest
@coversDefaultClass \Drupal\content_moderation\ContentModerationStateAccessControlHandler @group content_moderation
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, ConfigTestTrait, ExtensionListTestTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\Tests\content_moderation\Kernel\ContentModerationStateAccessControlHandlerTest
Expanded class hierarchy of ContentModerationStateAccessControlHandlerTest
File
- core/
modules/ content_moderation/ tests/ src/ Kernel/ ContentModerationStateAccessControlHandlerTest.php, line 12
Namespace
Drupal\Tests\content_moderation\KernelView source
class ContentModerationStateAccessControlHandlerTest extends KernelTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'content_moderation',
'workflows',
'user',
];
/**
* The content_moderation_state access control handler.
*
* @var \Drupal\Core\Entity\EntityAccessControlHandlerInterface
*/
protected $accessControlHandler;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('content_moderation_state');
$this
->installEntitySchema('user');
$this->accessControlHandler = $this->container
->get('entity_type.manager')
->getAccessControlHandler('content_moderation_state');
}
/**
* @covers ::checkAccess
* @covers ::checkCreateAccess
*/
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());
}
}