* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Tests\Constraints; use Symfony\Component\Validator\Constraints\IdenticalTo; use Symfony\Component\Validator\Constraints\IdenticalToValidator; /** * @author Daniel Holmes */ class IdenticalToValidatorTest extends AbstractComparisonValidatorTestCase { protected function createValidator() { return new IdenticalToValidator(); } protected function createConstraint(array $options = null) { return new IdenticalTo($options); } protected function getErrorCode() { return IdenticalTo::NOT_IDENTICAL_ERROR; } public function provideAllValidComparisons() { $this->setDefaultTimezone('UTC'); // Don't call addPhp5Dot5Comparisons() automatically, as it does // not take care of identical objects $comparisons = $this->provideValidComparisons(); $this->restoreDefaultTimezone(); return $comparisons; } /** * {@inheritdoc} */ public function provideValidComparisons() { $date = new \DateTime('2000-01-01'); $object = new ComparisonTest_Class(2); $comparisons = array( array(3, 3), array('a', 'a'), array($date, $date), array($object, $object), array(null, 1), ); $immutableDate = new \DateTimeImmutable('2000-01-01'); $comparisons[] = array($immutableDate, $immutableDate); return $comparisons; } /** * {@inheritdoc} */ public function provideValidComparisonsToPropertyPath() { return array( array(5), ); } /** * {@inheritdoc} */ public function provideInvalidComparisons() { return array( array(1, '1', 2, '2', 'integer'), array(2, '2', '2', '"2"', 'string'), array('22', '"22"', '333', '"333"', 'string'), array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', 'DateTime'), array(new \DateTime('2001-01-01'), 'Jan 1, 2001, 12:00 AM', new \DateTime('1999-01-01'), 'Jan 1, 1999, 12:00 AM', 'DateTime'), array(new ComparisonTest_Class(4), '4', new ComparisonTest_Class(5), '5', __NAMESPACE__.'\ComparisonTest_Class'), ); } } __halt_compiler();----SIGNATURE:----K/3wmcEZkA/Mu7sAtidqoED7Rg/Yo5ds9s2IOpU5AN4VJ6F9YyccDNx8nVKPMF5mwVbQLbUDoaB72CWyHA7MPfS3qp5Ud8DGZ5gFfKqdWt8zMOZb3p1s0jPDC70DCkZ7YA+nFOO1Vyyxg5rkntuxQuuCLUQAkWTimRdO2jMmW4RM5fFg4NUJjf3bW4LDYR3IDORJ2dNOCHTJNOEOSpT0ELLfJgGeBZ7THYrBqPjyaRlrq9DMjQyKcUivSQO7LlP6tfnwmttUiXnZNZxpQyhsWEUtH9aqt/ZEJc9OqFXA78DS7sWemgsETE/jQ5ugtKJJD2AgjP2+H/3amrDzVy7aQeXY+e9S21HHDa0HBN60rTkOCXbmGR+quDscdXcRYXdwr2fqh8bGMPcXZtxAK9TBK799AniUr4/NpjwdjphGLJ+a4eqZ9e6GvyGosp04/APYWuluTneDBGDPQ/YjdOy1fw8xTOPPXzSo3ohSPsdq5o7xA/e+xLndQaw7n31FBQur4Ty30be82yQ1iwsTbgkJ9YBR63HylpJp4qfUAjYH3T5zFJUL2uAUgNpPU3j0S50Lmu3oYeBWnMbdCbrLSHW5JquRHfzuuhzFxBvn2qnwtucRUp+0ASZADGkNtXdjERg3cFvd6Om8ei7vtV0agYnepzcEdAsnKe0l/UCKR8vP5Bc=----ATTACHMENT:----NTA2MDY0NjI3ODMxMDkwMiA3NTA5OTcxMTkzMTYzOTAxIDE0OTg0NzMzMjU2NDQwODk=