death-notifier/src/test/php/com/fwdekker/deathnotifier/validation/EqualsRuleTest.php

26 lines
905 B
PHP

<?php
namespace com\fwdekker\deathnotifier\validation;
use InvalidArgumentException;
/**
* Unit tests for {@see EqualsRule}.
*/
class EqualsRuleTest extends RuleTestTemplate
{
public static function check_provider(): array
{
$type = InvalidTypeException::class;
$value = InvalidValueException::class;
return [
"exception if input is not set" => [new EqualsRule("word", "message"), null, $type, "Required input 'key' not set."],
"exception if input is not a string" => [new EqualsRule("word", "message"), 738, $type, "Input 'key' should be string, but is integer."],
"exception with custom message if input is incorrect" => [new EqualsRule("word", "message"), "incorrect", $value, "message"],
"no exception if input equals expected phrase" => [new EqualsRule("word", "message"), "word", null, null],
];
}
}