@@ 51-74 (lines=24) @@ | ||
48 | ); |
|
49 | } |
|
50 | ||
51 | public function testGh236() |
|
52 | { |
|
53 | $data = new CollectionRepresentation([new Gh236Foo()]); |
|
54 | ||
55 | $hateoas = HateoasBuilder::create() |
|
56 | ->setXmlSerializer(new XmlHalSerializer()) |
|
57 | ->build(); |
|
58 | ||
59 | $this->assertSame( |
|
60 | <<<XML |
|
61 | <?xml version="1.0" encoding="UTF-8"?> |
|
62 | <collection> |
|
63 | <resource rel="items"> |
|
64 | <a> |
|
65 | <xxx><![CDATA[yyy]]></xxx> |
|
66 | </a> |
|
67 | <resource rel="b_embed"> |
|
68 | <xxx><![CDATA[zzz]]></xxx> |
|
69 | </resource> |
|
70 | </resource> |
|
71 | </collection> |
|
72 | ||
73 | XML |
|
74 | , |
|
75 | $hateoas->serialize($data, 'xml', SerializationContext::create()->enableMaxDepthChecks()) |
|
76 | ); |
|
77 | } |
@@ 120-143 (lines=24) @@ | ||
117 | ); |
|
118 | } |
|
119 | ||
120 | public function testGh236() |
|
121 | { |
|
122 | $data = new CollectionRepresentation([new Gh236Foo()]); |
|
123 | ||
124 | $hateoas = HateoasBuilder::buildHateoas(); |
|
125 | ||
126 | $this->assertSame( |
|
127 | <<<XML |
|
128 | <?xml version="1.0" encoding="UTF-8"?> |
|
129 | <collection> |
|
130 | <entry rel="items"> |
|
131 | <entry> |
|
132 | <a> |
|
133 | <xxx><![CDATA[yyy]]></xxx> |
|
134 | </a> |
|
135 | <entry rel="b_embed"> |
|
136 | <xxx><![CDATA[zzz]]></xxx> |
|
137 | </entry> |
|
138 | </entry> |
|
139 | </entry> |
|
140 | </collection> |
|
141 | ||
142 | XML |
|
143 | , |
|
144 | $hateoas->serialize($data, 'xml', SerializationContext::create()->enableMaxDepthChecks()) |
|
145 | ); |
|
146 | } |
@@ 280-305 (lines=26) @@ | ||
277 | ); |
|
278 | } |
|
279 | ||
280 | public function testGh236() |
|
281 | { |
|
282 | $data = new CollectionRepresentation([new Gh236Foo()]); |
|
283 | ||
284 | $hateoas = HateoasBuilder::buildHateoas(); |
|
285 | ||
286 | $this->assertSame( |
|
287 | <<<JSON |
|
288 | { |
|
289 | "_embedded": { |
|
290 | "items": [ |
|
291 | { |
|
292 | "a": { |
|
293 | "xxx": "yyy" |
|
294 | }, |
|
295 | "_embedded": { |
|
296 | "b_embed": { |
|
297 | "xxx": "zzz" |
|
298 | } |
|
299 | } |
|
300 | } |
|
301 | ] |
|
302 | } |
|
303 | } |
|
304 | JSON |
|
305 | , |
|
306 | $this->json( |
|
307 | $hateoas->serialize($data, 'json', SerializationContext::create()->enableMaxDepthChecks()) |
|
308 | ) |