actingAs(User::factory()->create()); $asset = Asset::factory()->create(); $this->expectException(MissingLogTarget::class); $asset->logCheckout('some note', null); } public function test_log_checkout_throws_missing_log_target_when_target_has_no_id() { $this->actingAs(User::factory()->create()); $asset = Asset::factory()->create(); // Fresh, unsaved model: a real object but its id is null, so the // shape check should refuse to log against it. $badTarget = new User; $this->expectException(MissingLogTarget::class); $asset->logCheckout('some note', $badTarget); } }