endtoend-test-psl/tests/Psl/Str/MetaphoneTest.php
2020-10-15 11:05:30 +02:00

31 lines
685 B
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Str;
use PHPUnit\Framework\TestCase;
use Psl\Str;
final class MetaphoneTest extends TestCase
{
/**
* @dataProvider provideData
*/
public function testMetaphone(?string $expected, string $str, int $phonemes = 0): void
{
static::assertSame($expected, Str\metaphone($str, $phonemes));
}
public function provideData(): array
{
return [
['HL', 'hello'],
['HLWRLT', 'Hello, World !!', 10],
['PPLLNKTBTSTNWLLWSFNTX0R', 'People linked by destiny will always find each other.'],
['', 'سيف'],
['', '1337'],
];
}
}