make(Kernel::class)->bootstrap(); $app->id = 0; app()->bind('nextId', fn() => $this->nextId()); app()->instance(SettingServiceProvider::class, null); app()->register(FakeSettingServiceProvider::class); return $app; } private function nextId(): int { $id = $this->app->id; $id++; $this->app->id = $id; return $id; } } class FakeSettingServiceProvider extends ServiceProvider { function boot() { $this->app->bind('settings', function() { return json_decode(file_get_contents(base_path('settings.json')), true); }); } }