File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,24 @@ public function testSupportedAcceptHeader()
121
121
$ this ->assertSame ('json ' , $ request ->getRequestFormat ());
122
122
}
123
123
124
+ public function testSupportedAcceptHeaderSymfonyBuiltInFormat ()
125
+ {
126
+ $ request = new Request ([], [], ['_api_resource_class ' => 'Foo ' ]);
127
+ $ request ->headers ->set ('Accept ' , 'application/json ' );
128
+
129
+ $ eventProphecy = $ this ->prophesize (GetResponseEvent::class);
130
+ $ eventProphecy ->getRequest ()->willReturn ($ request );
131
+ $ event = $ eventProphecy ->reveal ();
132
+
133
+ $ formatsProviderProphecy = $ this ->prophesize (FormatsProviderInterface::class);
134
+ $ formatsProviderProphecy ->getFormatsFromAttributes ([])->willReturn (['jsonld ' => ['application/ld+json ' , 'application/json ' ]]);
135
+
136
+ $ listener = new AddFormatListener (new Negotiator (), $ formatsProviderProphecy ->reveal ());
137
+ $ listener ->onKernelRequest ($ event );
138
+
139
+ $ this ->assertSame ('jsonld ' , $ request ->getRequestFormat ());
140
+ }
141
+
124
142
public function testAcceptAllHeader ()
125
143
{
126
144
$ request = new Request ([], [], ['_api_resource_class ' => 'Foo ' ]);
You can’t perform that action at this time.
0 commit comments