respect-validation/tests/feature/AssertWithTemplatesTest.php
Alexandre Gomes Gaigalas d9cdc118b2 Introduce REUSE compliance
This commit introduces REUSE compliance by annotating all files
with SPDX information and placing the reused licences in the
LICENSES folder.

We additionally removed the docheader tool which is made obsolete
by this change.

The main LICENSE and copyright text of the project is now not under
my personal name anymore, and it belongs to "The Respect Project
Contributors" instead.

This change restores author names to several files, giving the
appropriate attribution for contributions.
2026-01-21 06:28:11 +00:00

41 lines
1.9 KiB
PHP

<?php
/*
* SPDX-License-Identifier: MIT
* SPDX-FileCopyrightText: (c) Respect Project Contributors
* SPDX-FileContributor: Henrique Moody <henriquemoody@gmail.com>
*/
declare(strict_types=1);
test('Template as a string in the chain', catchAll(
fn() => v::templated('My string template in the chain', v::alwaysInvalid())->assert(1),
fn(string $message, string $fullMessage, array $messages) => expect()
->and($message)->toBe('My string template in the chain')
->and($fullMessage)->toBe('- My string template in the chain')
->and($messages)->toBe(['alwaysInvalid' => 'My string template in the chain']),
));
test('Template as an array in the chain', catchAll(
fn() => v::alwaysInvalid()->assert(1, ['alwaysInvalid' => 'My array template in the chain']),
fn(string $message, string $fullMessage, array $messages) => expect()
->and($message)->toBe('My array template in the chain')
->and($fullMessage)->toBe('- My array template in the chain')
->and($messages)->toBe(['alwaysInvalid' => 'My array template in the chain']),
));
test('Runtime template as string', catchAll(
fn() => v::alwaysInvalid()->assert(1, 'My runtime template as string'),
fn(string $message, string $fullMessage, array $messages) => expect()
->and($message)->toBe('My runtime template as string')
->and($fullMessage)->toBe('- My runtime template as string')
->and($messages)->toBe(['alwaysInvalid' => 'My runtime template as string']),
));
test('Runtime template as an array', catchAll(
fn() => v::alwaysInvalid()->assert(1, ['alwaysInvalid' => 'My runtime template an array']),
fn(string $message, string $fullMessage, array $messages) => expect()
->and($message)->toBe('My runtime template an array')
->and($fullMessage)->toBe('- My runtime template an array')
->and($messages)->toBe(['alwaysInvalid' => 'My runtime template an array']),
));