File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
src/Symfony/Bundle/FrameworkBundle Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 124
124
service ('property_info ' )->ignoreOnInvalid (),
125
125
service ('serializer.mapping.class_discriminator_resolver ' )->ignoreOnInvalid (),
126
126
null ,
127
- [],
128
127
])
129
128
->tag ('serializer.normalizer ' , ['priority ' => -1000 ])
130
129
Original file line number Diff line number Diff line change @@ -32,6 +32,22 @@ public function testDeserializeArrayOfObject()
32
32
33
33
$ this ->assertEquals ($ expected , $ result );
34
34
}
35
+
36
+ public function testObjectNormalizerUsesDefaultContextConfigOption ()
37
+ {
38
+ static ::bootKernel (['test_case ' => 'Serializer ' ]);
39
+
40
+ $ serializer = static ::getContainer ()->get ('serializer.normalizer.object.alias ' );
41
+
42
+ $ reflectionObject = new \ReflectionObject ($ serializer );
43
+ $ property = $ reflectionObject ->getProperty ('defaultContext ' );
44
+ $ property ->setAccessible (true );
45
+
46
+ $ defaultContext = $ property ->getValue ($ serializer );
47
+
48
+ self ::assertArrayHasKey ('fake_context_option ' , $ defaultContext );
49
+ self ::assertEquals ('foo ' , $ defaultContext ['fake_context_option ' ]);
50
+ }
35
51
}
36
52
37
53
class Foo
Original file line number Diff line number Diff line change @@ -6,9 +6,16 @@ framework:
6
6
enabled : true
7
7
default_context :
8
8
enable_max_depth : true
9
+ # The option below is used in \Symfony\Bundle\FrameworkBundle\Tests\Functional\SerializerTest::testObjectNormalizerUsesDefaultContextConfigOption
10
+ # to assert that the `default_context` is taken into account in serializers
11
+ fake_context_option : foo
9
12
property_info : { enabled: true }
10
13
11
14
services :
12
15
serializer.alias :
13
16
alias : serializer
14
17
public : true
18
+
19
+ serializer.normalizer.object.alias :
20
+ alias : serializer.normalizer.object
21
+ public : true
You can’t perform that action at this time.
0 commit comments