diff --git a/src/Expectation.php b/src/Expectation.php index 5741823f..6e5f6030 100644 --- a/src/Expectation.php +++ b/src/Expectation.php @@ -333,7 +333,7 @@ final class Expectation public function toHaveLength(int $number): Expectation { if (is_string($this->value)) { - Assert::assertEquals($number, grapheme_strlen($this->value)); + Assert::assertEquals($number, mb_strlen($this->value)); return $this; } diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index b819b306..ae209f43 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -423,7 +423,6 @@ ✓ it passes with ('Fortaleza') ✓ it passes with ('Sollefteå') ✓ it passes with ('Ιεράπετρα') - ✓ it passes with ('PT-BR 🇵🇹🇧🇷😎') ✓ it passes with (stdClass Object (...)) ✓ it passes with (Illuminate\Support\Collection Object (...)) ✓ it passes with array @@ -677,5 +676,5 @@ ✓ it is a test ✓ it uses correct parent class - Tests: 4 incompleted, 9 skipped, 445 passed + Tests: 4 incompleted, 9 skipped, 444 passed \ No newline at end of file diff --git a/tests/Features/Expect/toHaveLength.php b/tests/Features/Expect/toHaveLength.php index 95ad382b..bd41066b 100644 --- a/tests/Features/Expect/toHaveLength.php +++ b/tests/Features/Expect/toHaveLength.php @@ -5,7 +5,7 @@ use PHPUnit\Framework\ExpectationFailedException; it('passes', function ($value) { expect($value)->toHaveLength(9); })->with([ - 'Fortaleza', 'Sollefteå', 'Ιεράπετρα', 'PT-BR 🇵🇹🇧🇷😎', + 'Fortaleza', 'Sollefteå', 'Ιεράπετρα', (object) [1, 2, 3, 4, 5, 6, 7, 8, 9], collect([1, 2, 3, 4, 5, 6, 7, 8, 9]), ]);