diff --git a/app/Console/Commands/User/Disable.php b/app/Console/Commands/User/Disable.php index d82237fa8..d35633c32 100644 --- a/app/Console/Commands/User/Disable.php +++ b/app/Console/Commands/User/Disable.php @@ -51,7 +51,7 @@ public function handle(): int { } $userId = $user->id; - $user->email = ''; + $user->email = uniqid() . '@disabled-user.wikibase.cloud'; $user->password = random_bytes(10); $user->verified = false; diff --git a/tests/Commands/User/DisableTest.php b/tests/Commands/User/DisableTest.php index 1599a0e39..fff1064ce 100644 --- a/tests/Commands/User/DisableTest.php +++ b/tests/Commands/User/DisableTest.php @@ -23,7 +23,6 @@ private function createUser($email) { public function testSuccess() { $oldUser = $this->createUser(self::EMAIL); - $oldUserId = $oldUser->id; $this->artisan('wbs-user:disable', [ @@ -31,11 +30,15 @@ public function testSuccess() { ] )->assertExitCode(0); - $newUser = User::firstWhere('id', $oldUserId); + $newUser = User::firstWhere('id', $oldUser->id); $this->assertSame($oldUser->id, $newUser->id); - $this->assertSame($newUser->email, ''); + $this->assertMatchesRegularExpression( + '/^[0-9A-Za-z]+@disabled-user.wikibase.cloud$/', + $newUser->email + ); $this->assertFalse($newUser->hasVerifiedEmail()); + $this->assertNotSame($oldUser->password, $newUser->password); } public function testUserNotFound() {