Skip to content

Commit d7293d3

Browse files
committed
use Json\decode function
Signed-off-by: Tonko Mulder <[email protected]>
1 parent ddb903e commit d7293d3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Tempest/Framework/Testing/Http/TestResponseHelper.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66

77
use Closure;
88
use Generator;
9-
use JsonException;
109
use PHPUnit\Framework\Assert;
1110
use Tempest\Http\Cookie\CookieManager;
1211
use Tempest\Http\Response;
1312
use Tempest\Http\Responses\Invalid;
1413
use Tempest\Http\Session\Session;
1514
use Tempest\Http\Status;
15+
use Tempest\Support\Json;
16+
use Tempest\Support\Json\Exception\JsonCouldNotBeDecoded;
1617
use Tempest\Validation\Rule;
1718
use Tempest\View\View;
1819
use Tempest\View\ViewRenderer;
@@ -262,8 +263,8 @@ public function assertHasJsonValidationError(string $key, ?Closure $test = null)
262263

263264
$validationErrors = array_map(function ($failingRules) use ($key) {
264265
try {
265-
$errors = json_decode($failingRules, true, 512, JSON_THROW_ON_ERROR);
266-
} catch (JsonException) {
266+
$errors = Json\decode($failingRules);
267+
} catch (JsonCouldNotBeDecoded) {
267268
$errors = [];
268269
}
269270

0 commit comments

Comments
 (0)