respect-validation/tests/integration/rules/size.phpt
Henrique Moody b7c4189b4f
Remove "--CREDITS--" from PHPT files
Most of those files have undergone massive changes; in some cases, the
"--CREDITS--" might not make sense.

This is aligned with the latest coding standard changes [1], since we no
longer allow the annotation "@author".

In any case, we can always use `git blame` or `git log` to see the
contributors.

[1]: 9a13c9fb03

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2024-01-29 23:49:36 +01:00

36 lines
2.1 KiB
PHP

--FILE--
<?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Respect\Validation\Validator as v;
exceptionMessage(static fn() => v::size('1kb', '2kb')->check('tests/fixtures/valid-image.gif'));
exceptionMessage(static fn() => v::size('700kb', null)->check('tests/fixtures/valid-image.gif'));
exceptionMessage(static fn() => v::size(null, '1kb')->check('tests/fixtures/valid-image.gif'));
exceptionMessage(static fn() => v::not(v::size('500kb', '600kb'))->check('tests/fixtures/valid-image.gif'));
exceptionMessage(static fn() => v::not(v::size('500kb', null))->check('tests/fixtures/valid-image.gif'));
exceptionMessage(static fn() => v::not(v::size(null, '600kb'))->check('tests/fixtures/valid-image.gif'));
exceptionFullMessage(static fn() => v::size('1kb', '2kb')->assert('tests/fixtures/valid-image.gif'));
exceptionFullMessage(static fn() => v::size('700kb', null)->assert('tests/fixtures/valid-image.gif'));
exceptionFullMessage(static fn() => v::size(null, '1kb')->assert('tests/fixtures/valid-image.gif'));
exceptionFullMessage(static fn() => v::not(v::size('500kb', '600kb'))->assert('tests/fixtures/valid-image.gif'));
exceptionFullMessage(static fn() => v::not(v::size('500kb', null))->assert('tests/fixtures/valid-image.gif'));
exceptionFullMessage(static fn() => v::not(v::size(null, '600kb'))->assert('tests/fixtures/valid-image.gif'));
?>
--EXPECT--
"tests/fixtures/valid-image.gif" must be between "1kb" and "2kb"
"tests/fixtures/valid-image.gif" must be greater than "700kb"
"tests/fixtures/valid-image.gif" must be lower than "1kb"
"tests/fixtures/valid-image.gif" must not be between "500kb" and "600kb"
"tests/fixtures/valid-image.gif" must not be greater than "500kb"
"tests/fixtures/valid-image.gif" must not be lower than "600kb"
- "tests/fixtures/valid-image.gif" must be between "1kb" and "2kb"
- "tests/fixtures/valid-image.gif" must be greater than "700kb"
- "tests/fixtures/valid-image.gif" must be lower than "1kb"
- "tests/fixtures/valid-image.gif" must not be between "500kb" and "600kb"
- "tests/fixtures/valid-image.gif" must not be greater than "500kb"
- "tests/fixtures/valid-image.gif" must not be lower than "600kb"