respect-validation/tests/unit/Rules/LeapDateTest.php

44 lines
1.2 KiB
PHP
Raw Normal View History

2011-10-18 01:45:31 +02:00
<?php
2015-06-08 16:47:14 +02:00
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
2011-10-18 01:45:31 +02:00
namespace Respect\Validation\Rules;
use DateTime;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use Respect\Validation\Test\RuleTestCase;
2011-10-18 01:45:31 +02:00
#[Group('rule')]
#[CoversClass(LeapDate::class)]
final class LeapDateTest extends RuleTestCase
2011-10-18 01:45:31 +02:00
{
/** @return iterable<array{LeapDate, mixed}> */
public static function providerForValidInput(): iterable
{
return [
[new LeapDate('Y-m-d'), '1988-02-29'],
[new LeapDate('Y-m-d'), '1992-02-29'],
[new LeapDate('Y-m-d'), new DateTime('1988-02-29')],
[new LeapDate('Y-m-d'), new DateTime('1992-02-29')],
];
}
/** @return iterable<array{LeapDate, mixed}> */
public static function providerForInvalidInput(): iterable
2011-11-29 22:20:07 +01:00
{
return [
[new LeapDate('Y-m-d'), '1989-02-29'],
[new LeapDate('Y-m-d'), '1993-02-29'],
[new LeapDate('Y-m-d'), new DateTime('1989-02-29')],
[new LeapDate('Y-m-d'), new DateTime('1993-02-29')],
[new LeapDate('Y-m-d'), []],
];
2011-11-29 22:20:07 +01:00
}
2011-10-18 01:45:31 +02:00
}