From 6045f5c975673fbf6af09b64f6c1fa5daea5a091 Mon Sep 17 00:00:00 2001 From: Bubka <858858+Bubka@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:14:11 +0200 Subject: [PATCH] Complete exception handler tests --- tests/Unit/Exceptions/HandlerTest.php | 22 +++++++++++-------- tests/Unit/Listeners/CleanIconStorageTest.php | 2 -- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/Unit/Exceptions/HandlerTest.php b/tests/Unit/Exceptions/HandlerTest.php index e979149b..9d5b2818 100644 --- a/tests/Unit/Exceptions/HandlerTest.php +++ b/tests/Unit/Exceptions/HandlerTest.php @@ -4,6 +4,7 @@ use App\Exceptions\DbEncryptionException; use App\Exceptions\EncryptedMigrationException; +use App\Exceptions\FailedIconStoreDatabaseTogglingException; use App\Exceptions\Handler; use App\Exceptions\InvalidMigrationDataException; use App\Exceptions\InvalidOtpParameterException; @@ -53,6 +54,18 @@ public function test_exceptions_returns_badRequest_json_response($exception) public static function provideExceptionsforBadRequest() : array { return [ + [ + DbEncryptionException::class, + ], + [ + EncryptedMigrationException::class, + ], + [ + FailedIconStoreDatabaseTogglingException::class, + ], + [ + InvalidMigrationDataException::class, + ], [ InvalidOtpParameterException::class, ], @@ -62,12 +75,6 @@ public static function provideExceptionsforBadRequest() : array [ InvalidSecretException::class, ], - [ - DbEncryptionException::class, - ], - [ - InvalidMigrationDataException::class, - ], [ UndecipherableException::class, ], @@ -77,9 +84,6 @@ public static function provideExceptionsforBadRequest() : array [ UnsupportedOtpTypeException::class, ], - [ - EncryptedMigrationException::class, - ], ]; } diff --git a/tests/Unit/Listeners/CleanIconStorageTest.php b/tests/Unit/Listeners/CleanIconStorageTest.php index 39c428bc..36fb4508 100644 --- a/tests/Unit/Listeners/CleanIconStorageTest.php +++ b/tests/Unit/Listeners/CleanIconStorageTest.php @@ -24,8 +24,6 @@ class CleanIconStorageTest extends TestCase #[Test] public function test_it_deletes_icon_file_using_the_iconstore() { - // TODO : Reuse the following mock as a global read-only - // SettingService mock for all tests, or create a dedicated stub $this->mock(SettingService::class, function (MockInterface $iconStore) { foreach (config('2fauth.settings') as $setting => $value) { $iconStore->shouldReceive('get')