mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 15:25: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>
58 lines
1.4 KiB
PHP
58 lines
1.4 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(Vowel::class)]
|
|
final class VowelTest extends RuleTestCase
|
|
{
|
|
/** @return iterable<array{Vowel, mixed}> */
|
|
public static function providerForValidInput(): iterable
|
|
{
|
|
$sut = new Vowel();
|
|
|
|
return [
|
|
[$sut, 'a'],
|
|
[$sut, 'e'],
|
|
[$sut, 'i'],
|
|
[$sut, 'o'],
|
|
[$sut, 'u'],
|
|
[$sut, 'aeiou'],
|
|
[$sut, 'uoiea'],
|
|
[new Vowel('!@#$%^&*(){}'), '!@#$%^&*(){}aeoiu'],
|
|
[new Vowel('[]?+=/\\-_|"\',<>.'), '[]?+=/\\-_|"\',<>.aeoiu'],
|
|
];
|
|
}
|
|
|
|
/** @return iterable<array{Vowel, mixed}> */
|
|
public static function providerForInvalidInput(): iterable
|
|
{
|
|
$sut = new Vowel();
|
|
|
|
return [
|
|
[$sut, ''],
|
|
[$sut, ' '],
|
|
[$sut, "\n"],
|
|
[$sut, "\t"],
|
|
[$sut, "\r"],
|
|
[$sut, null],
|
|
[$sut, '16'],
|
|
[$sut, 'F'],
|
|
[$sut, 'g'],
|
|
[$sut, 'Foo'],
|
|
[$sut, -50],
|
|
[$sut, 'basic'],
|
|
];
|
|
}
|
|
}
|