respect-validation/tests/unit/Rules/CallTest.php
Henrique Moody 7ded68c550
Update validation enginer of a few rules
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2024-03-07 02:57:39 +01:00

38 lines
1,019 B
PHP

<?php
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
namespace Respect\Validation\Rules;
use Exception;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use Respect\Validation\Test\Rules\Stub;
use Respect\Validation\Test\RuleTestCase;
#[Group('rule')]
#[CoversClass(Call::class)]
final class CallTest extends RuleTestCase
{
/** @return iterable<string, array{Call, mixed}> */
public static function providerForValidInput(): iterable
{
return [
'valid rule and valid callable' => [new Call('trim', Stub::pass(1)), ' input '],
];
}
/** @return iterable<string, array{Call, mixed}> */
public static function providerForInvalidInput(): iterable
{
return [
'PHP error' => [new Call('trim', Stub::pass(1)), []],
'exception' => [new Call(static fn() => throw new Exception(), Stub::pass(1)), []],
];
}
}