2015-08-20 05:43:17 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2023-02-17 05:13:51 +01:00
|
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
|
|
* SPDX-License-Identifier: MIT
|
2015-08-20 05:43:17 +02:00
|
|
|
*/
|
|
|
|
|
2017-11-19 19:01:31 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2015-08-20 05:43:17 +02:00
|
|
|
namespace Respect\Validation\Rules;
|
|
|
|
|
2024-01-28 01:46:21 +01:00
|
|
|
use PHPUnit\Framework\Attributes\CoversClass;
|
|
|
|
use PHPUnit\Framework\Attributes\Group;
|
2018-08-07 02:46:24 +02:00
|
|
|
use Respect\Validation\Test\RuleTestCase;
|
|
|
|
use stdClass;
|
2020-07-21 22:54:41 +02:00
|
|
|
|
2018-08-07 02:46:24 +02:00
|
|
|
use const INF;
|
|
|
|
use const PHP_INT_MAX;
|
2017-11-04 11:21:40 +01:00
|
|
|
|
2024-01-28 01:46:21 +01:00
|
|
|
#[Group('rule')]
|
|
|
|
#[CoversClass(Infinite::class)]
|
2018-08-07 02:46:24 +02:00
|
|
|
final class InfiniteTest extends RuleTestCase
|
2015-08-20 05:43:17 +02:00
|
|
|
{
|
2024-02-04 19:23:04 +01:00
|
|
|
/** @return iterable<array{Infinite, mixed}> */
|
|
|
|
public static function providerForValidInput(): iterable
|
2015-08-20 05:43:17 +02:00
|
|
|
{
|
2018-08-07 02:46:24 +02:00
|
|
|
$rule = new Infinite();
|
2015-08-20 05:43:17 +02:00
|
|
|
|
2018-08-07 02:46:24 +02:00
|
|
|
return [
|
|
|
|
[$rule, INF],
|
|
|
|
[$rule, INF * -1],
|
|
|
|
];
|
2015-08-20 05:43:17 +02:00
|
|
|
}
|
|
|
|
|
2024-02-04 19:23:04 +01:00
|
|
|
/** @return iterable<array{Infinite, mixed}> */
|
|
|
|
public static function providerForInvalidInput(): iterable
|
2015-08-20 05:43:17 +02:00
|
|
|
{
|
2018-08-07 02:46:24 +02:00
|
|
|
$rule = new Infinite();
|
2015-08-20 05:43:17 +02:00
|
|
|
|
2015-10-18 03:44:47 +02:00
|
|
|
return [
|
2018-08-07 02:46:24 +02:00
|
|
|
[$rule, ' '],
|
|
|
|
[$rule, []],
|
|
|
|
[$rule, new stdClass()],
|
|
|
|
[$rule, null],
|
|
|
|
[$rule, '123456'],
|
|
|
|
[$rule, -9],
|
|
|
|
[$rule, 0],
|
|
|
|
[$rule, 16],
|
|
|
|
[$rule, 2],
|
|
|
|
[$rule, PHP_INT_MAX],
|
2015-10-18 03:44:47 +02:00
|
|
|
];
|
2015-08-20 05:43:17 +02:00
|
|
|
}
|
|
|
|
}
|