update php fpm ini (#258)

This commit is contained in:
Saeed Vaziry
2024-07-27 12:51:13 +02:00
committed by GitHub
parent 55269dbcde
commit 9473d198e1
9 changed files with 77 additions and 33 deletions

View File

@ -2,6 +2,7 @@
namespace Tests\Feature;
use App\Enums\PHPIniType;
use App\Enums\ServiceStatus;
use App\Facades\SSH;
use App\Models\Service;
@ -136,7 +137,10 @@ public function test_extension_already_installed(): void
]))->assertSessionHasErrors();
}
public function test_get_php_ini(): void
/**
* @dataProvider php_ini_data
*/
public function test_get_php_ini(string $version, string $type): void
{
SSH::fake('[PHP ini]');
@ -144,11 +148,15 @@ public function test_get_php_ini(): void
$this->get(route('servers.php.get-ini', [
'server' => $this->server,
'version' => '8.2',
'version' => $version,
'type' => $type,
]))->assertSessionHas('ini');
}
public function test_update_php_ini(): void
/**
* @dataProvider php_ini_data
*/
public function test_update_php_ini(string $version, string $type): void
{
SSH::fake();
@ -156,11 +164,20 @@ public function test_update_php_ini(): void
$this->post(route('servers.php.update-ini', [
'server' => $this->server,
'version' => '8.2',
'version' => $version,
'type' => $type,
'ini' => 'new ini',
]))
->assertSessionDoesntHaveErrors()
->assertSessionHas('toast.type', 'success')
->assertSessionHas('toast.message', 'PHP ini updated!');
->assertSessionHas('toast.message', __('PHP ini (:type) updated!', ['type' => $type]));
}
public static function php_ini_data(): array
{
return [
['8.2', PHPIniType::FPM],
['8.2', PHPIniType::CLI],
];
}
}