tui/tests/Unit/MatcherTest.php

28 lines
818 B
PHP
Raw Normal View History

2026-08-21 21:34:02 +02:00
<?php
namespace Myrmidex\AnagramFinder\Tests\Unit;
2026-08-22 17:52:17 +02:00
use Myrmidex\AnagramFinder\Matcher;
use PHPUnit\Framework\Attributes\DataProvider;
2026-08-21 21:34:02 +02:00
use PHPUnit\Framework\TestCase;
final class MatcherTest extends TestCase
{
2026-08-22 17:52:17 +02:00
#[DataProvider('checkProvider')]
public function testCheck(string $anagram, string $word, bool $isExpectedMatch)
2026-08-21 21:34:02 +02:00
{
2026-08-22 17:52:17 +02:00
$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],
];
2026-08-21 21:34:02 +02:00
}
}