respect-validation/tests/integration/rules/betweenExclusive.phpt
Henrique Moody eeaea466ac
Prefix IDs of wrapper rule results
Because some rules work more as a prefix, it makes sense to prefix their
result ID. That will allow for a more intuitive templating, especially
when using those rules as prefixes.

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

49 lines
1.3 KiB
PHP

--FILE--
<?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Respect\Validation\Validator as v;
run([
'Default' => [v::betweenExclusive(1, 10), 12],
'Negative' => [v::not(v::betweenExclusive(1, 10)), 5],
'With template' => [v::betweenExclusive(1, 10), 12, 'Bewildered bees buzzed between blooming begonias'],
'With name' => [v::betweenExclusive(1, 10)->setName('Range'), 10],
]);
?>
--EXPECT--
Default
⎺⎺⎺⎺⎺⎺⎺
12 must be greater than 1 and less than 10
- 12 must be greater than 1 and less than 10
[
'betweenExclusive' => '12 must be greater than 1 and less than 10',
]
Negative
⎺⎺⎺⎺⎺⎺⎺⎺
5 must not be greater than 1 and less than 10
- 5 must not be greater than 1 and less than 10
[
'notBetweenExclusive' => '5 must not be greater than 1 and less than 10',
]
With template
⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺
Bewildered bees buzzed between blooming begonias
- Bewildered bees buzzed between blooming begonias
[
'betweenExclusive' => 'Bewildered bees buzzed between blooming begonias',
]
With name
⎺⎺⎺⎺⎺⎺⎺⎺⎺
Range must be greater than 1 and less than 10
- Range must be greater than 1 and less than 10
[
'betweenExclusive' => 'Range must be greater than 1 and less than 10',
]