Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / symfony / validator / Tests / Constraints / LessThanOrEqualValidatorTest.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\LessThanOrEqual;
15 use Symfony\Component\Validator\Constraints\LessThanOrEqualValidator;
16
17 /**
18  * @author Daniel Holmes <daniel@danielholmes.org>
19  */
20 class LessThanOrEqualValidatorTest extends AbstractComparisonValidatorTestCase
21 {
22     protected function createValidator()
23     {
24         return new LessThanOrEqualValidator();
25     }
26
27     protected function createConstraint(array $options = null)
28     {
29         return new LessThanOrEqual($options);
30     }
31
32     protected function getErrorCode()
33     {
34         return LessThanOrEqual::TOO_HIGH_ERROR;
35     }
36
37     /**
38      * {@inheritdoc}
39      */
40     public function provideValidComparisons()
41     {
42         return array(
43             array(1, 2),
44             array(1, 1),
45             array(new \DateTime('2000-01-01'), new \DateTime('2000-01-01')),
46             array(new \DateTime('2000-01-01'), new \DateTime('2020-01-01')),
47             array(new \DateTime('2000-01-01'), '2000-01-01'),
48             array(new \DateTime('2000-01-01'), '2020-01-01'),
49             array(new \DateTime('2000-01-01 UTC'), '2000-01-01 UTC'),
50             array(new \DateTime('2000-01-01 UTC'), '2020-01-01 UTC'),
51             array(new ComparisonTest_Class(4), new ComparisonTest_Class(5)),
52             array(new ComparisonTest_Class(5), new ComparisonTest_Class(5)),
53             array('a', 'a'),
54             array('a', 'z'),
55             array(null, 1),
56         );
57     }
58
59     /**
60      * {@inheritdoc}
61      */
62     public function provideValidComparisonsToPropertyPath()
63     {
64         return array(
65             array(4),
66             array(5),
67         );
68     }
69
70     /**
71      * {@inheritdoc}
72      */
73     public function provideInvalidComparisons()
74     {
75         return array(
76             array(2, '2', 1, '1', 'integer'),
77             array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', new \DateTime('2000-01-01'), 'Jan 1, 2000, 12:00 AM', 'DateTime'),
78             array(new \DateTime('2010-01-01'), 'Jan 1, 2010, 12:00 AM', '2000-01-01', 'Jan 1, 2000, 12:00 AM', 'DateTime'),
79             array(new \DateTime('2010-01-01 UTC'), 'Jan 1, 2010, 12:00 AM', '2000-01-01 UTC', 'Jan 1, 2000, 12:00 AM', 'DateTime'),
80             array(new ComparisonTest_Class(5), '5', new ComparisonTest_Class(4), '4', __NAMESPACE__.'\ComparisonTest_Class'),
81             array('c', '"c"', 'b', '"b"', 'string'),
82         );
83     }
84 }