26 lines
890 B
PHP
26 lines
890 B
PHP
<?php
|
|
|
|
namespace com\fwdekker\deathnotifier\validation;
|
|
|
|
use InvalidArgumentException;
|
|
|
|
|
|
/**
|
|
* Unit tests for {@see EqualsRule}.
|
|
*/
|
|
class EqualsRuleTest extends RuleTest
|
|
{
|
|
public 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],
|
|
];
|
|
}
|
|
}
|