mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 23:35:45 +01:00
28 lines
1 KiB
PHP
28 lines
1 KiB
PHP
<?php
|
|
|
|
/*
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
test('Scenario #1', catchMessage(
|
|
fn() => v::creditCard('Discover')->assert(3566002020360505),
|
|
fn(string $message) => expect($message)->toBe('3566002020360505 must be a valid Discover credit card number'),
|
|
));
|
|
|
|
test('Scenario #2', catchMessage(
|
|
fn() => v::not(v::creditCard('Visa'))->assert(4024007153361885),
|
|
fn(string $message) => expect($message)->toBe('4024007153361885 must not be a valid Visa credit card number'),
|
|
));
|
|
|
|
test('Scenario #3', catchFullMessage(
|
|
fn() => v::creditCard('MasterCard')->assert(3566002020360505),
|
|
fn(string $fullMessage) => expect($fullMessage)->toBe('- 3566002020360505 must be a valid MasterCard credit card number'),
|
|
));
|
|
|
|
test('Scenario #4', catchFullMessage(
|
|
fn() => v::not(v::creditCard())->assert(5555444433331111),
|
|
fn(string $fullMessage) => expect($fullMessage)->toBe('- 5555444433331111 must not be a valid credit card number'),
|
|
));
|