21
21
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \ConcreteDummy ;
22
22
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \Dummy ;
23
23
use PHPUnit \Framework \TestCase ;
24
+ use Prophecy \Argument ;
24
25
use Symfony \Component \HttpFoundation \Request ;
25
26
use Symfony \Component \HttpKernel \Event \GetResponseForControllerResultEvent ;
26
27
use Symfony \Component \HttpKernel \HttpKernelInterface ;
@@ -36,7 +37,7 @@ public function testOnKernelViewWithControllerResultAndPersist()
36
37
$ dummy ->setName ('Dummyrino ' );
37
38
38
39
$ dataPersisterProphecy = $ this ->prophesize (DataPersisterInterface::class);
39
- $ dataPersisterProphecy ->supports ($ dummy )->willReturn (true )->shouldBeCalled ();
40
+ $ dataPersisterProphecy ->supports ($ dummy, Argument:: type ( ' array ' ) )->willReturn (true )->shouldBeCalled ();
40
41
$ dataPersisterProphecy ->persist ($ dummy )->willReturn ($ dummy )->shouldBeCalled ();
41
42
42
43
$ iriConverterProphecy = $ this ->prophesize (IriConverterInterface::class);
@@ -71,7 +72,7 @@ public function testOnKernelViewWithControllerResultAndPersistReturningVoid()
71
72
$ dummy ->setName ('Dummyrino ' );
72
73
73
74
$ dataPersisterProphecy = $ this ->prophesize (DataPersisterInterface::class);
74
- $ dataPersisterProphecy ->supports ($ dummy )->willReturn (true )->shouldBeCalled ();
75
+ $ dataPersisterProphecy ->supports ($ dummy, Argument:: type ( ' array ' ) )->willReturn (true )->shouldBeCalled ();
75
76
$ dataPersisterProphecy ->persist ($ dummy )->shouldBeCalled ();
76
77
77
78
$ request = new Request ([], [], ['_api_resource_class ' => Dummy::class]);
@@ -104,7 +105,7 @@ public function testOnKernelViewWithControllerResultAndPersistWithImmutableResou
104
105
$ dummy2 ->setName ('Dummyferoce ' );
105
106
106
107
$ dataPersisterProphecy = $ this ->prophesize (DataPersisterInterface::class);
107
- $ dataPersisterProphecy ->supports ($ dummy )->willReturn (true )->shouldBeCalled ();
108
+ $ dataPersisterProphecy ->supports ($ dummy, Argument:: type ( ' array ' ) )->willReturn (true )->shouldBeCalled ();
108
109
109
110
$ iriConverterProphecy = $ this ->prophesize (IriConverterInterface::class);
110
111
$ iriConverterProphecy ->getIriFromItem ($ dummy )->willReturn ('/dummy/1 ' )->shouldBeCalled ();
@@ -141,7 +142,7 @@ public function testOnKernelViewDoNotCallIriConverterWhenOutputClassDisabled()
141
142
$ dummy ->setName ('Dummyrino ' );
142
143
143
144
$ dataPersisterProphecy = $ this ->prophesize (DataPersisterInterface::class);
144
- $ dataPersisterProphecy ->supports ($ dummy )->willReturn (true )->shouldBeCalled ();
145
+ $ dataPersisterProphecy ->supports ($ dummy, Argument:: type ( ' array ' ) )->willReturn (true )->shouldBeCalled ();
145
146
146
147
$ iriConverterProphecy = $ this ->prophesize (IriConverterInterface::class);
147
148
$ iriConverterProphecy ->getIriFromItem ($ dummy )->shouldNotBeCalled ();
@@ -170,7 +171,7 @@ public function testOnKernelViewWithControllerResultAndRemove()
170
171
$ dummy ->setName ('Dummyrino ' );
171
172
172
173
$ dataPersisterProphecy = $ this ->prophesize (DataPersisterInterface::class);
173
- $ dataPersisterProphecy ->supports ($ dummy )->willReturn (true )->shouldBeCalled ();
174
+ $ dataPersisterProphecy ->supports ($ dummy, Argument:: type ( ' array ' ) )->willReturn (true )->shouldBeCalled ();
174
175
$ dataPersisterProphecy ->remove ($ dummy )->shouldBeCalled ();
175
176
176
177
$ iriConverterProphecy = $ this ->prophesize (IriConverterInterface::class);
@@ -195,7 +196,7 @@ public function testOnKernelViewWithSafeMethod()
195
196
$ dummy ->setName ('Dummyrino ' );
196
197
197
198
$ dataPersisterProphecy = $ this ->prophesize (DataPersisterInterface::class);
198
- $ dataPersisterProphecy ->supports ($ dummy )->shouldNotBeCalled ();
199
+ $ dataPersisterProphecy ->supports ($ dummy, Argument:: type ( ' array ' ) )->shouldNotBeCalled ();
199
200
$ dataPersisterProphecy ->persist ($ dummy )->shouldNotBeCalled ();
200
201
$ dataPersisterProphecy ->remove ($ dummy )->shouldNotBeCalled ();
201
202
@@ -221,7 +222,7 @@ public function testOnKernelViewWithPersistFlagOff()
221
222
$ dummy ->setName ('Dummyrino ' );
222
223
223
224
$ dataPersisterProphecy = $ this ->prophesize (DataPersisterInterface::class);
224
- $ dataPersisterProphecy ->supports ($ dummy )->shouldNotBeCalled ();
225
+ $ dataPersisterProphecy ->supports ($ dummy, Argument:: type ( ' array ' ) )->shouldNotBeCalled ();
225
226
$ dataPersisterProphecy ->persist ($ dummy )->shouldNotBeCalled ();
226
227
$ dataPersisterProphecy ->remove ($ dummy )->shouldNotBeCalled ();
227
228
@@ -247,7 +248,7 @@ public function testOnKernelViewWithNoResourceClass()
247
248
$ dummy ->setName ('Dummyrino ' );
248
249
249
250
$ dataPersisterProphecy = $ this ->prophesize (DataPersisterInterface::class);
250
- $ dataPersisterProphecy ->supports ($ dummy )->shouldNotBeCalled ();
251
+ $ dataPersisterProphecy ->supports ($ dummy, Argument:: type ( ' array ' ) )->shouldNotBeCalled ();
251
252
$ dataPersisterProphecy ->persist ($ dummy )->shouldNotBeCalled ();
252
253
$ dataPersisterProphecy ->remove ($ dummy )->shouldNotBeCalled ();
253
254
@@ -272,7 +273,7 @@ public function testOnKernelViewWithParentResourceClass()
272
273
$ dummy = new ConcreteDummy ();
273
274
274
275
$ dataPersisterProphecy = $ this ->prophesize (DataPersisterInterface::class);
275
- $ dataPersisterProphecy ->supports ($ dummy )->willReturn (true )->shouldBeCalled ();
276
+ $ dataPersisterProphecy ->supports ($ dummy, Argument:: type ( ' array ' ) )->willReturn (true )->shouldBeCalled ();
276
277
$ dataPersisterProphecy ->persist ($ dummy )->willReturn ($ dummy )->shouldBeCalled ();
277
278
278
279
$ iriConverterProphecy = $ this ->prophesize (IriConverterInterface::class);
@@ -297,7 +298,7 @@ public function testOnKernelViewWithNoDataPersisterSupport()
297
298
$ dummy ->setName ('Dummyrino ' );
298
299
299
300
$ dataPersisterProphecy = $ this ->prophesize (DataPersisterInterface::class);
300
- $ dataPersisterProphecy ->supports ($ dummy )->willReturn (false )->shouldBeCalled ();
301
+ $ dataPersisterProphecy ->supports ($ dummy, Argument:: type ( ' array ' ) )->willReturn (false )->shouldBeCalled ();
301
302
$ dataPersisterProphecy ->persist ($ dummy )->shouldNotBeCalled ();
302
303
$ dataPersisterProphecy ->remove ($ dummy )->shouldNotBeCalled ();
303
304
0 commit comments