From f41fc41a0cb79dee4013b13b6b56e04c0c089b2d Mon Sep 17 00:00:00 2001 From: Candra Sudirman Date: Thu, 4 Sep 2025 03:54:11 +0700 Subject: [PATCH] fix: ensure `reloadOnly` and `reloadExcept` handle string and array inputs uniformly --- src/Testing/AssertableInertia.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Testing/AssertableInertia.php b/src/Testing/AssertableInertia.php index 87e05e2f..47e806e4 100644 --- a/src/Testing/AssertableInertia.php +++ b/src/Testing/AssertableInertia.php @@ -164,13 +164,13 @@ public function reload(?Closure $callback = null, array|string|null $only = null */ public function reloadOnly(array|string $only, ?Closure $callback = null): self { - return $this->reload(only: $only, callback: function (AssertableInertia $assertable) use ($only, $callback) { - $assertable->hasAll(explode(',', $only)); + return $this->reload(callback: function (AssertableInertia $assertable) use ($only, $callback) { + $assertable->hasAll(is_array($only) ? $only : explode(',', $only)); if ($callback) { $callback($assertable); } - }); + }, only: $only); } /** @@ -180,13 +180,13 @@ public function reloadOnly(array|string $only, ?Closure $callback = null): self */ public function reloadExcept(array|string $except, ?Closure $callback = null): self { - return $this->reload(except: $except, callback: function (AssertableInertia $assertable) use ($except, $callback) { - $assertable->missingAll(explode(',', $except)); + return $this->reload(callback: function (AssertableInertia $assertable) use ($except, $callback) { + $assertable->missingAll(is_array($except) ? $except : explode(',', $except)); if ($callback) { $callback($assertable); } - }); + }, except: $except); } /**