respect-validation/tests/unit/Rules/GreaterThanTest.php
Henrique Moody 0cdd8c4546
Fix issues after merging 1.1
These two branches are very different, therefore merging is becoming
very hard.

I decided to not put these changes together with 5750952 because it
seems easy to track these changes with a specific commit.

While working on this merge I realized that would make more sense to
create "AbstractComparison" to handle the rules that compare values.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-08-01 20:46:34 +02:00

59 lines
1.5 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;
use Respect\Validation\Test\Stubs\CountableStub;
/**
* @group rule
*
* @covers \Respect\Validation\Rules\AbstractComparison
* @covers \Respect\Validation\Rules\GreaterThan
*
* @author Henrique Moody <henriquemoody@gmail.com>
*/
final class GreaterThanTest extends RuleTestCase
{
/**
* {@inheritdoc}
*/
public function providerForValidInput(): array
{
return [
[new GreaterThan(10), 11],
[new GreaterThan('2010-01-01'), '2020-01-01'],
[new GreaterThan('yesterday'), 'now'],
[new GreaterThan('A'), 'B'],
[new GreaterThan(new CountableStub(3)), 4],
];
}
/**
* {@inheritdoc}
*/
public function providerForInvalidInput(): array
{
return [
[new GreaterThan(10), 9],
[new GreaterThan('2010-01-01'), '2000-01-01'],
[new GreaterThan('18 years ago'), '5 days later'],
[new GreaterThan('c'), 'a'],
[new GreaterThan(new CountableStub(3)), 3],
[new GreaterThan(1900), '2018-01-25'],
[new GreaterThan(10.5), '2018-01-25'],
];
}
}