mirror of
https://github.com/Respect/Validation.git
synced 2024-06-01 13:22:24 +02:00
eeaea466ac
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>
49 lines
1.3 KiB
PHP
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',
|
|
]
|