AllTest.php 979 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Validator\Tests\Constraints;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\Validator\Constraints\All;
  13. use Symfony\Component\Validator\Constraints\Valid;
  14. /**
  15. * @author Bernhard Schussek <bschussek@gmail.com>
  16. */
  17. class AllTest extends TestCase
  18. {
  19. /**
  20. * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
  21. */
  22. public function testRejectNonConstraints()
  23. {
  24. new All(array(
  25. 'foo',
  26. ));
  27. }
  28. /**
  29. * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
  30. */
  31. public function testRejectValidConstraint()
  32. {
  33. new All(array(
  34. new Valid(),
  35. ));
  36. }
  37. }