From f795b38db56983283a3cef3f54da0981948a6abf Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Sat, 23 Mar 2024 11:27:26 -0400 Subject: [PATCH] Better way --- tests/Integration/Api/Client/TwoFactorControllerTest.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/Integration/Api/Client/TwoFactorControllerTest.php b/tests/Integration/Api/Client/TwoFactorControllerTest.php index 03cc5f295..39bd3ddc3 100644 --- a/tests/Integration/Api/Client/TwoFactorControllerTest.php +++ b/tests/Integration/Api/Client/TwoFactorControllerTest.php @@ -110,13 +110,9 @@ class TwoFactorControllerTest extends ClientApiIntegrationTestCase $rawTokens = $response->json('attributes.tokens'); $rawToken = reset($rawTokens); + $hashed = reset($tokens); - $working = false; - foreach ($tokens as $hashed) { - $working = $working || password_verify($rawToken, $hashed); - } - - throw_unless($working, new ExpectationFailedException(sprintf('Failed asserting that token [%s] exists as a hashed value in recovery_tokens table.', $rawToken))); + throw_unless(password_verify($rawToken, $hashed), new ExpectationFailedException(sprintf('Failed asserting that token [%s] exists as a hashed value in recovery_tokens table.', $rawToken))); } /**