endtoend-test-psl/tests/Psl/Str/Grapheme/EndsWithTest.php

35 lines
890 B
PHP
Raw Normal View History

2020-10-03 19:56:55 +02:00
<?php
declare(strict_types=1);
namespace Psl\Tests\Str\Grapheme;
use PHPUnit\Framework\TestCase;
use Psl\Str\Grapheme;
final class EndsWithTest extends TestCase
{
/**
* @dataProvider provideData
*/
public function testEndsWith(bool $expected, string $haystack, string $suffix): void
{
static::assertSame($expected, Grapheme\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, 'مرحبا بكم', 'بكم', ],
];
}
}