Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Add the Countable interface to AssertableJsonString #34284

Merged
merged 2 commits into from Sep 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Illuminate/Testing/AssertableJsonString.php
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
*
Expand Down