You are here

public function ConstraintViolationListTest::testToString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Tests/ConstraintViolationListTest.php \Symfony\Component\Validator\Tests\ConstraintViolationListTest::testToString()

File

vendor/symfony/validator/Tests/ConstraintViolationListTest.php, line 103

Class

ConstraintViolationListTest

Namespace

Symfony\Component\Validator\Tests

Code

public function testToString() {
  $this->list = new ConstraintViolationList(array(
    $this
      ->getViolation('Error 1', 'Root'),
    $this
      ->getViolation('Error 2', 'Root', 'foo.bar'),
    $this
      ->getViolation('Error 3', 'Root', '[baz]'),
    $this
      ->getViolation('Error 4', '', 'foo.bar'),
    $this
      ->getViolation('Error 5', '', '[baz]'),
  ));
  $expected = <<<EOF
Root:
    Error 1
Root.foo.bar:
    Error 2
Root[baz]:
    Error 3
foo.bar:
    Error 4
[baz]:
    Error 5

EOF;
  $this
    ->assertEquals($expected, (string) $this->list);
}