mirror of
https://github.com/Respect/Validation.git
synced 2024-06-29 02:30:06 +02:00
Create integration tests for "Equals" rule
This commit is contained in:
parent
1c254ab682
commit
954c0ca133
10
tests/integration/equals_1.phpt
Normal file
10
tests/integration/equals_1.phpt
Normal file
|
@ -0,0 +1,10 @@
|
|||
--FILE--
|
||||
<?php
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
v::equals('test 123')->assert('test 123');
|
||||
v::equals('test 123')->check('test 123');
|
||||
?>
|
||||
--EXPECTF--
|
15
tests/integration/equals_2.phpt
Normal file
15
tests/integration/equals_2.phpt
Normal file
|
@ -0,0 +1,15 @@
|
|||
--FILE--
|
||||
<?php
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use Respect\Validation\Exceptions\EqualsException;
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
try {
|
||||
v::equals('test 123')->check('test 1234');
|
||||
} catch (EqualsException $e) {
|
||||
echo $e->getMainMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
"test 1234" must be equals "test 123"
|
15
tests/integration/equals_3.phpt
Normal file
15
tests/integration/equals_3.phpt
Normal file
|
@ -0,0 +1,15 @@
|
|||
--FILE--
|
||||
<?php
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use Respect\Validation\Exceptions\AllOfException;
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
try {
|
||||
v::equals('test 123')->assert('test 1234');
|
||||
} catch (AllOfException $e) {
|
||||
echo $e->getFullMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
\-"test 1234" must be equals "test 123"
|
15
tests/integration/equals_4.phpt
Normal file
15
tests/integration/equals_4.phpt
Normal file
|
@ -0,0 +1,15 @@
|
|||
--FILE--
|
||||
<?php
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use Respect\Validation\Exceptions\EqualsException;
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
try {
|
||||
v::not(v::equals('test 123'))->check('test 123');
|
||||
} catch (EqualsException $e) {
|
||||
echo $e->getMainMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
"test 123" must not be equals "test 123"
|
15
tests/integration/equals_5.phpt
Normal file
15
tests/integration/equals_5.phpt
Normal file
|
@ -0,0 +1,15 @@
|
|||
--FILE--
|
||||
<?php
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use Respect\Validation\Exceptions\AllOfException;
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
try {
|
||||
v::not(v::equals('test 123'))->assert('test 123');
|
||||
} catch (AllOfException $e) {
|
||||
echo $e->getFullMessage();
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
\-"test 123" must not be equals "test 123"
|
Loading…
Reference in a new issue