respect-validation/tests/integration/rules/phplabel.phpt

22 lines
643 B
Plaintext
Raw Normal View History

2016-03-04 17:46:07 +01:00
--TEST--
PhpLabel rule exception should not be thrown for valid inputs
--FILE--
<?php
declare(strict_types=1);
2016-03-04 17:46:07 +01:00
require 'vendor/autoload.php';
use Respect\Validation\Validator as v;
exceptionMessage(static fn() => v::phpLabel()->check('f o o'));
exceptionMessage(static fn() => v::not(v::phpLabel())->check('correctOne'));
exceptionFullMessage(static fn() => v::phpLabel()->assert('0wner'));
exceptionFullMessage(static fn() => v::not(v::phpLabel())->assert('Respect'));
2016-03-04 17:46:07 +01:00
?>
--EXPECT--
"f o o" must be a valid PHP label
"correctOne" must not be a valid PHP label
- "0wner" must be a valid PHP label
- "Respect" must not be a valid PHP label