You are here

public function UserEventTest::testUserLogoutEvent in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 modules/user_event_dispatcher/tests/src/Unit/User/UserEventTest.php \Drupal\Tests\user_event_dispatcher\Unit\User\UserEventTest::testUserLogoutEvent()

User logout event test.

File

modules/user_event_dispatcher/tests/src/Unit/User/UserEventTest.php, line 103

Class

UserEventTest
Class UserEventTest.

Namespace

Drupal\Tests\user_event_dispatcher\Unit\User

Code

public function testUserLogoutEvent() : void {

  /** @var \Drupal\Core\Session\AccountInterface $account */
  $account = $this
    ->createMock(AccountInterface::class);
  user_event_dispatcher_user_logout($account);

  /** @var \Drupal\user_event_dispatcher\Event\User\UserLogoutEvent $event */
  $event = $this->manager
    ->getRegisteredEvent(HookEventDispatcherInterface::USER_LOGOUT);
  self::assertEquals($account, $event
    ->getAccount());
}