mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 15:25:45 +01:00
42 lines
1 KiB
PHP
42 lines
1 KiB
PHP
--CREDITS--
|
|
Henrique Moody <henriquemoody@gmail.com>
|
|
--FILE--
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require 'vendor/autoload.php';
|
|
|
|
use Respect\Validation\Exceptions\EquivalentException;
|
|
use Respect\Validation\Exceptions\NestedValidationException;
|
|
use Respect\Validation\Validator as v;
|
|
|
|
try {
|
|
v::equivalent(true)->check(false);
|
|
} catch (EquivalentException $exception) {
|
|
echo $exception->getMessage().PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
v::not(v::equivalent('Something'))->check('someThing');
|
|
} catch (EquivalentException $exception) {
|
|
echo $exception->getMessage().PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
v::equivalent(123)->assert('true');
|
|
} catch (NestedValidationException $exception) {
|
|
echo $exception->getFullMessage().PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
v::not(v::equivalent(true))->assert(1);
|
|
} catch (NestedValidationException $exception) {
|
|
echo $exception->getFullMessage().PHP_EOL;
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
`FALSE` must be equivalent to `TRUE`
|
|
"someThing" must not be equivalent to "Something"
|
|
- "true" must be equivalent to 123
|
|
- 1 must not be equivalent to `TRUE`
|