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

32 lines
770 B
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Str\Byte;
use PHPUnit\Framework\TestCase;
use Psl\Str;
use Psl\Str\Byte;
class WrapTest extends TestCase
{
/**
* @dataProvider provideData
*/
public function testWrap(string $expected, string $str, int $width = 75, string $break = "\n", bool $cut = false): void
{
self::assertSame($expected, Byte\wrap($str, $width, $break, $cut));
}
public function provideData(): array
{
return [
['Hello', 'Hello'],
['', ''],
['☕ ~ ☕ ~ ☕', '☕ ☕ ☕', 1, ' ~ '],
["héllö,-\nwôrld", 'héllö, wôrld', 8, "-\n", true],
['مرحبا<br />بكم', 'مرحبا بكم', 3, '<br />', false],
];
}
}