diff --git a/src/Illuminate/Testing/AssertableJsonString.php b/src/Illuminate/Testing/AssertableJsonString.php index 5040be137cb4..0c14d116832e 100644 --- a/src/Illuminate/Testing/AssertableJsonString.php +++ b/src/Illuminate/Testing/AssertableJsonString.php @@ -3,13 +3,14 @@ namespace Illuminate\Testing; use ArrayAccess; +use Countable; use Illuminate\Contracts\Support\Jsonable; use Illuminate\Support\Arr; use Illuminate\Support\Str; use Illuminate\Testing\Assert as PHPUnit; use JsonSerializable; -class AssertableJsonString implements ArrayAccess +class AssertableJsonString implements ArrayAccess, Countable { /** * The original encoded json. @@ -329,6 +330,16 @@ protected function jsonSearchStrings($key, $value) ]; } + /** + * Get the total number of items. + * + * @return int + */ + public function count() + { + return count($this->decoded); + } + /** * Determine whether an offset exists. *