Create integration tests for "Equals" rule

This commit is contained in:
Danilo Correa 2015-10-18 19:57:19 +00:00 committed by Henrique Moody
parent 1c254ab682
commit 954c0ca133
5 changed files with 70 additions and 0 deletions

View 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--

View 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"

View 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"

View 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"

View 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"