endtoend-test-psl/tests/Psl/Str/Byte/StartsWithCiTest.php

42 lines
1.2 KiB
PHP
Raw Normal View History

2019-12-24 01:52:07 +01:00
<?php
declare(strict_types=1);
namespace Psl\Tests\Str\Byte;
use PHPUnit\Framework\TestCase;
2019-12-26 23:10:57 +01:00
use Psl\Str\Byte;
2019-12-24 01:52:07 +01:00
final class StartsWithCiTest extends TestCase
2019-12-24 01:52:07 +01:00
{
2019-12-26 23:10:57 +01:00
/**
* @dataProvider provideData
*/
public function testStartsWithCi(bool $expected, string $haystack, string $prefix): void
{
static::assertSame($expected, Byte\starts_with_ci($haystack, $prefix));
2019-12-26 23:10:57 +01:00
}
public function provideData(): array
{
return [
[true, 'Hello, World', 'Hello', ],
[false, 'Hello, World', 'world', ],
[false, 'Hello, World', '', ],
[false, 'hello, world', 'hey', ],
[true, 'azjezz', 'az', ],
[true, 'azjezz', 'Az', ],
[false, 'مرحبا بكم', 'بكم', ],
[true, 'مرحبا بكم', 'مرحبا', ],
[true, 'مرحبا سيف', 'مرحبا', 3],
[false, 'مرحبا سيف', 'سيف', 3],
[true, 'اهلا بكم', 'اهلا', 2],
[true, 'héllö wôrld', 'héllö', ],
[false, 'héllö wôrld', 'hello', ],
[true, 'fôo', 'fôo', ],
[true, 'fôo', 'f', ],
[true, 'fôo', 'fô', ],
];
}
2019-12-24 01:52:07 +01:00
}