Use toHaveCount

changes to toHaveCount
This commit is contained in:
Daniel Ang
2021-08-28 17:54:29 +02:00
parent 8367af22e7
commit 2289adade2

View File

@ -344,14 +344,12 @@ final class Expectation
if (is_object($this->value)) {
if (method_exists($this->value, 'toArray')) {
$array = $this->value->toArray();
$this->value = $this->value->toArray();
} else {
$array = (array) $this->value;
$this->value = (array) $this->value;
}
Assert::assertCount($number, $array);
return $this;
return $this->toHaveCount($number);
}
throw new BadMethodCallException('Expectation value length is not countable.');