mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-12 00:59:42 +01:00
32 lines
770 B
PHP
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],
|
|
];
|
|
}
|
|
}
|