core/tests/Unit/MatcherTest.php

27 lines
820 B
PHP

<?php
namespace Lvl0\AnagramFinder\Core\Tests\Unit;
use Lvl0\AnagramFinder\Core\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],
];
}
}