mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Use mb_strlen instead of grapheme_strlen
Due to inconsistent behave, mb_strlen will be used.
This commit is contained in:
@ -333,7 +333,7 @@ final class Expectation
|
|||||||
public function toHaveLength(int $number): Expectation
|
public function toHaveLength(int $number): Expectation
|
||||||
{
|
{
|
||||||
if (is_string($this->value)) {
|
if (is_string($this->value)) {
|
||||||
Assert::assertEquals($number, grapheme_strlen($this->value));
|
Assert::assertEquals($number, mb_strlen($this->value));
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -423,7 +423,6 @@
|
|||||||
✓ it passes with ('Fortaleza')
|
✓ it passes with ('Fortaleza')
|
||||||
✓ it passes with ('Sollefteå')
|
✓ it passes with ('Sollefteå')
|
||||||
✓ it passes with ('Ιεράπετρα')
|
✓ it passes with ('Ιεράπετρα')
|
||||||
✓ it passes with ('PT-BR 🇵🇹🇧🇷😎')
|
|
||||||
✓ it passes with (stdClass Object (...))
|
✓ it passes with (stdClass Object (...))
|
||||||
✓ it passes with (Illuminate\Support\Collection Object (...))
|
✓ it passes with (Illuminate\Support\Collection Object (...))
|
||||||
✓ it passes with array
|
✓ it passes with array
|
||||||
@ -677,5 +676,5 @@
|
|||||||
✓ it is a test
|
✓ it is a test
|
||||||
✓ it uses correct parent class
|
✓ it uses correct parent class
|
||||||
|
|
||||||
Tests: 4 incompleted, 9 skipped, 445 passed
|
Tests: 4 incompleted, 9 skipped, 444 passed
|
||||||
|
|
||||||
@ -5,7 +5,7 @@ use PHPUnit\Framework\ExpectationFailedException;
|
|||||||
it('passes', function ($value) {
|
it('passes', function ($value) {
|
||||||
expect($value)->toHaveLength(9);
|
expect($value)->toHaveLength(9);
|
||||||
})->with([
|
})->with([
|
||||||
'Fortaleza', 'Sollefteå', 'Ιεράπετρα', 'PT-BR 🇵🇹🇧🇷😎',
|
'Fortaleza', 'Sollefteå', 'Ιεράπετρα',
|
||||||
(object) [1, 2, 3, 4, 5, 6, 7, 8, 9],
|
(object) [1, 2, 3, 4, 5, 6, 7, 8, 9],
|
||||||
collect([1, 2, 3, 4, 5, 6, 7, 8, 9]),
|
collect([1, 2, 3, 4, 5, 6, 7, 8, 9]),
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user