diff --git a/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php b/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php index 0cb1ccd..2e0965d 100644 --- a/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php +++ b/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php @@ -88,8 +88,20 @@ protected function assertEntity($id, $label, $mail, $password, $access, $login, public function testUser() { $password = '$S$DGFZUE.FhrXbe4y52eC7p0ZVRGD/gOPtVctDlmC89qkujnBokAlJ'; $this->assertEntity(2, 'Odo', 'odo@local.host', $password, '0', '0', FALSE, '', 'odo@local.host'); + // Ensure that the user can authenticate. $this->assertEquals(2, \Drupal::service('user.auth')->authenticate('Odo', 'a password')); + // After authenticating the password will be rehashed because the password + // stretching iteration count has changed from 15 in Drupal 7 to 16 in + // Drupal 8. + $user = User::load(2); + $rehash = $user->getPassword(); + $this->assertNotEquals($password, $rehash); + + // Authenticate again and there should be no re-hash. + $this->assertEquals(2, \Drupal::service('user.auth')->authenticate('Odo', 'a password')); + $user = User::load(2); + $this->assertEquals($rehash, $user->getPassword()); } }