26 lines
1.1 KiB
PHP
26 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace com\fwdekker\deathnotifier\validation;
|
|
|
|
|
|
/**
|
|
* Unit tests for {@see IsNotBlankRule}.
|
|
*/
|
|
class IsNotBlankRuleTest extends RuleTestTemplate
|
|
{
|
|
public static function check_provider(): array
|
|
{
|
|
$type = InvalidTypeException::class;
|
|
$value = InvalidValueException::class;
|
|
|
|
return [
|
|
"exception if input is not set" => [new IsNotBlankRule(), null, $type, "Required input 'key' not set."],
|
|
"exception if input is not a string" => [new IsNotBlankRule(), 621, $type, "Input 'key' should be string, but is integer."],
|
|
"exception if input is empty" => [new IsNotBlankRule(), "", $value, "Use at least one character."],
|
|
"exception if input is whitespace only" => [new IsNotBlankRule(), " ", $value, "Use at least one character other than a space."],
|
|
"no exception if input is not blank" => [new IsNotBlankRule(), "not-blank", null, null],
|
|
"no exception if input is not blank but starts with whitespace" => [new IsNotBlankRule(), " not-blank ", null, null],
|
|
];
|
|
}
|
|
}
|