public function EntityAccessEventTest::testEntityAccessEventWithNoChanges in Hook Event Dispatcher 8
EntityAccessEvent with no changes test.
File
- tests/
src/ Unit/ Entity/ EntityAccessEventTest.php, line 63
Class
- EntityAccessEventTest
- Class EntityAccessEventTest.
Namespace
Drupal\Tests\hook_event_dispatcher\Unit\EntityCode
public function testEntityAccessEventWithNoChanges() {
$entity = $this
->createMock(EntityInterface::class);
$operation = 'test';
$account = $this
->createMock(AccountInterface::class);
$hookAccessResult = hook_event_dispatcher_entity_access($entity, $operation, $account);
/** @var \Drupal\hook_event_dispatcher\Event\Entity\EntityAccessEvent $event */
$event = $this->manager
->getRegisteredEvent(HookEventDispatcherInterface::ENTITY_ACCESS);
self::assertSame($entity, $event
->getEntity());
self::assertSame($operation, $event
->getOperation());
self::assertSame($account, $event
->getAccount());
self::assertTrue($hookAccessResult
->isNeutral());
self::assertFalse($hookAccessResult
->isAllowed());
self::assertFalse($hookAccessResult
->isForbidden());
}