mirror of
https://github.com/Respect/Validation.git
synced 2024-06-01 21:32:14 +02:00
f53b77a186
We already supported PHP 8.0 as our constrains in the "composer.json" file was ">=7.3", but we were not testing it before. Because of that, I found a bug on "EndsWith" which is fixed now. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
43 lines
1 KiB
PHP
43 lines
1 KiB
PHP
--CREDITS--
|
|
Henrique Moody <henriquemoody@gmail.com>
|
|
--FILE--
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require 'vendor/autoload.php';
|
|
|
|
use Respect\Validation\Exceptions\NestedValidationException;
|
|
use Respect\Validation\Exceptions\ResourceTypeException;
|
|
use Respect\Validation\Validator as v;
|
|
|
|
try {
|
|
v::resourceType()->check('test');
|
|
} catch (ResourceTypeException $exception) {
|
|
echo $exception->getMessage() . PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
v::not(v::resourceType())->check(tmpfile());
|
|
} catch (ResourceTypeException $exception) {
|
|
echo $exception->getMessage() . PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
v::resourceType()->assert([]);
|
|
} catch (NestedValidationException $exception) {
|
|
echo $exception->getFullMessage() . PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
v::not(v::resourceType())->assert(tmpfile());
|
|
} catch (NestedValidationException $exception) {
|
|
echo $exception->getFullMessage() . PHP_EOL;
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
"test" must be a resource
|
|
`[resource] (stream)` must not be a resource
|
|
- `{ }` must be a resource
|
|
- `[resource] (stream)` must not be a resource
|