mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-12 09:09:45 +01:00
62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Str\Byte;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Str\Byte;
|
|
|
|
class TrimRightTest extends TestCase
|
|
{
|
|
|
|
/**
|
|
* @dataProvider provideData
|
|
*/
|
|
public function testTrimRight(string $expected, string $string, ?string $chars = null): void
|
|
{
|
|
self::assertSame($expected, Byte\trim_right($string, $chars));
|
|
}
|
|
|
|
public function provideData(): array
|
|
{
|
|
return [
|
|
[
|
|
" Hello World\t!!!",
|
|
" Hello World\t!!!\n",
|
|
null,
|
|
],
|
|
[
|
|
" Hello World\t!!!\n",
|
|
" Hello World\t!!!\n",
|
|
' ',
|
|
],
|
|
[
|
|
" Hello World\t!!!",
|
|
" Hello World\t!!!\n",
|
|
"\n",
|
|
],
|
|
[
|
|
" Hello World\t",
|
|
" Hello World\t!!!\n",
|
|
"\n!",
|
|
],
|
|
[
|
|
' Hello World',
|
|
" Hello World\t!!!\n",
|
|
"\n!\t",
|
|
],
|
|
[
|
|
" Hello World\t",
|
|
" Hello World\t!!!\n",
|
|
" \n!",
|
|
],
|
|
[
|
|
" Hello World\t!!! \n",
|
|
" Hello World\t!!! \n",
|
|
' ',
|
|
],
|
|
];
|
|
}
|
|
}
|