24 lines
857 B
PHP
24 lines
857 B
PHP
<?php
|
|
|
|
namespace com\fwdekker\deathnotifier\validation;
|
|
|
|
|
|
/**
|
|
* Unit tests for {@see IsBooleanRule}.
|
|
*/
|
|
class IsBooleanRuleTest extends RuleTestTemplate
|
|
{
|
|
public static function check_provider(): array
|
|
{
|
|
$type = InvalidTypeException::class;
|
|
|
|
return [
|
|
"exception if input is not set" => [new IsBooleanRule(), null, $type, "Required input 'key' not set."],
|
|
"exception if input is integer" => [new IsBooleanRule(), 1, $type, "Input 'key' should be boolean, but is integer."],
|
|
"exception if input is string" => [new IsBooleanRule(), "true", $type, "Input 'key' should be boolean, but is string."],
|
|
"no exception if input is `true`" => [new IsBooleanRule(), true, null, null],
|
|
"no exception if input is `false`" => [new IsBooleanRule(), false, null, null],
|
|
];
|
|
}
|
|
}
|