mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 23:35:45 +01:00
26 lines
599 B
PHP
26 lines
599 B
PHP
--CREDITS--
|
|
Edson Lima <dddwebdeveloper@gmail.com>
|
|
Henrique Moody <henriquemoody@gmail.com>
|
|
--FILE--
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require 'vendor/autoload.php';
|
|
|
|
use Respect\Validation\Exceptions\AllOfException;
|
|
use Respect\Validation\Validator as v;
|
|
|
|
$data = [
|
|
'password' => 'shazam',
|
|
'password_confirmation' => 'batman',
|
|
];
|
|
|
|
try {
|
|
v::keyValue('password', 'equals', 'password_confirmation')->assert($data);
|
|
} catch (AllOfException $e) {
|
|
echo $e->getMessage();
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
All of the required rules must pass for `{ "password": "shazam", "password_confirmation": "batman" }`
|