From 4f386894bda633bb5e297f6db46ae8f4950fb18b Mon Sep 17 00:00:00 2001 From: Daniel Ang Date: Sat, 28 Aug 2021 18:14:55 +0200 Subject: [PATCH] Revert "Use toHaveCount" This reverts commit 2289adade227bba65934d9830e4be515b3917ac5. --- src/Expectation.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Expectation.php b/src/Expectation.php index 8f072d57..5741823f 100644 --- a/src/Expectation.php +++ b/src/Expectation.php @@ -344,12 +344,14 @@ final class Expectation if (is_object($this->value)) { if (method_exists($this->value, 'toArray')) { - $this->value = $this->value->toArray(); + $array = $this->value->toArray(); } else { - $this->value = (array) $this->value; + $array = (array) $this->value; } - return $this->toHaveCount($number); + Assert::assertCount($number, $array); + + return $this; } throw new BadMethodCallException('Expectation value length is not countable.');