respect-validation/tests/integration/rules/domain.phpt
Henrique Moody 3a6a71a1f8
Update the validation engine of the "Domain" rule
I also decided to make the messages way more straightforward than
before. Instead of showing why the input is not a valid domain, we're
now simply saying that the input is not a proper domain.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2024-03-07 00:43:32 +01:00

20 lines
564 B
PHP

--FILE--
<?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Respect\Validation\Validator as v;
exceptionMessage(static fn() => v::domain()->check('batman'));
exceptionMessage(static fn() => v::not(v::domain())->check('r--w.com'));
exceptionFullMessage(static fn() => v::domain()->assert('p-éz-.kk'));
exceptionFullMessage(static fn() => v::not(v::domain())->assert('github.com'));
?>
--EXPECT--
"batman" must be a valid domain
"r--w.com" must not be a valid domain
- "p-éz-.kk" must be a valid domain
- "github.com" must not be a valid domain