You are here

public function ConstraintViolationListTest::testToString in Plug 7

File

lib/Symfony/validator/Symfony/Component/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);
}