I spent hours of debugging why my tests for #8: Let users cancel their accounts are failing. I assumed my tests were just plain wrong, but the real cause is that

$this->drupalLogin($user);

does not update the passed in $user object, which means that none of the user account properties $user->login, $user->access, etc. is properly set after logging in.

As this patch prevents tests for #8 from passing, marking as critical.

Comments

dave reid’s picture

Comment #1

dave reid
he/him
Primary language English
Location Nebraska USA
commented

Do we have a need to re-use this feature? If so, then I'm for it, but this code is executed a lot so it needs to be considered. It seems like it would be easy to do this outside of drupalLogin() and in the test code and leave drupalLogin() simplified.

dries’s picture

Comment #2

dries commented
Status: Needs review » Needs work

Patch needs more code comments. Thanks!

damien tournoud’s picture

Comment #3

damien tournoud commented

I don't see the point of this neither. drupalLogin() is not supposed to update the passed $user. If you need the full-featured $user, why not calling user_load() yourself?

sun’s picture

Comment #4

sun
Primary language German
Location Karlsruhe
commented
Status: Needs work » Needs review
StatusFileSize
new drupal.drupalLogin.patch 1.4 KB

Meh. Then let's at least add this caveat to the PHPDoc, so others don't need to waste hours of debugging why their tests don't work as expected.

damien tournoud’s picture

Comment #5

damien tournoud commented
Status: Needs review » Reviewed & tested by the community

Great.

drewish’s picture

Comment #6

drewish commented

humm this issue kind of affects #287292: Add functionality to impersonate a user

drewish’s picture

Comment #7

drewish commented

humm this issue kind of affects #287292: Add functionality to impersonate a user

dries’s picture

Comment #8

dries commented

The example is a bit confusing. What exactly are we doing with raw_pass here and why? Could use better documentation, or a better example.

dries’s picture

Comment #9

dries commented
Status: Reviewed & tested by the community » Needs work
sun’s picture

Comment #10

sun
Primary language German
Location Karlsruhe
commented
Priority: Critical » Normal
Status: Needs work » Needs review
StatusFileSize
new drupal.drupalLogin.patch 1.7 KB

Added a use-case for re-assigning the raw user password.

dries’s picture

Comment #11

dries commented
Status: Needs review » Fixed

Committed to CVS HEAD. Thanks.

Comment #12

Status: Fixed » Closed (fixed)

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