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

35 lines
859 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 EndsWithTest extends TestCase
{
2019-12-26 23:10:57 +01:00
/**
* @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 [
2019-12-26 23:10:57 +01:00
[true, 'Hello', 'Hello'],
2019-12-26 23:10:57 +01:00
[false, 'Hello, World', 'world', ],
[false, 'T U N I S I A', 'e', ],
[true, 'تونس', 'س'],
2019-12-26 23:10:57 +01:00
[false, 'Hello, World', '', ],
[false, 'Hello, World', 'Hello, cruel world!', ],
2019-12-26 23:10:57 +01:00
[false, 'hello, world', 'hey', ],
[true, 'azjezz', 'z', ],
[true, 'مرحبا بكم', 'بكم', ],
];
}
2019-12-24 01:52:07 +01:00
}