'azerothcore_auth', 'moonwell.launcher.realm_status_cache' => 0, 'moonwell.launcher.realm_status_host' => null, 'database.connections.azerothcore_auth' => [ 'driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '', ], ]); DB::purge('azerothcore_auth'); Schema::connection('azerothcore_auth')->create('realmlist', function (Blueprint $table): void { $table->unsignedInteger('id')->primary(); $table->string('name'); $table->string('address'); $table->unsignedInteger('port'); $table->unsignedInteger('icon')->default(0); $table->unsignedInteger('flag')->default(0); $table->unsignedInteger('timezone')->default(0); $table->float('population')->default(0); $table->unsignedInteger('gamebuild')->default(12340); }); } public function test_launcher_can_get_realms_and_their_status_without_authentication(): void { DB::connection('azerothcore_auth')->table('realmlist')->insert([ [ 'id' => 1, 'name' => 'MoonWell', 'address' => 'realm.moon-well.online', 'port' => 8085, 'icon' => 1, 'flag' => 0, 'timezone' => 4, 'population' => 0.5, 'gamebuild' => 12340, ], [ 'id' => 2, 'name' => 'MoonWell PTR', 'address' => 'ptr.moon-well.online', 'port' => 8085, 'icon' => 1, 'flag' => 0, 'timezone' => 4, 'population' => 0, 'gamebuild' => 12340, ], ]); $this->mock(RealmStatusProbe::class, function (MockInterface $mock): void { $mock->shouldReceive('isOnline') ->once() ->with('realm.moon-well.online', 8085) ->andReturnTrue(); $mock->shouldReceive('isOnline') ->once() ->with('ptr.moon-well.online', 8085) ->andReturnFalse(); }); $this->getJson('/api/launcher/realms') ->assertOk() ->assertJsonPath('data.0.name', 'MoonWell') ->assertJsonPath('data.0.online', true) ->assertJsonPath('data.0.status', 'online') ->assertJsonPath('data.1.status', 'offline') ->assertJsonStructure(['data', 'checked_at']); } }