You are here

class ConstraintViolationTest in Plug 7

Hierarchy

  • class \Symfony\Component\Validator\Tests\ConstraintViolationTest extends \Symfony\Component\Validator\Tests\PHPUnit_Framework_TestCase

Expanded class hierarchy of ConstraintViolationTest

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/ConstraintViolationTest.php, line 16

Namespace

Symfony\Component\Validator\Tests
View source
class ConstraintViolationTest extends \PHPUnit_Framework_TestCase {
  public function testToStringHandlesArrays() {
    $violation = new ConstraintViolation('Array', '{{ value }}', array(
      '{{ value }}' => array(
        1,
        2,
        3,
      ),
    ), 'Root', 'property.path', null);
    $expected = <<<EOF
Root.property.path:
    Array
EOF;
    $this
      ->assertSame($expected, (string) $violation);
  }
  public function testToStringHandlesArrayRoots() {
    $violation = new ConstraintViolation('42 cannot be used here', 'this is the message template', array(), array(
      'some_value' => 42,
    ), 'some_value', null);
    $expected = <<<EOF
Array.some_value:
    42 cannot be used here
EOF;
    $this
      ->assertSame($expected, (string) $violation);
  }

}

Members