respect-validation/tests/integration/rules/beetwen.phpt
Henrique Moody 3145426472
Update version of "respect/coding-standard"
With that update, we will be fully following PSR-12.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-07-21 22:54:41 +02:00

44 lines
970 B
PHP

--CREDITS--
Henrique Moody <henriquemoody@gmail.com>
--FILE--
<?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Respect\Validation\Exceptions\BetweenException;
use Respect\Validation\Exceptions\NestedValidationException;
use Respect\Validation\Validator as v;
try {
v::between(1, 2)->check(0);
} catch (BetweenException $e) {
echo $e->getMessage() . PHP_EOL;
}
try {
v::not(v::between('yesterday', 'tomorrow'))->check('today');
} catch (BetweenException $e) {
echo $e->getMessage() . PHP_EOL;
}
try {
v::between('a', 'c')->assert('d');
} catch (NestedValidationException $e) {
echo $e->getFullMessage() . PHP_EOL;
}
try {
v::not(v::between(-INF, INF))->assert(0);
} catch (NestedValidationException $e) {
echo $e->getFullMessage() . PHP_EOL;
}
?>
--EXPECT--
0 must be between 1 and 2
"today" must not be between "yesterday" and "tomorrow"
- "d" must be between "a" and "c"
- 0 must not be between `-INF` and `INF`