@@ -65,19 +65,16 @@ public function testOnFlush(): void
65
65
$ purgerProphecy ->purge (['/dummies ' , '/dummies/1 ' , '/dummies/2 ' , '/dummies/3 ' , '/dummies/4 ' ])->shouldBeCalled ();
66
66
67
67
$ iriConverterProphecy = $ this ->prophesize (IriConverterInterface::class);
68
- $ iriConverterProphecy ->getIriFromResource (Dummy::class, UrlGeneratorInterface::ABS_PATH , new GetCollection ())->willReturn ('/dummies ' )->shouldBeCalled ();
69
- $ iriConverterProphecy ->getIriFromResource (DummyNoGetOperation::class, UrlGeneratorInterface::ABS_PATH , new GetCollection ())->willThrow (new InvalidArgumentException ())->shouldBeCalled ();
68
+ $ iriConverterProphecy ->getIriFromResource (Argument::type (Dummy::class), UrlGeneratorInterface::ABS_PATH , new GetCollection ())->willReturn ('/dummies ' )->shouldBeCalled ();
70
69
$ iriConverterProphecy ->getIriFromResource ($ toUpdate1 )->willReturn ('/dummies/1 ' )->shouldBeCalled ();
71
70
$ iriConverterProphecy ->getIriFromResource ($ toUpdate2 )->willReturn ('/dummies/2 ' )->shouldBeCalled ();
72
71
$ iriConverterProphecy ->getIriFromResource ($ toDelete1 )->willReturn ('/dummies/3 ' )->shouldBeCalled ();
73
72
$ iriConverterProphecy ->getIriFromResource ($ toDelete2 )->willReturn ('/dummies/4 ' )->shouldBeCalled ();
74
- $ iriConverterProphecy ->getIriFromResource ($ toDeleteNoPurge )-> shouldNotBeCalled ();
73
+ $ iriConverterProphecy ->getIriFromResource (Argument:: type (DummyNoGetOperation::class), UrlGeneratorInterface:: ABS_PATH , new GetCollection ())-> willThrow ( new InvalidArgumentException ())-> shouldBeCalled ();
75
74
$ iriConverterProphecy ->getIriFromResource (Argument::any ())->willThrow (new ItemNotFoundException ());
76
75
77
76
$ resourceClassResolverProphecy = $ this ->prophesize (ResourceClassResolverInterface::class);
78
77
$ resourceClassResolverProphecy ->isResourceClass (Argument::type ('string ' ))->willReturn (true )->shouldBeCalled ();
79
- $ resourceClassResolverProphecy ->getResourceClass (Argument::type (Dummy::class))->willReturn (Dummy::class)->shouldBeCalled ();
80
- $ resourceClassResolverProphecy ->getResourceClass (Argument::type (DummyNoGetOperation::class))->willReturn (DummyNoGetOperation::class)->shouldBeCalled ();
81
78
82
79
$ uowProphecy = $ this ->prophesize (UnitOfWork::class);
83
80
$ uowProphecy ->getScheduledEntityInsertions ()->willReturn ([$ toInsert1 , $ toInsert2 ])->shouldBeCalled ();
@@ -122,14 +119,13 @@ public function testPreUpdate(): void
122
119
$ purgerProphecy ->purge (['/dummies ' , '/dummies/1 ' , '/related_dummies/old ' , '/related_dummies/new ' ])->shouldBeCalled ();
123
120
124
121
$ iriConverterProphecy = $ this ->prophesize (IriConverterInterface::class);
125
- $ iriConverterProphecy ->getIriFromResource (Dummy::class, UrlGeneratorInterface::ABS_PATH , new GetCollection ())->willReturn ('/dummies ' )->shouldBeCalled ();
122
+ $ iriConverterProphecy ->getIriFromResource (Argument:: type ( Dummy::class) , UrlGeneratorInterface::ABS_PATH , new GetCollection ())->willReturn ('/dummies ' )->shouldBeCalled ();
126
123
$ iriConverterProphecy ->getIriFromResource ($ dummy )->willReturn ('/dummies/1 ' )->shouldBeCalled ();
127
124
$ iriConverterProphecy ->getIriFromResource ($ oldRelatedDummy )->willReturn ('/related_dummies/old ' )->shouldBeCalled ();
128
125
$ iriConverterProphecy ->getIriFromResource ($ newRelatedDummy )->willReturn ('/related_dummies/new ' )->shouldBeCalled ();
129
126
130
127
$ resourceClassResolverProphecy = $ this ->prophesize (ResourceClassResolverInterface::class);
131
128
$ resourceClassResolverProphecy ->isResourceClass (Argument::type ('string ' ))->willReturn (true )->shouldBeCalled ();
132
- $ resourceClassResolverProphecy ->getResourceClass (Argument::type (Dummy::class))->willReturn (Dummy::class)->shouldBeCalled ();
133
129
134
130
$ emProphecy = $ this ->prophesize (EntityManagerInterface::class);
135
131
@@ -154,11 +150,11 @@ public function testNothingToPurge(): void
154
150
$ purgerProphecy ->purge ([])->shouldNotBeCalled ();
155
151
156
152
$ iriConverterProphecy = $ this ->prophesize (IriConverterInterface::class);
157
- $ iriConverterProphecy ->getIriFromResource (DummyNoGetOperation::class, UrlGeneratorInterface::ABS_PATH , new GetCollection ())->willThrow (new InvalidArgumentException ())->shouldBeCalled ();
153
+ $ iriConverterProphecy ->getIriFromResource (Argument:: type ( DummyNoGetOperation::class) , UrlGeneratorInterface::ABS_PATH , new GetCollection ())->willThrow (new InvalidArgumentException ())->shouldBeCalled ();
158
154
$ iriConverterProphecy ->getIriFromResource ($ dummyNoGetOperation )->shouldNotBeCalled ();
159
155
160
156
$ resourceClassResolverProphecy = $ this ->prophesize (ResourceClassResolverInterface::class);
161
- $ resourceClassResolverProphecy ->getResourceClass (Argument::type (DummyNoGetOperation::class))->willReturn (DummyNoGetOperation::class)->shouldBeCalled ();
157
+ $ resourceClassResolverProphecy ->getResourceClass (Argument::type (DummyNoGetOperation::class))->willReturn (DummyNoGetOperation::class)->shouldNotBeCalled ();
162
158
163
159
$ emProphecy = $ this ->prophesize (EntityManagerInterface::class);
164
160
@@ -182,12 +178,11 @@ public function testNotAResourceClass(): void
182
178
$ purgerProphecy ->purge ([])->shouldNotBeCalled ();
183
179
184
180
$ iriConverterProphecy = $ this ->prophesize (IriConverterInterface::class);
185
- $ iriConverterProphecy ->getIriFromResource (ContainNonResource::class, UrlGeneratorInterface::ABS_PATH , Argument:: any ())->willReturn ('/dummies/1 ' );
186
- $ iriConverterProphecy ->getIriFromResource ($ nonResource )->shouldNotBeCalled ();
181
+ $ iriConverterProphecy ->getIriFromResource (Argument:: type ( ContainNonResource::class) , UrlGeneratorInterface::ABS_PATH , new GetCollection ())->willReturn ('/dummies ' );
182
+ $ iriConverterProphecy ->getIriFromResource ($ nonResource )->willThrow ( new InvalidArgumentException ())-> shouldBeCalled ();
187
183
188
184
$ resourceClassResolverProphecy = $ this ->prophesize (ResourceClassResolverInterface::class);
189
- $ resourceClassResolverProphecy ->getResourceClass (Argument::type (ContainNonResource::class))->willReturn (ContainNonResource::class)->shouldBeCalled ();
190
- $ resourceClassResolverProphecy ->isResourceClass (NotAResource::class)->willReturn (false )->shouldBeCalled ();
185
+ $ resourceClassResolverProphecy ->isResourceClass (Argument::type ('string ' ))->willReturn (true )->shouldBeCalled ();
191
186
192
187
$ uowProphecy = $ this ->prophesize (UnitOfWork::class);
193
188
$ uowProphecy ->getScheduledEntityInsertions ()->willReturn ([$ containNonResource ])->shouldBeCalled ();
@@ -208,7 +203,7 @@ public function testNotAResourceClass(): void
208
203
209
204
$ propertyAccessorProphecy = $ this ->prophesize (PropertyAccessorInterface::class);
210
205
$ propertyAccessorProphecy ->isReadable (Argument::type (ContainNonResource::class), 'notAResource ' )->willReturn (true );
211
- $ propertyAccessorProphecy ->isReadable (Argument::type (ContainNonResource::class), 'collectionOfNotAResource ' )->shouldNotBeCalled ( );
206
+ $ propertyAccessorProphecy ->isReadable (Argument::type (ContainNonResource::class), 'collectionOfNotAResource ' )->willReturn ( false );
212
207
$ propertyAccessorProphecy ->getValue (Argument::type (ContainNonResource::class), 'notAResource ' )->shouldBeCalled ()->willReturn ($ nonResource );
213
208
$ propertyAccessorProphecy ->getValue (Argument::type (ContainNonResource::class), 'collectionOfNotAResource ' )->shouldNotBeCalled ();
214
209
0 commit comments