respect-validation/tests/integration/rules/equals.phpt
Henrique Moody cc20a442a1
Apply "SlevomatCodingStandard.TypeHints.DeclareStrictTypes"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-09 14:11:12 +01:00

42 lines
918 B
PHP

--CREDITS--
Henrique Moody <henriquemoody@gmail.com>
--FILE--
<?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Respect\Validation\Exceptions\EqualsException;
use Respect\Validation\Exceptions\NestedValidationException;
use Respect\Validation\Validator as v;
try {
v::equals(123)->check(321);
} catch (EqualsException $exception) {
echo $exception->getMessage().PHP_EOL;
}
try {
v::not(v::equals(321))->check(321);
} catch (EqualsException $exception) {
echo $exception->getMessage().PHP_EOL;
}
try {
v::equals(123)->assert(321);
} catch (NestedValidationException $exception) {
echo $exception->getFullMessage().PHP_EOL;
}
try {
v::not(v::equals(321))->assert(321);
} catch (NestedValidationException $exception) {
echo $exception->getFullMessage().PHP_EOL;
}
?>
--EXPECT--
321 must equal 123
321 must not equal 321
- 321 must equal 123
- 321 must not equal 321