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;
|
|
|
|
use function chr;
|
|
|
|
#[Group('rule')]
|
|
#[CoversClass(Printable::class)]
|
|
final class PrintableTest extends RuleTestCase
|
|
{
|
|
/** @return iterable<array{Printable, mixed}> */
|
|
public static function providerForValidInput(): iterable
|
|
{
|
|
$rule = new Printable();
|
|
|
|
return [
|
|
[$rule, ' '],
|
|
[$rule, 'LKA#@%.54'],
|
|
[$rule, 'foobar'],
|
|
[$rule, '16-50'],
|
|
[$rule, '123'],
|
|
[$rule, 'foo bar'],
|
|
[$rule, '#$%&*_'],
|
|
[new Printable("\t\n"), "\t\n "],
|
|
[new Printable("\v\r"), "\v\r "],
|
|
];
|
|
}
|
|
|
|
/** @return iterable<array{Printable, mixed}> */
|
|
public static function providerForInvalidInput(): iterable
|
|
{
|
|
$rule = new Printable();
|
|
|
|
return [
|
|
[$rule, ''],
|
|
[$rule, null],
|
|
[$rule, 'foo' . chr(7) . 'bar'],
|
|
[$rule, 'foo' . chr(10) . 'bar'],
|
|
];
|
|
}
|
|
}
|