endtoend-test-psl/tests/Psl/Str/Byte/PadLeftTest.php
2020-01-02 00:00:08 +01:00

30 lines
663 B
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Str\Byte;
use PHPUnit\Framework\TestCase;
use Psl\Str\Byte;
class PadLeftTest extends TestCase
{
/**
* @dataProvider provideData
*/
public function testPadLeft(string $expected, string $str, int $total_length, string $pad_string = ' '): void
{
self::assertSame($expected, Byte\pad_left($str, $total_length, $pad_string));
}
public function provideData(): array
{
return [
[' aaay', 'aaay', 5],
['Aaaay', 'aaay', 5, 'A'],
['Yeet', 'eet', 4, 'Yeeeee'],
['مرحبا', 'مرحبا', 8, 'م'],
];
}
}