You are here

public function UserEventTest::testUserCancelEvent in Hook Event Dispatcher 8

User cancel event test.

File

tests/src/Unit/User/UserEventTest.php, line 43

Class

UserEventTest
Class UserEventTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\User

Code

public function testUserCancelEvent() {
  $edit = [
    'Test',
    'array',
  ];

  /** @var \Drupal\Core\Session\AccountInterface $account */
  $account = $this
    ->createMock(AccountInterface::class);
  $method = 'Test method';
  hook_event_dispatcher_user_cancel($edit, $account, $method);

  /** @var \Drupal\hook_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());
}