respect-validation/tests/unit/Rules/XdigitTest.php
Henrique Moody 12c145756c
Upgrade "phpunit/phpunit"
This commit also replaces PHPUnit annotations with attributes.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2024-01-28 14:16:52 +01:00

52 lines
1.3 KiB
PHP

<?php
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
namespace Respect\Validation\Rules;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use Respect\Validation\Test\RuleTestCase;
#[Group('rule')]
#[CoversClass(AbstractFilterRule::class)]
#[CoversClass(Xdigit::class)]
final class XdigitTest extends RuleTestCase
{
/**
* @return array<array{Xdigit, mixed}>
*/
public static function providerForValidInput(): array
{
return [
[new Xdigit(), 'FFF'],
[new Xdigit(), '15'],
[new Xdigit(), 'DE12FA'],
[new Xdigit(), '1234567890abcdef'],
[new Xdigit(), 443],
[new Xdigit(), 0x123],
[new Xdigit('!@#$%^&*(){} '), '!@#$%^&*(){} abc 123'],
[new Xdigit("[]?+=/\\-_|\"',<>. \t\n"), "[]?+=/\\-_|\"',<>. \t \n abc 123"],
];
}
/**
* @return array<array{Xdigit, mixed}>
*/
public static function providerForInvalidInput(): array
{
return [
[new Xdigit(), ''],
[new Xdigit(), null],
[new Xdigit(), 'j'],
[new Xdigit(), ' '],
[new Xdigit(), 'Foo'],
[new Xdigit(), '1.5'],
];
}
}