Skip to content

Commit 77ed2c7

Browse files
committed
fix test
1 parent 0e89f3e commit 77ed2c7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/Integration/Database/EloquentStrictLoadingTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Database\Eloquent\Model;
77
use Illuminate\Database\LazyLoadingViolationException;
88
use Illuminate\Database\Schema\Blueprint;
9+
use Illuminate\Support\Facades\Event;
910
use Illuminate\Support\Facades\Schema;
1011

1112
/**
@@ -115,7 +116,7 @@ public function testStrictModeThrowsAnExceptionOnLazyLoadingInRelations()
115116

116117
public function testStrictModeWithCustomCallbackOnLazyLoading()
117118
{
118-
$this->expectsEvents(ViolatedLazyLoadingEvent::class);
119+
Event::fake();
119120

120121
Model::handleLazyLoadingViolationUsing(function ($model, $key) {
121122
event(new ViolatedLazyLoadingEvent($model, $key));
@@ -127,6 +128,8 @@ public function testStrictModeWithCustomCallbackOnLazyLoading()
127128
$models = EloquentStrictLoadingTestModel1::get();
128129

129130
$models[0]->modelTwos;
131+
132+
Event::assertDispatched(ViolatedLazyLoadingEvent::class);
130133
}
131134

132135
public function testStrictModeWithOverriddenHandlerOnLazyLoading()

0 commit comments

Comments
 (0)