Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Follow-up to #2870465-33: Convert web tests to browser tests for user module.
When converting tests, we accidentally detected code, which may no longer be relevant and may be removed.
+++ b/core/modules/user/tests/src/Functional/UserCancelTest.php
@@ -99,23 +99,6 @@ public function testUserCancelUid1() {
- // Update uid 1's name and password to we know it.
- $password = user_password();
- $account = [
- 'name' => 'user1',
- 'pass' => $this->container->get('password')->hash(trim($password)),
- ];
- // We cannot use $account->save() here, because this would result in the
- // password being hashed again.
- db_update('users_field_data')
- ->fields($account)
- ->condition('uid', 1)
- ->execute();
-
- // Reload and log in uid 1.
- $user_storage->resetCache([1]);
- $user1 = $user_storage->load(1);
- $user1->pass_raw = $password;
@@ -127,7 +110,6 @@ public function testUserCancelUid1() {
- $user_storage->resetCache([1]);
Proposed resolution
- Make sure that it really is not needed
- Remove it.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#6 | interdiff-2-6.txt | 660 bytes | Anonymous (not verified) |
#6 | 2926090-6.patch | 1.16 KB | Anonymous (not verified) |
#2 | 2926090-2.patch | 1.51 KB | Anonymous (not verified) |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedvaplas created an issue. See original summary.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #4
borisson_I tested this, and it still applies.
I ran
./vendor/bin/phpunit -c core/ core/modules/user/ --filter "testUserCancelUid1"
before applying the patch and got this:OK (1 test, 10 assertions)
. After applying the patch, there are still 10 assertions and the test is still green.Comment #5
alexpottThis feels like a bad idea since we're testing something that has not happened on the child site.
The rest of the patch looks fine.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedFair point! Done.
Comment #7
borisson_#6 fixes #5. Great work @vaplas!
Comment #8
alexpottCommitted and pushed 07df228247 to 8.6.x and a96f30b9d0 to 8.5.x. Thanks!
Backported to 8.5.x since this is test only code. Credited myself because #5 influenced the patch.