mirror of
https://github.com/Respect/Validation.git
synced 2026-03-17 23:59:51 +01:00
27 lines
761 B
PHP
27 lines
761 B
PHP
<?php
|
|
|
|
/*
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
date_default_timezone_set('UTC');
|
|
|
|
use Respect\Validation\Validator;
|
|
|
|
test('Scenario #1', expectFullMessage(
|
|
function (): void {
|
|
Validator::create()
|
|
->key('username', Validator::length(Validator::between(2, 32)))
|
|
->key('birthdate', Validator::dateTime())
|
|
->setName('User Subscription Form')
|
|
->assert(['username' => '0', 'birthdate' => 'Whatever']);
|
|
},
|
|
<<<'FULL_MESSAGE'
|
|
- All the required rules must pass for User Subscription Form
|
|
- The length of username must be between 2 and 32
|
|
- birthdate must be a valid date/time
|
|
FULL_MESSAGE,
|
|
));
|