mirror of
https://github.com/Respect/Validation.git
synced 2024-06-08 16:52:16 +02:00
003830b8e9
Most exception messages in Validation use "must" and "must not" in their templates, but a few rules don't. I fixed most of them, but AlwaysValid and AlwaysInvalid remain because I wonder if they will be better if I update them. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
43 lines
934 B
PHP
43 lines
934 B
PHP
--CREDITS--
|
|
Cameron Hall <me@chall.id.au>
|
|
--FILE--
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require 'vendor/autoload.php';
|
|
|
|
use Respect\Validation\Exceptions\NestedValidationException;
|
|
use Respect\Validation\Exceptions\YesException;
|
|
use Respect\Validation\Validator as v;
|
|
|
|
try {
|
|
v::not(v::yes())->check('Yes');
|
|
} catch (YesException $exception) {
|
|
echo $exception->getMessage() . PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
v::yes()->check('si');
|
|
} catch (YesException $exception) {
|
|
echo $exception->getMessage() . PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
v::not(v::yes())->assert('Yes');
|
|
} catch (NestedValidationException $exception) {
|
|
echo $exception->getFullMessage() . PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
v::yes()->assert('si');
|
|
} catch (NestedValidationException $exception) {
|
|
echo $exception->getFullMessage() . PHP_EOL;
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
"Yes" must not be similar to "Yes"
|
|
"si" must be similar to "Yes"
|
|
- "Yes" must not be similar to "Yes"
|
|
- "si" must be similar to "Yes"
|