respect-validation/tests/unit/Rules/IntValTest.php
Danilo Benevides de53a4b4bd
Apply contribution guidelines to "IntVal" rule
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
2018-06-23 21:43:05 +02:00

64 lines
1.3 KiB
PHP

<?php
/*
* This file is part of Respect/Validation.
*
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
*
* For the full copyright and license information, please view the "LICENSE.md"
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Rules;
use Respect\Validation\Test\RuleTestCase;
/**
* @group rule
*
* @covers \Respect\Validation\Rules\IntVal
*
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
* @author Danilo Benevides <danilobenevides01@gmail.com>
* @author Gabriel Caruso <carusogabriel34@gmail.com>
* @author Henrique Moody <henriquemoody@gmail.com>
*/
final class IntValTest extends RuleTestCase
{
/*
* {@inheritdoc}
*/
public function providerForValidInput(): array
{
$rule = new IntVal();
return [
[$rule, 16],
[$rule, '165'],
[$rule, 123456],
[$rule, PHP_INT_MAX],
];
}
/*
* {@inheritdoc}
*/
public function providerForInvalidInput(): array
{
$rule = new IntVal();
return [
[$rule, ''],
[$rule, null],
[$rule, 'a'],
[$rule, '1.0'],
[$rule, 1.0],
[$rule, ' '],
[$rule, 'Foo'],
[$rule, '1.44'],
[$rule, 1e-5],
];
}
}