mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-11 16:49:40 +01:00
35 lines
859 B
PHP
35 lines
859 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Str;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Str;
|
|
|
|
class EndsWithTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider provideData
|
|
*/
|
|
public function testEndsWith(bool $expected, string $haystack, string $suffix): void
|
|
{
|
|
self::assertSame($expected, Str\ends_with($haystack, $suffix));
|
|
}
|
|
|
|
public function provideData(): array
|
|
{
|
|
return [
|
|
[true, 'Hello', 'Hello'],
|
|
[false, 'Hello, World', 'world', ],
|
|
[false, 'T U N I S I A', 'e', ],
|
|
[true, 'تونس', 'س'],
|
|
[false, 'Hello, World', '', ],
|
|
[false, 'Hello, World', 'Hello, cruel world!', ],
|
|
[false, 'hello, world', 'hey', ],
|
|
[true, 'azjezz', 'z', ],
|
|
[true, 'مرحبا بكم', 'بكم', ],
|
|
];
|
|
}
|
|
}
|