mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 07:15:45 +01:00
While I migrate them, I also renamed "AbstractFilterRule" to "Filter" because that's a much simpler name, and I would like to stop having "Abstract" and "Interfaces" as part of the name of the classes. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
52 lines
1.2 KiB
PHP
52 lines
1.2 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(Punct::class)]
|
|
final class PunctTest extends RuleTestCase
|
|
{
|
|
/** @return iterable<array{Punct, mixed}> */
|
|
public static function providerForValidInput(): iterable
|
|
{
|
|
$sut = new Punct();
|
|
|
|
return [
|
|
[$sut, '.'],
|
|
[$sut, ',;:'],
|
|
[$sut, '-@#$*'],
|
|
[$sut, '()[]{}'],
|
|
[new Punct('abc123 '), '!@#$%^&*(){} abc 123'],
|
|
[new Punct("abc123 \t\n"), "[]?+=/\\-_|\"',<>. \t \n abc 123"],
|
|
];
|
|
}
|
|
|
|
/** @return iterable<array{Punct, mixed}> */
|
|
public static function providerForInvalidInput(): iterable
|
|
{
|
|
$sut = new Punct();
|
|
|
|
return [
|
|
[$sut, ''],
|
|
[$sut, '16-50'],
|
|
[$sut, 'a'],
|
|
[$sut, ' '],
|
|
[$sut, 'Foo'],
|
|
[$sut, '12.1'],
|
|
[$sut, '-12'],
|
|
[$sut, -12],
|
|
[$sut, '( )_{}'],
|
|
];
|
|
}
|
|
}
|