mirror of
https://github.com/Respect/Validation.git
synced 2024-06-29 02:30:06 +02:00
Create integration tests for "Age" role
This commit is contained in:
parent
f2083a58d7
commit
ecbc5c0a94
11
tests/integration/age_1.phpt
Normal file
11
tests/integration/age_1.phpt
Normal file
|
@ -0,0 +1,11 @@
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
v::age(18)->assert('18 years ago');
|
||||
v::age(18)->check('18 years ago');
|
||||
?>
|
||||
--EXPECTF--
|
17
tests/integration/age_2.phpt
Normal file
17
tests/integration/age_2.phpt
Normal file
|
@ -0,0 +1,17 @@
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use Respect\Validation\Validator as v;
|
||||
use Respect\Validation\Exceptions\MaxException;
|
||||
|
||||
try {
|
||||
v::age(18)->check('17 years ago');
|
||||
} catch (MaxException $e) {
|
||||
echo $e->getMainMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
"17 years ago" must be less than or equal to "1997-11-09 23:59:59"
|
17
tests/integration/age_3.phpt
Normal file
17
tests/integration/age_3.phpt
Normal file
|
@ -0,0 +1,17 @@
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use Respect\Validation\Validator as v;
|
||||
use Respect\Validation\Exceptions\AllOfException;
|
||||
|
||||
try {
|
||||
v::age(18)->assert('17 years ago');
|
||||
} catch (AllOfException $e) {
|
||||
echo $e->getFullMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
- "17 years ago" must be less than or equal to "1997-11-09 23:59:59"
|
17
tests/integration/age_4.phpt
Normal file
17
tests/integration/age_4.phpt
Normal file
|
@ -0,0 +1,17 @@
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use Respect\Validation\Validator as v;
|
||||
use Respect\Validation\Exceptions\AllOfException;
|
||||
|
||||
try {
|
||||
v::age(10, 50)->assert('9 years ago');
|
||||
} catch (AllOfException $e) {
|
||||
echo $e->getFullMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
- "9 years ago" must be less than or equal to "2005-11-09 23:59:59"
|
Loading…
Reference in a new issue