prepare(); } public function test_visit_load_balancer_servers(): void { $this->actingAs($this->user); $this->get( View::getUrl([ 'server' => $this->server, 'site' => $this->site, ]) ) ->assertSuccessful() ->assertSee($this->site->domain) ->assertSee('Load Balancer Servers'); } public function test_update_load_balancer_servers() { SSH::fake(); $this->actingAs($this->user); $servers = Server::query()->where('id', '!=', $this->server->id)->get(); $this->assertEquals(2, $servers->count()); Livewire::test(LoadBalancerServers::class, [ 'site' => $this->site, ]) ->assertFormExists() ->fillForm([ 'method' => LoadBalancerMethod::ROUND_ROBIN, 'servers' => [ [ 'server' => $servers[0]->local_ip, 'port' => 80, 'weight' => 1, 'backup' => false, ], [ 'server' => $servers[1]->local_ip, 'port' => 80, 'weight' => 1, 'backup' => false, ], ], ]) ->call('save') ->assertSuccessful(); $this->assertDatabaseHas('load_balancer_servers', [ 'load_balancer_id' => $this->site->id, 'ip' => $servers[0]->local_ip, 'port' => 80, 'weight' => 1, 'backup' => false, ]); $this->assertDatabaseHas('load_balancer_servers', [ 'load_balancer_id' => $this->site->id, 'ip' => $servers[1]->local_ip, 'port' => 80, 'weight' => 1, 'backup' => false, ]); } }