You are here

public function RedirectTest::testUserLoginAndUserLogoutHookExecution in Login And Logout Redirect Per Role 8

Test that user_login and logout hook still works with a high weight.

This test case checks that hook_user_login and hook_user_logout that are executed after hook_user_login and hook_user_logout defined in login_redirect_per_role still work.

File

tests/src/Functional/RedirectTest.php, line 188

Class

RedirectTest
Tests redirects after login and logout.

Namespace

Drupal\Tests\login_redirect_per_role\Functional

Code

public function testUserLoginAndUserLogoutHookExecution() {
  $this->state
    ->set('login_redirect_per_role_test.user_login_called', FALSE);
  $this->state
    ->set('login_redirect_per_role_test.user_logout_called', FALSE);
  $this
    ->drupalLogin($this->user1);
  $this
    ->assertEquals(TRUE, $this->state
    ->get('login_redirect_per_role_test.user_login_called'));
  $this
    ->drupalGet(Url::fromRoute('user.logout'));
  $this
    ->assertEquals(TRUE, $this->state
    ->get('login_redirect_per_role_test.user_logout_called'));
}