respect-validation/tests/unit/Validators/LeapYearTest.php
Henrique Moody 7c681fec66
Fix SPDX headers in all files
I ran the `bin/console spdx --fix` with different strategies for
different files. For most of the core classes, since they've been
drastically rebuilt, I've run it with the `git-blame` strategy, for for
the `src/Validators`, in which the API changed completely but the logic
remains the same, I use the `git-log` strategy.
2026-02-03 15:23:23 +01:00

53 lines
1.4 KiB
PHP

<?php
/*
* SPDX-License-Identifier: MIT
* SPDX-FileCopyrightText: (c) Respect Project Contributors
* SPDX-FileContributor: Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-FileContributor: Danilo Correa <danilosilva87@gmail.com>
* SPDX-FileContributor: Henrique Moody <henriquemoody@gmail.com>
* SPDX-FileContributor: Jayson Reis <santosdosreis@gmail.com>
*/
declare(strict_types=1);
namespace Respect\Validation\Validators;
use DateTime;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use Respect\Validation\Test\RuleTestCase;
#[Group('validator')]
#[CoversClass(LeapYear::class)]
final class LeapYearTest extends RuleTestCase
{
/** @return iterable<array{LeapYear, mixed}> */
public static function providerForValidInput(): iterable
{
$validator = new LeapYear();
return [
[$validator, '2008'],
[$validator, '2008-02-29'],
[$validator, 2008],
[$validator, 2008],
[$validator, new DateTime('2008-02-29')],
];
}
/** @return iterable<array{LeapYear, mixed}> */
public static function providerForInvalidInput(): iterable
{
$validator = new LeapYear();
return [
[$validator, ''],
[$validator, '2009'],
[$validator, '2009-02-29'],
[$validator, 2009],
[$validator, new DateTime('2009-02-29')],
[$validator, []],
];
}
}