27 lines
818 B
PHP
27 lines
818 B
PHP
<?php
|
|
|
|
namespace Myrmidex\AnagramFinder\Tests\Unit;
|
|
|
|
use Myrmidex\AnagramFinder\Matcher;
|
|
use PHPUnit\Framework\Attributes\DataProvider;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class MatcherTest extends TestCase
|
|
{
|
|
#[DataProvider('checkProvider')]
|
|
public function testCheck(string $anagram, string $word, bool $isExpectedMatch)
|
|
{
|
|
$this->assertEquals($isExpectedMatch, Matcher::check($anagram, $word));
|
|
}
|
|
|
|
public static function checkProvider(): array
|
|
{
|
|
return [
|
|
'valid1' => [ "eamstoxil", "steam", true ],
|
|
'valid2' => [ "wordneoxs", "downers", true ],
|
|
'valid3' => [ "ioevpmoef", "movie", true ],
|
|
'invalid_basic' => [ "eamstoxil", "smear", false],
|
|
'invalid_double_e' => [ "eamstexil", "smear", false],
|
|
];
|
|
}
|
|
}
|