54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?PHP
|
|
/**
|
|
* Tests for MD_STD_IN.
|
|
*
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
*/
|
|
declare(strict_types = 1);
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use PHPUnit\Framework\Attributes\DataProvider;
|
|
use PHPUnit\Framework\Attributes\Small;
|
|
use PHPUnit\Framework\Attributes\CoversClass;
|
|
|
|
/**
|
|
* Tests for MD_STD_STRINGS.
|
|
*/
|
|
#[small]
|
|
#[CoversClass(\MD_STD_STRINGS::class)]
|
|
final class MD_STD_STRINGS_Test extends TestCase {
|
|
/**
|
|
* Data provider for strings to duplicate words with dots in.
|
|
*
|
|
* @return array<array{0: string, 1: string}>
|
|
*/
|
|
public static function duplicated_words_with_dots_provider():array {
|
|
|
|
$values = [
|
|
["hallo test. hallo", "hallo test. hallo test"],
|
|
];
|
|
|
|
$output = [];
|
|
foreach ($values as $value) {
|
|
$output[$value[0] . ' > ' . $value[1]] = $value;
|
|
}
|
|
return $output;
|
|
|
|
}
|
|
|
|
/**
|
|
* Function for testing duplicate_words_with_dots_for_indexing().
|
|
*
|
|
* @param string $input Input.
|
|
* @param string $expected Expected output.
|
|
*
|
|
* @return void
|
|
*/
|
|
#[DataProvider('duplicated_words_with_dots_provider')]
|
|
public function test_duplicate_words_with_dots_for_indexing(string $input, string $expected):void {
|
|
|
|
self::assertEquals($expected, MD_STD_STRINGS::duplicate_words_with_dots_for_indexing($input));
|
|
|
|
}
|
|
}
|