2019-12-24 01:52:07 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Psl\Tests\Str;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2019-12-26 23:10:57 +01:00
|
|
|
use Psl\Str;
|
2019-12-24 01:52:07 +01:00
|
|
|
|
|
|
|
class LengthTest extends TestCase
|
|
|
|
{
|
2019-12-26 23:10:57 +01:00
|
|
|
/**
|
|
|
|
* @dataProvider provideData
|
|
|
|
*/
|
|
|
|
public function testLength(int $expected, string $str): void
|
2019-12-26 23:10:57 +01:00
|
|
|
{
|
2019-12-26 23:10:57 +01:00
|
|
|
self::assertSame($expected, Str\length($str));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function provideData(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
[6, 'azjezz'],
|
|
|
|
[4, 'تونس'],
|
|
|
|
[3, 'سيف'],
|
|
|
|
[7, 'こんにちは世界'],
|
|
|
|
[3, '🥇🥈🥉'],
|
|
|
|
[2, '你好'],
|
|
|
|
[6, 'สวัสดี'],
|
|
|
|
[3, 'ؤخى']
|
|
|
|
];
|
2019-12-26 23:10:57 +01:00
|
|
|
}
|
2019-12-24 01:52:07 +01:00
|
|
|
}
|