If you alter the path for user.login or user.logout, the helpers for logging in and logging out in a test are broken.

Example code

      if ($id === 'user.login') {
        $route->setPath('/login');
      }
      elseif ($id === 'user.logout') {
        $route->setPath('/logout');
      }
      elseif ($id === 'user.reset.login') {
        $route->setPath('/id/reset/{uid}/{timestamp}/{hash}/login');
      }
      elseif ($id === 'user.reset') {
        $route->setPath('/id/reset/{uid}/{timestamp}/{hash}');
      }
      elseif ($id === 'user.reset.form') {
        $route->setPath('/id/reset/{uid}');
      }

You get a HTTP 400 error because the only route at /user/login is the HTTP POST method version.

CommentFileSizeAuthor
#2 3094525-2.patch1009 bytesmglaman
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mglaman created an issue. See original summary.

mglaman’s picture

Status: Active » Needs review
FileSize
1009 bytes

This should allow using altered /user/login and /user/logout paths.

Dinesh18’s picture

Status: Needs review » Reviewed & tested by the community

Manually. reviewed the patch. Looks good to me. +1 to RTBC

alexpott’s picture

Version: 8.9.x-dev » 8.8.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

As a test-only fix will backport to 8.8.x when the branch is unfrozen.

Committed and pushed d510989b8c to 9.0.x and 818a083616 to 8.9.x. Thanks!

  • alexpott committed d510989 on 9.0.x
    Issue #3094525 by mglaman: UiHelperTrait::drupalLogin breaks when user....

  • alexpott committed 818a083 on 8.9.x
    Issue #3094525 by mglaman: UiHelperTrait::drupalLogin breaks when user....
alexpott’s picture

Status: Patch (to be ported) » Fixed

Backported to 8.8.x as a test only fix.

  • alexpott committed 8317df1 on 8.8.x
    Issue #3094525 by mglaman: UiHelperTrait::drupalLogin breaks when user....

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.