@@ -80,6 +80,38 @@ public function testCreate200Response()
80
80
$ this ->assertEquals ('deny ' , $ response ->headers ->get ('X-Frame-Options ' ));
81
81
}
82
82
83
+ public function testPostCreate200Response ()
84
+ {
85
+ $ kernelProphecy = $ this ->prophesize (HttpKernelInterface::class);
86
+
87
+ $ request = new Request ([], [], ['_api_respond ' => true , '_api_write_item_iri ' => '/dummy_entities/1 ' , '_api_item_operation_name ' => 'post ' ]);
88
+ $ request ->setMethod ('POST ' );
89
+ $ request ->setRequestFormat ('xml ' );
90
+
91
+ $ event = new ViewEvent (
92
+ $ kernelProphecy ->reveal (),
93
+ $ request ,
94
+ HttpKernelInterface::MASTER_REQUEST ,
95
+ 'foo '
96
+ );
97
+
98
+ $ resourceMetadataFactoryProphecy = $ this ->prophesize (ResourceMetadataFactoryInterface::class);
99
+ $ resourceMetadataFactoryProphecy ->create (Dummy::class)->willReturn (new ResourceMetadata (null , null , null , ['post ' => ['status ' => Response::HTTP_OK ]]));
100
+
101
+ $ listener = new RespondListener ($ resourceMetadataFactoryProphecy ->reveal ());
102
+ $ listener ->onKernelView ($ event );
103
+
104
+ $ response = $ event ->getResponse ();
105
+ $ this ->assertEquals ('foo ' , $ response ->getContent ());
106
+ $ this ->assertEquals (Response::HTTP_OK , $ response ->getStatusCode ());
107
+ $ this ->assertEquals ('text/xml; charset=utf-8 ' , $ response ->headers ->get ('Content-Type ' ));
108
+ $ this ->assertEquals ('Accept ' , $ response ->headers ->get ('Vary ' ));
109
+ $ this ->assertEquals ('nosniff ' , $ response ->headers ->get ('X-Content-Type-Options ' ));
110
+ $ this ->assertEquals ('deny ' , $ response ->headers ->get ('X-Frame-Options ' ));
111
+ $ this ->assertFalse ($ response ->headers ->has ('Location ' ));
112
+ $ this ->assertEquals ('/dummy_entities/1 ' , $ response ->headers ->get ('Content-Location ' ));
113
+ }
114
+
83
115
public function testCreate201Response ()
84
116
{
85
117
$ kernelProphecy = $ this ->prophesize (HttpKernelInterface::class);
0 commit comments