mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-02 17:56:09 +01:00
35 lines
887 B
PHP
35 lines
887 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psl\Tests\Str\Byte;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psl\Str\Byte;
|
|
|
|
class WordsTest extends TestCase
|
|
{
|
|
|
|
/**
|
|
* @dataProvider provideData
|
|
*/
|
|
public function testWords(array $expected, string $string, ?string $extra_chars = null): void
|
|
{
|
|
self::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!', '!, '],
|
|
];
|
|
}
|
|
}
|