mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-11 16:49:40 +01:00
49 lines
1.5 KiB
PHP
49 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Str;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Str;
|
|
|
|
class StripSuffixTest extends TestCase
|
|
{
|
|
|
|
/**
|
|
* @dataProvider provideData
|
|
*/
|
|
public function testStripSuffix(string $expected, string $haystack, string $suffix): void
|
|
{
|
|
self::assertSame($expected, Str\strip_suffix($haystack, $suffix));
|
|
}
|
|
|
|
public function provideData(): array
|
|
{
|
|
return [
|
|
['', 'Hello', 'Hello'],
|
|
['Hello, World', 'Hello, World', 'world', ],
|
|
['T U N I S I A', 'T U N I S I A', 'e', ],
|
|
['تون', 'تونس', 'س'],
|
|
['Hello, World', 'Hello, World', '', ],
|
|
['Hello, World', 'Hello, World', 'Hello, cruel world!', ],
|
|
['hello, world', 'hello, world', 'hey', ],
|
|
['azjez', 'azjezz', 'z', ],
|
|
['مرحبا ', 'مرحبا بكم', 'بكم', ],
|
|
['Hello', 'Hello, World', ', World', ],
|
|
['Hello, World', 'Hello, World', 'world', ],
|
|
['Hello, World', 'Hello, World', '', ],
|
|
['hello, world', 'hello, world', 'universe', ],
|
|
['azje', 'azjezz', 'zz', ],
|
|
['azjezz', 'azjezz', 'ZZ', ],
|
|
['مرحبا', 'مرحبا سيف', ' سيف', 3],
|
|
['اهلا', 'اهلا بكم', ' بكم', 3],
|
|
['héllö', 'héllö wôrld', ' wôrld', ],
|
|
['héllö wôrld', 'héllö wôrld', ' world', ],
|
|
['fô', 'fôo', 'o', ],
|
|
['fôo', 'fôo', 'ô', ],
|
|
['f', 'fôo', 'ôo', ],
|
|
];
|
|
}
|
|
}
|