Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / validator / Tests / Constraints / GreaterThanValidatorTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Validator\Tests\Constraints;
13
14 use Symfony\Component\Validator\Constraints\GreaterThan;
15 use Symfony\Component\Validator\Constraints\GreaterThanValidator;
16
17 /**
18  * @author Daniel Holmes <daniel@danielholmes.org>
19  */
20 class GreaterThanValidatorTest extends AbstractComparisonValidatorTestCase
21 {
22     protected function createValidator()
23     {
24         return new GreaterThanValidator();
25     }
26
27     protected function createConstraint(array $options = null)
28     {
29         return new GreaterThan($options);
30     }
31
32     protected function getErrorCode()
33     {
34         return GreaterThan::TOO_LOW_ERROR;
35     }
36
37     /**
38      * {@inheritdoc}
39      */
40     public function provideValidComparisons()
41     {
42         return array(
43             array(2, 1),
44             array(new \DateTime('2005/01/01'), new \DateTime('2001/01/01')),
45             array(new \DateTime('2005/01/01'), '2001/01/01'),
46             array(new \DateTime('2005/01/01 UTC'), '2001/01/01 UTC'),
47             array(new ComparisonTest_Class(5), new ComparisonTest_Class(4)),
48             array('333', '22'),
49             array(null, 1),
50         );
51     }
52
53     /**
54      * {@inheritdoc}
55      */
56     public function provideInvalidComparisons()
57     {
58         return array(
59             array(1, '1', 2, '2', 'integer'),
60             array(2, '2', 2, '2', 'integer'),
61             array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2005/01/01'), 'Jan 1, 2005, 12:00 AM', 'DateTime'),
62             array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'),
63             array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2005/01/01', 'Jan 1, 2005, 12:00 AM', 'DateTime'),
64             array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2000/01/01', 'Jan 1, 2000, 12:00 AM', 'DateTime'),
65             array(new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2005/01/01 UTC', 'Jan 1, 2005, 12:00 AM', 'DateTime'),
66             array(new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2000/01/01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'),
67             array(new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'),
68             array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'),
69             array('22', '"22"', '333', '"333"', 'string'),
70             array('22', '"22"', '22', '"22"', 'string'),
71         );
72     }
73 }