phpmyadmin (#66)

* add phpmyadmin

* add tests
This commit is contained in:
Saeed Vaziry
2023-10-10 17:15:58 +02:00
committed by GitHub
parent 7c5505be16
commit 4bd4b34d24
12 changed files with 230 additions and 30 deletions

View File

@ -3,8 +3,12 @@
namespace Tests\Feature\Http;
use App\Enums\ServiceStatus;
use App\Http\Livewire\Services\InstallPHPMyAdmin;
use App\Http\Livewire\Services\ServicesList;
use App\Jobs\Installation\InstallPHPMyAdmin as InstallationInstallPHPMyAdmin;
use App\Jobs\Installation\UninstallPHPMyAdmin;
use App\Jobs\Service\Manage;
use App\Models\Service;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Bus;
use Livewire\Livewire;
@ -80,6 +84,45 @@ public function test_start_service(string $name): void
Bus::assertDispatched(Manage::class);
}
public function test_install_phpmyadmin(): void
{
Bus::fake();
Livewire::test(InstallPHPMyAdmin::class, ['server' => $this->server])
->set('allowed_ip', '0.0.0.0')
->set('port', 5433)
->call('install')
->assertSuccessful();
Bus::assertDispatched(InstallationInstallPHPMyAdmin::class);
}
public function test_uninstall_phpmyadmin(): void
{
$service = Service::factory()->create([
'server_id' => $this->server->id,
'type' => 'phpmyadmin',
'type_data' => [
'allowed_ip' => '0.0.0.0',
'port' => '5433',
'php' => '8.1',
],
'name' => 'phpmyadmin',
'version' => '5.1.2',
'status' => ServiceStatus::READY,
'is_default' => 1,
]);
Bus::fake();
Livewire::test(ServicesList::class, ['server' => $this->server])
->call('uninstall', $service->id)
->assertSuccessful();
Bus::assertDispatched(UninstallPHPMyAdmin::class);
}
public static function data(): array
{
return [