endtoend-test-psl/tests/Psl/Str/ContainsCiTest.php

33 lines
800 B
PHP
Raw Normal View History

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 ContainsCiTest extends TestCase
{
2019-12-26 23:10:57 +01:00
/**
* @dataProvider provideData
*/
public function testContainsCi(bool $expected, string $haystack, string $needle, int $offset = 0): void
{
self::assertSame($expected, Str\contains_ci($haystack, $needle, $offset));
}
public function provideData(): array
{
return [
[true, 'Hello, World', 'Hello', 0],
[true, 'Hello, World', 'world', 0],
[true, 'Hello, World', '', 8],
[false, 'hello, world', 'hey', 5],
[true, 'Azjezz', 'az', 0],
[false, 'azjezz', 'Az', 2],
[true, 'مرحبا بكم', 'بكم', 5],
];
}
2019-12-24 01:52:07 +01:00
}