create(); $token = CloudProviderToken::factory()->create([ 'team_id' => $team->id, 'provider' => 'hostinger', 'token' => 'hostinger-token', ]); $privateKey = PrivateKey::factory()->create(['team_id' => $team->id]); $server = Server::factory()->create([ 'team_id' => $team->id, 'private_key_id' => $privateKey->id, 'cloud_provider_token_id' => $token->id, 'hostinger_virtual_machine_id' => 17923, 'hostinger_virtual_machine_status' => 'creating', 'ip' => '0.0.0.0', ]); Http::fake([ 'https://developers.hostinger.com/api/vps/v1/virtual-machines/17923' => Http::response([ 'id' => 17923, 'state' => 'running', 'ipv4' => [['address' => '203.0.113.10']], ]), ]); expect($server->refreshHostingerState())->toBe('running') ->and($server->fresh()->hostinger_virtual_machine_status)->toBe('running') ->and($server->fresh()->ip)->toBe('203.0.113.10'); });