respect-validation/tests/feature/Issues/Issue1477Test.php
Henrique Moody 48405271c5
Replace placeholder "name" with "subject"
The `{{name}}` placeholder could represent different things depending on
the state of the Result, and referring to it as `{{name}}` seems
arbitrary. This commit changes it to `{{subject}}`, which is much more
generic and it describes well what that placeholder can mean.
2025-12-26 21:30:01 +01:00

29 lines
854 B
PHP

<?php
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
use Respect\Validation\Rules\Core\Simple;
test('https://github.com/Respect/Validation/issues/1477', catchAll(
fn() => v::key(
'Address',
v::templated(
new class extends Simple {
public function isValid(mixed $input): bool
{
return false;
}
},
'{{subject}} is not good!',
),
)->assert(['Address' => 'cvejvn']),
fn(string $message, string $fullMessage, array $messages) => expect()
->and($message)->toBe('`.Address` is not good!')
->and($fullMessage)->toBe('- `.Address` is not good!')
->and($messages)->toBe(['Address' => '`.Address` is not good!']),
));