4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Validator\Tests;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Validator\ConstraintViolation;
17 class ConstraintViolationTest extends TestCase
19 public function testToStringHandlesArrays()
21 $violation = new ConstraintViolation(
24 array('{{ value }}' => array(1, 2, 3)),
35 $this->assertSame($expected, (string) $violation);
38 public function testToStringHandlesArrayRoots()
40 $violation = new ConstraintViolation(
41 '42 cannot be used here',
42 'this is the message template',
44 array('some_value' => 42),
51 42 cannot be used here
54 $this->assertSame($expected, (string) $violation);