refactoring (#116)

- refactoring architecture
- fix incomplete ssh logs
- code editor for scripts in the app
- remove Jobs and SSHCommands
This commit is contained in:
Saeed Vaziry
2024-03-14 20:03:43 +01:00
committed by GitHub
parent cee4a70c3c
commit 428140b931
472 changed files with 24110 additions and 8159 deletions

View File

@ -6,10 +6,8 @@
use App\Enums\SiteType;
use App\Enums\SourceControl;
use App\Facades\SSH;
use App\Jobs\Site\CreateVHost;
use App\Models\Site;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Bus;
use Illuminate\Support\Facades\Http;
use Tests\TestCase;
@ -22,9 +20,12 @@ class SitesTest extends TestCase
*/
public function test_create_site(array $inputs): void
{
Bus::fake();
SSH::fake();
Http::fake();
Http::fake([
'https://api.github.com/repos/*' => Http::response([
], 201),
]);
$this->actingAs($this->user);
@ -39,11 +40,9 @@ public function test_create_site(array $inputs): void
'server' => $this->server,
]), $inputs)->assertSessionDoesntHaveErrors();
Bus::assertDispatched(CreateVHost::class);
$this->assertDatabaseHas('sites', [
'domain' => 'example.com',
'status' => SiteStatus::INSTALLING,
'status' => SiteStatus::READY,
]);
}
@ -64,7 +63,7 @@ public function test_see_sites_list(): void
public function test_delete_site(): void
{
Bus::fake();
SSH::fake();
$this->actingAs($this->user);
@ -77,15 +76,15 @@ public function test_delete_site(): void
'site' => $site,
]))->assertRedirect();
Bus::assertDispatched(\App\Jobs\Site\DeleteSite::class);
$site->refresh();
$this->assertEquals(SiteStatus::DELETING, $site->status);
$this->assertDatabaseMissing('sites', [
'id' => $site->id,
]);
}
public function test_change_php_version(): void
{
SSH::fake();
$this->actingAs($this->user);
$site = Site::factory()->create([
@ -117,7 +116,7 @@ public function test_update_v_host(): void
$this->get(route('servers.sites.settings.vhost', [
'server' => $this->server,
'site' => $site,
]))->assertSessionHasNoErrors();
]))->assertSessionDoesntHaveErrors();
}
public static function create_data(): array