public function UserEventTest::testUserCancelEvent in Hook Event Dispatcher 8.2
Same name and namespace in other branches
- 3.x modules/user_event_dispatcher/tests/src/Unit/User/UserEventTest.php \Drupal\Tests\user_event_dispatcher\Unit\User\UserEventTest::testUserCancelEvent()
User cancel event test.
File
- modules/
user_event_dispatcher/ tests/ src/ Unit/ User/ UserEventTest.php, line 47
Class
- UserEventTest
- Class UserEventTest.
Namespace
Drupal\Tests\user_event_dispatcher\Unit\UserCode
public function testUserCancelEvent() : void {
$edit = [
'Test',
'array',
];
/** @var \Drupal\Core\Session\AccountInterface $account */
$account = $this
->createMock(AccountInterface::class);
$method = 'Test method';
user_event_dispatcher_user_cancel($edit, $account, $method);
/** @var \Drupal\user_event_dispatcher\Event\User\UserCancelEvent $event */
$event = $this->manager
->getRegisteredEvent(HookEventDispatcherInterface::USER_CANCEL);
self::assertSame($edit, $event
->getEdit());
self::assertSame($account, $event
->getAccount());
self::assertSame($method, $event
->getMethod());
}