enable php extension installation (#68)

This commit is contained in:
Saeed Vaziry
2023-10-15 10:06:50 +02:00
committed by GitHub
parent f51d7900f0
commit 9d13cc0756
6 changed files with 115 additions and 5 deletions

View File

@ -7,6 +7,7 @@
use App\Http\Livewire\Php\InstalledVersions;
use App\Jobs\Installation\InstallPHP;
use App\Jobs\Installation\UninstallPHP;
use App\Jobs\PHP\InstallPHPExtension;
use App\Jobs\PHP\SetDefaultCli;
use App\Models\Service;
use Illuminate\Foundation\Testing\RefreshDatabase;
@ -68,4 +69,42 @@ public function test_change_default_php_cli(): void
Bus::assertDispatched(SetDefaultCli::class);
}
public function test_install_extension(): void
{
Bus::fake();
$this->actingAs($this->user);
Livewire::test(InstalledVersions::class, ['server' => $this->server])
->set('extensionId', $this->server->php('8.2')?->id)
->set('extension', 'gmp')
->call('installExtension')
->assertSuccessful();
Bus::assertDispatched(InstallPHPExtension::class);
}
public function test_extension_already_installed(): void
{
Bus::fake();
$this->actingAs($this->user);
$this->server->php('8.2')->update([
'type_data' => [
'extensions' => [
'gmp',
],
],
]);
Livewire::test(InstalledVersions::class, ['server' => $this->server])
->set('extensionId', $this->server->php('8.2')?->id)
->set('extension', 'gmp')
->call('installExtension')
->assertSuccessful();
Bus::assertNotDispatched(InstallPHPExtension::class);
}
}