mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-11 16:49:40 +01:00
35 lines
895 B
PHP
35 lines
895 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Str\Byte;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Str\Byte;
|
|
|
|
final class WordsTest extends TestCase
|
|
{
|
|
|
|
/**
|
|
* @dataProvider provideData
|
|
*/
|
|
public function testWords(array $expected, string $string, ?string $extra_chars = null): void
|
|
{
|
|
static::assertSame($expected, Byte\words($string, $extra_chars));
|
|
}
|
|
|
|
public function provideData(): array
|
|
{
|
|
return [
|
|
[[], ''],
|
|
[['Hello'], 'Hello'],
|
|
[['Hello'], 'Hello', ' '],
|
|
[[0 => 'Hello', 7 => 'World'], 'Hello, World!'],
|
|
[[0 => 'Hello', 6 => ' World'], 'Hello, World!', ' '],
|
|
[[0 => 'Hello', 7 => 'World!'], 'Hello, World!', '!'],
|
|
[[0 => 'Hello,', 7 => 'World!'], 'Hello, World!', '!,'],
|
|
[[0 => 'Hello, World!'], 'Hello, World!', '!, '],
|
|
];
|
|
}
|
|
}
|