+ */
+class ConstraintViolationListNormalizerTest extends TestCase
+{
+ private $normalizer;
+
+ protected function setUp()
+ {
+ $this->normalizer = new ConstraintViolationListNormalizer();
+ }
+
+ public function testSupportsNormalization()
+ {
+ $this->assertTrue($this->normalizer->supportsNormalization(new ConstraintViolationList()));
+ $this->assertFalse($this->normalizer->supportsNormalization(new \stdClass()));
+ }
+
+ public function testNormalize()
+ {
+ $list = new ConstraintViolationList(array(
+ new ConstraintViolation('a', 'b', array(), 'c', 'd', 'e', null, 'f'),
+ new ConstraintViolation('1', '2', array(), '3', '4', '5', null, '6'),
+ ));
+
+ $expected = array(
+ 'title' => 'An error occurred',
+ 'detail' => 'd: a
+4: 1',
+ 'violations' => array(
+ array(
+ 'propertyPath' => 'd',
+ 'message' => 'a',
+ 'code' => 'f',
+ ),
+ array(
+ 'propertyPath' => '4',
+ 'message' => '1',
+ 'code' => '6',
+ ),
+ ),
+ );
+
+ $this->assertEquals($expected, $this->normalizer->normalize($list));
+ }
+}
diff --git a/src/Symfony/Component/Serializer/composer.json b/src/Symfony/Component/Serializer/composer.json
index 4de54606d928d..c950a39c3cb28 100644
--- a/src/Symfony/Component/Serializer/composer.json
+++ b/src/Symfony/Component/Serializer/composer.json
@@ -25,6 +25,7 @@
"symfony/http-foundation": "~3.4|~4.0",
"symfony/cache": "~3.4|~4.0",
"symfony/property-info": "~3.4|~4.0",
+ "symfony/validator": "~3.4|~4.0",
"doctrine/annotations": "~1.0",
"symfony/dependency-injection": "~3.4|~4.0",
"doctrine/cache": "~1.0",
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy