mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
@ -3,6 +3,7 @@
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Enums\DatabaseStatus;
|
||||
use App\Enums\DatabaseUserStatus;
|
||||
use App\Facades\SSH;
|
||||
use App\Models\Database;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
@ -28,6 +29,34 @@ public function test_create_database(): void
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_create_database_with_user(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
SSH::fake();
|
||||
|
||||
$this->post(route('servers.databases.store', $this->server), [
|
||||
'name' => 'database',
|
||||
'user' => 'on',
|
||||
'username' => 'user',
|
||||
'password' => 'password',
|
||||
'remote' => 'on',
|
||||
'host' => '%',
|
||||
])->assertSessionDoesntHaveErrors();
|
||||
|
||||
$this->assertDatabaseHas('databases', [
|
||||
'name' => 'database',
|
||||
'status' => DatabaseStatus::READY,
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('database_users', [
|
||||
'username' => 'user',
|
||||
'databases' => json_encode(['database']),
|
||||
'host' => '%',
|
||||
'status' => DatabaseUserStatus::READY,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_see_databases_list(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
Reference in New Issue
Block a user