assertEqualsCanonicalizing([ 'id', 'user_id', 'codigo', 'status', ], Schema::getColumnListing('reset_password_attempts')); } public function test_attempt_belongs_to_a_user_and_defaults_to_pending(): void { $user = User::factory()->create(); $attempt = $user->resetPasswordAttempts()->create([ 'codigo' => '123456', ]); $this->assertSame(ResetPasswordAttempt::STATUS_PENDING, $attempt->status); $this->assertTrue($attempt->user->is($user)); $this->assertTrue($user->resetPasswordAttempts->contains($attempt)); $this->assertFalse($attempt->usesTimestamps()); $this->assertArrayNotHasKey('codigo', $attempt->toArray()); } public function test_attempts_are_deleted_with_their_user(): void { $user = User::factory()->create(); $attempt = ResetPasswordAttempt::query()->create([ 'user_id' => $user->id, 'codigo' => '123456', ]); $user->delete(); $this->assertDatabaseMissing('reset_password_attempts', [ 'id' => $attempt->id, ]); } }