22
33class EmbeddedRelationsTest extends TestCase
44{
5- public function tearDown ()
5+ public function tearDown (): void
66 {
77 Mockery::close ();
88
@@ -21,11 +21,11 @@ public function testEmbedsManySave()
2121 $ address = new Address (['city ' => 'London ' ]);
2222
2323 $ address ->setEventDispatcher ($ events = Mockery::mock ('Illuminate\Events\Dispatcher ' ));
24- $ events ->shouldReceive ('fire ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
24+ $ events ->shouldReceive ('dispatch ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
2525 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.saving: ' . get_class ($ address ), $ address )->andReturn (true );
2626 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.creating: ' . get_class ($ address ), $ address )->andReturn (true );
27- $ events ->shouldReceive ('fire ' )->once ()->with ('eloquent.created: ' . get_class ($ address ), $ address );
28- $ events ->shouldReceive ('fire ' )->once ()->with ('eloquent.saved: ' . get_class ($ address ), $ address );
27+ $ events ->shouldReceive ('dispatch ' )->once ()->with ('eloquent.created: ' . get_class ($ address ), $ address );
28+ $ events ->shouldReceive ('dispatch ' )->once ()->with ('eloquent.saved: ' . get_class ($ address ), $ address );
2929
3030 $ address = $ user ->addresses ()->save ($ address );
3131 $ address ->unsetEventDispatcher ();
@@ -47,11 +47,11 @@ public function testEmbedsManySave()
4747 $ this ->assertEquals (['London ' , 'Paris ' ], $ user ->addresses ->pluck ('city ' )->all ());
4848
4949 $ address ->setEventDispatcher ($ events = Mockery::mock ('Illuminate\Events\Dispatcher ' ));
50- $ events ->shouldReceive ('fire ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
50+ $ events ->shouldReceive ('dispatch ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
5151 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.saving: ' . get_class ($ address ), $ address )->andReturn (true );
5252 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.updating: ' . get_class ($ address ), $ address )->andReturn (true );
53- $ events ->shouldReceive ('fire ' )->once ()->with ('eloquent.updated: ' . get_class ($ address ), $ address );
54- $ events ->shouldReceive ('fire ' )->once ()->with ('eloquent.saved: ' . get_class ($ address ), $ address );
53+ $ events ->shouldReceive ('dispatch ' )->once ()->with ('eloquent.updated: ' . get_class ($ address ), $ address );
54+ $ events ->shouldReceive ('dispatch ' )->once ()->with ('eloquent.saved: ' . get_class ($ address ), $ address );
5555
5656 $ address ->city = 'New York ' ;
5757 $ user ->addresses ()->save ($ address );
@@ -94,16 +94,16 @@ public function testEmbedsManySave()
9494 // $address->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
9595 // $events->shouldReceive('until')->once()->with('eloquent.saving: ' . get_class($address), $address)->andReturn(true);
9696 // $events->shouldReceive('until')->once()->with('eloquent.creating: ' . get_class($address), $address)->andReturn(true);
97- // $events->shouldReceive('fire ')->once()->with('eloquent.created: ' . get_class($address), $address);
98- // $events->shouldReceive('fire ')->once()->with('eloquent.saved: ' . get_class($address), $address);
97+ // $events->shouldReceive('dispatch ')->once()->with('eloquent.created: ' . get_class($address), $address);
98+ // $events->shouldReceive('dispatch ')->once()->with('eloquent.saved: ' . get_class($address), $address);
9999
100100 // $address->save();
101101
102102 // $address->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
103103 // $events->shouldReceive('until')->once()->with('eloquent.saving: ' . get_class($address), $address)->andReturn(true);
104104 // $events->shouldReceive('until')->once()->with('eloquent.updating: ' . get_class($address), $address)->andReturn(true);
105- // $events->shouldReceive('fire ')->once()->with('eloquent.updated: ' . get_class($address), $address);
106- // $events->shouldReceive('fire ')->once()->with('eloquent.saved: ' . get_class($address), $address);
105+ // $events->shouldReceive('dispatch ')->once()->with('eloquent.updated: ' . get_class($address), $address);
106+ // $events->shouldReceive('dispatch ')->once()->with('eloquent.saved: ' . get_class($address), $address);
107107
108108 // $address->city = 'Paris';
109109 // $address->save();
@@ -213,9 +213,9 @@ public function testEmbedsManyDestroy()
213213 $ address = $ user ->addresses ->first ();
214214
215215 $ address ->setEventDispatcher ($ events = Mockery::mock ('Illuminate\Events\Dispatcher ' ));
216- $ events ->shouldReceive ('fire ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
216+ $ events ->shouldReceive ('dispatch ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
217217 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.deleting: ' . get_class ($ address ), Mockery::type ('Address ' ))->andReturn (true );
218- $ events ->shouldReceive ('fire ' )->once ()->with ('eloquent.deleted: ' . get_class ($ address ), Mockery::type ('Address ' ));
218+ $ events ->shouldReceive ('dispatch ' )->once ()->with ('eloquent.deleted: ' . get_class ($ address ), Mockery::type ('Address ' ));
219219
220220 $ user ->addresses ()->destroy ($ address ->_id );
221221 $ this ->assertEquals (['Bristol ' , 'Bruxelles ' ], $ user ->addresses ->pluck ('city ' )->all ());
@@ -252,9 +252,9 @@ public function testEmbedsManyDelete()
252252 $ address = $ user ->addresses ->first ();
253253
254254 $ address ->setEventDispatcher ($ events = Mockery::mock ('Illuminate\Events\Dispatcher ' ));
255- $ events ->shouldReceive ('fire ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
255+ $ events ->shouldReceive ('dispatch ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
256256 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.deleting: ' . get_class ($ address ), Mockery::type ('Address ' ))->andReturn (true );
257- $ events ->shouldReceive ('fire ' )->once ()->with ('eloquent.deleted: ' . get_class ($ address ), Mockery::type ('Address ' ));
257+ $ events ->shouldReceive ('dispatch ' )->once ()->with ('eloquent.deleted: ' . get_class ($ address ), Mockery::type ('Address ' ));
258258
259259 $ address ->delete ();
260260
@@ -301,7 +301,7 @@ public function testEmbedsManyCreatingEventReturnsFalse()
301301 $ address = new Address (['city ' => 'London ' ]);
302302
303303 $ address ->setEventDispatcher ($ events = Mockery::mock ('Illuminate\Events\Dispatcher ' ));
304- $ events ->shouldReceive ('fire ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
304+ $ events ->shouldReceive ('dispatch ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
305305 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.saving: ' . get_class ($ address ), $ address )->andReturn (true );
306306 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.creating: ' . get_class ($ address ), $ address )->andReturn (false );
307307
@@ -316,7 +316,7 @@ public function testEmbedsManySavingEventReturnsFalse()
316316 $ address ->exists = true ;
317317
318318 $ address ->setEventDispatcher ($ events = Mockery::mock ('Illuminate\Events\Dispatcher ' ));
319- $ events ->shouldReceive ('fire ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
319+ $ events ->shouldReceive ('dispatch ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
320320 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.saving: ' . get_class ($ address ), $ address )->andReturn (false );
321321
322322 $ this ->assertFalse ($ user ->addresses ()->save ($ address ));
@@ -330,7 +330,7 @@ public function testEmbedsManyUpdatingEventReturnsFalse()
330330 $ user ->addresses ()->save ($ address );
331331
332332 $ address ->setEventDispatcher ($ events = Mockery::mock ('Illuminate\Events\Dispatcher ' ));
333- $ events ->shouldReceive ('fire ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
333+ $ events ->shouldReceive ('dispatch ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
334334 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.saving: ' . get_class ($ address ), $ address )->andReturn (true );
335335 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.updating: ' . get_class ($ address ), $ address )->andReturn (false );
336336
@@ -348,7 +348,7 @@ public function testEmbedsManyDeletingEventReturnsFalse()
348348 $ address = $ user ->addresses ->first ();
349349
350350 $ address ->setEventDispatcher ($ events = Mockery::mock ('Illuminate\Events\Dispatcher ' ));
351- $ events ->shouldReceive ('fire ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
351+ $ events ->shouldReceive ('dispatch ' )->with ('eloquent.retrieved: ' . get_class ($ address ), Mockery::any ());
352352 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.deleting: ' . get_class ($ address ), Mockery::mustBe ($ address ))->andReturn (false );
353353
354354 $ this ->assertEquals (0 , $ user ->addresses ()->destroy ($ address ));
@@ -452,11 +452,11 @@ public function testEmbedsOne()
452452 $ father = new User (['name ' => 'Mark Doe ' ]);
453453
454454 $ father ->setEventDispatcher ($ events = Mockery::mock ('Illuminate\Events\Dispatcher ' ));
455- $ events ->shouldReceive ('fire ' )->with ('eloquent.retrieved: ' . get_class ($ father ), Mockery::any ());
455+ $ events ->shouldReceive ('dispatch ' )->with ('eloquent.retrieved: ' . get_class ($ father ), Mockery::any ());
456456 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.saving: ' . get_class ($ father ), $ father )->andReturn (true );
457457 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.creating: ' . get_class ($ father ), $ father )->andReturn (true );
458- $ events ->shouldReceive ('fire ' )->once ()->with ('eloquent.created: ' . get_class ($ father ), $ father );
459- $ events ->shouldReceive ('fire ' )->once ()->with ('eloquent.saved: ' . get_class ($ father ), $ father );
458+ $ events ->shouldReceive ('dispatch ' )->once ()->with ('eloquent.created: ' . get_class ($ father ), $ father );
459+ $ events ->shouldReceive ('dispatch ' )->once ()->with ('eloquent.saved: ' . get_class ($ father ), $ father );
460460
461461 $ father = $ user ->father ()->save ($ father );
462462 $ father ->unsetEventDispatcher ();
@@ -472,11 +472,11 @@ public function testEmbedsOne()
472472 $ this ->assertInstanceOf ('MongoDB\BSON\ObjectID ' , $ raw ['_id ' ]);
473473
474474 $ father ->setEventDispatcher ($ events = Mockery::mock ('Illuminate\Events\Dispatcher ' ));
475- $ events ->shouldReceive ('fire ' )->with ('eloquent.retrieved: ' . get_class ($ father ), Mockery::any ());
475+ $ events ->shouldReceive ('dispatch ' )->with ('eloquent.retrieved: ' . get_class ($ father ), Mockery::any ());
476476 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.saving: ' . get_class ($ father ), $ father )->andReturn (true );
477477 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.updating: ' . get_class ($ father ), $ father )->andReturn (true );
478- $ events ->shouldReceive ('fire ' )->once ()->with ('eloquent.updated: ' . get_class ($ father ), $ father );
479- $ events ->shouldReceive ('fire ' )->once ()->with ('eloquent.saved: ' . get_class ($ father ), $ father );
478+ $ events ->shouldReceive ('dispatch ' )->once ()->with ('eloquent.updated: ' . get_class ($ father ), $ father );
479+ $ events ->shouldReceive ('dispatch ' )->once ()->with ('eloquent.saved: ' . get_class ($ father ), $ father );
480480
481481 $ father ->name = 'Tom Doe ' ;
482482 $ user ->father ()->save ($ father );
@@ -488,11 +488,11 @@ public function testEmbedsOne()
488488 $ father = new User (['name ' => 'Jim Doe ' ]);
489489
490490 $ father ->setEventDispatcher ($ events = Mockery::mock ('Illuminate\Events\Dispatcher ' ));
491- $ events ->shouldReceive ('fire ' )->with ('eloquent.retrieved: ' . get_class ($ father ), Mockery::any ());
491+ $ events ->shouldReceive ('dispatch ' )->with ('eloquent.retrieved: ' . get_class ($ father ), Mockery::any ());
492492 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.saving: ' . get_class ($ father ), $ father )->andReturn (true );
493493 $ events ->shouldReceive ('until ' )->once ()->with ('eloquent.creating: ' . get_class ($ father ), $ father )->andReturn (true );
494- $ events ->shouldReceive ('fire ' )->once ()->with ('eloquent.created: ' . get_class ($ father ), $ father );
495- $ events ->shouldReceive ('fire ' )->once ()->with ('eloquent.saved: ' . get_class ($ father ), $ father );
494+ $ events ->shouldReceive ('dispatch ' )->once ()->with ('eloquent.created: ' . get_class ($ father ), $ father );
495+ $ events ->shouldReceive ('dispatch ' )->once ()->with ('eloquent.saved: ' . get_class ($ father ), $ father );
496496
497497 $ father = $ user ->father ()->save ($ father );
498498 $ father ->unsetEventDispatcher ();
@@ -507,7 +507,7 @@ public function testEmbedsOneAssociate()
507507 $ father = new User (['name ' => 'Mark Doe ' ]);
508508
509509 $ father ->setEventDispatcher ($ events = Mockery::mock ('Illuminate\Events\Dispatcher ' ));
510- $ events ->shouldReceive ('fire ' )->with ('eloquent.retrieved: ' . get_class ($ father ), Mockery::any ());
510+ $ events ->shouldReceive ('dispatch ' )->with ('eloquent.retrieved: ' . get_class ($ father ), Mockery::any ());
511511 $ events ->shouldReceive ('until ' )->times (0 )->with ('eloquent.saving: ' . get_class ($ father ), $ father );
512512
513513 $ father = $ user ->father ()->associate ($ father );
0 commit comments