4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Validator\Tests\Constraints;
14 use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
15 use Symfony\Component\Validator\Constraints\GreaterThanOrEqualValidator;
18 * @author Daniel Holmes <daniel@danielholmes.org>
20 class GreaterThanOrEqualValidatorTest extends AbstractComparisonValidatorTestCase
22 protected function createValidator()
24 return new GreaterThanOrEqualValidator();
27 protected function createConstraint(array $options = null)
29 return new GreaterThanOrEqual($options);
32 protected function getErrorCode()
34 return GreaterThanOrEqual::TOO_LOW_ERROR;
40 public function provideValidComparisons()
45 array(new \DateTime('2010/01/01'), new \DateTime('2000/01/01')),
46 array(new \DateTime('2000/01/01'), new \DateTime('2000/01/01')),
47 array(new \DateTime('2010/01/01'), '2000/01/01'),
48 array(new \DateTime('2000/01/01'), '2000/01/01'),
49 array(new \DateTime('2010/01/01 UTC'), '2000/01/01 UTC'),
50 array(new \DateTime('2000/01/01 UTC'), '2000/01/01 UTC'),
60 public function provideValidComparisonsToPropertyPath()
71 public function provideInvalidComparisons()
74 array(1, '1', 2, '2', 'integer'),
75 array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', new \DateTime('2005/01/01'), 'Jan 1, 2005, 12:00 AM', 'DateTime'),
76 array(new \DateTime('2000/01/01'), 'Jan 1, 2000, 12:00 AM', '2005/01/01', 'Jan 1, 2005, 12:00 AM', 'DateTime'),
77 array(new \DateTime('2000/01/01 UTC'), 'Jan 1, 2000, 12:00 AM', '2005/01/01 UTC', 'Jan 1, 2005, 12:00 AM', 'DateTime'),
78 array('b', '"b"', 'c', '"c"', 'string'),