respect-validation/tests/feature/Rules/NipTest.php
2025-12-18 19:03:39 +01:00

30 lines
1,019 B
PHP

<?php
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
require_once 'vendor/autoload.php';
test('Scenario #1', catchMessage(
fn() => v::nip()->assert('1645865778'),
fn(string $message) => expect($message)->toBe('"1645865778" must be a valid Polish VAT identification number'),
));
test('Scenario #2', catchMessage(
fn() => v::not(v::nip())->assert('1645865777'),
fn(string $message) => expect($message)->toBe('"1645865777" must not be a valid Polish VAT identification number'),
));
test('Scenario #3', catchFullMessage(
fn() => v::nip()->assert('1645865778'),
fn(string $fullMessage) => expect($fullMessage)->toBe('- "1645865778" must be a valid Polish VAT identification number'),
));
test('Scenario #4', catchFullMessage(
fn() => v::not(v::nip())->assert('1645865777'),
fn(string $fullMessage) => expect($fullMessage)->toBe('- "1645865777" must not be a valid Polish VAT identification number'),
));