mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-03 06:56:15 +00:00
#591 - tests
This commit is contained in:
@ -13,7 +13,7 @@ class CronjobTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_see_cronjobs_list()
|
||||
public function test_see_cronjobs_list(): void
|
||||
{
|
||||
Sanctum::actingAs($this->user, ['read', 'write']);
|
||||
|
||||
@ -33,7 +33,7 @@ public function test_see_cronjobs_list()
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_create_cronjob()
|
||||
public function test_create_cronjob(): void
|
||||
{
|
||||
SSH::fake();
|
||||
|
||||
@ -56,7 +56,7 @@ public function test_create_cronjob()
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_delete_cronjob()
|
||||
public function test_delete_cronjob(): void
|
||||
{
|
||||
SSH::fake();
|
||||
|
||||
|
@ -80,7 +80,7 @@ public function test_cannot_delete_last_project(): void
|
||||
Sanctum::actingAs($this->user, ['read', 'write']);
|
||||
|
||||
$this->json('DELETE', "/api/projects/{$this->user->currentProject->id}")
|
||||
->assertJsonValidationErrorFor('project');
|
||||
->assertJsonValidationErrorFor('name');
|
||||
|
||||
$this->assertDatabaseHas('projects', [
|
||||
'id' => $this->user->currentProject->id,
|
||||
|
@ -6,6 +6,7 @@
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ServerProvidersTest extends TestCase
|
||||
@ -13,8 +14,9 @@ class ServerProvidersTest extends TestCase
|
||||
use RefreshDatabase;
|
||||
|
||||
/**
|
||||
* @dataProvider data
|
||||
* @param array<string, mixed> $input
|
||||
*/
|
||||
#[DataProvider('data')]
|
||||
public function test_connect_provider(string $provider, array $input): void
|
||||
{
|
||||
Sanctum::actingAs($this->user, ['read', 'write']);
|
||||
@ -40,8 +42,9 @@ public function test_connect_provider(string $provider, array $input): void
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data
|
||||
* @param array<string, mixed> $input
|
||||
*/
|
||||
#[DataProvider('data')]
|
||||
public function test_cannot_connect_to_provider(string $provider, array $input): void
|
||||
{
|
||||
Sanctum::actingAs($this->user, ['read', 'write']);
|
||||
@ -82,9 +85,7 @@ public function test_see_providers_list(): void
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data
|
||||
*/
|
||||
#[DataProvider('data')]
|
||||
public function test_delete_provider(string $provider): void
|
||||
{
|
||||
Sanctum::actingAs($this->user, ['read', 'write']);
|
||||
@ -102,9 +103,7 @@ public function test_delete_provider(string $provider): void
|
||||
->assertNoContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data
|
||||
*/
|
||||
#[DataProvider('data')]
|
||||
public function test_cannot_delete_provider(string $provider): void
|
||||
{
|
||||
Sanctum::actingAs($this->user, ['read', 'write']);
|
||||
@ -128,6 +127,9 @@ public function test_cannot_delete_provider(string $provider): void
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<array<int, mixed>>
|
||||
*/
|
||||
public static function data(): array
|
||||
{
|
||||
return [
|
||||
|
@ -6,6 +6,7 @@
|
||||
use App\Facades\SSH;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ServicesTest extends TestCase
|
||||
@ -57,9 +58,7 @@ public function test_show_service(): void
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data
|
||||
*/
|
||||
#[DataProvider('data')]
|
||||
public function test_manage_service(string $action): void
|
||||
{
|
||||
Sanctum::actingAs($this->user, ['read', 'write']);
|
||||
@ -94,6 +93,10 @@ public function test_uninstall_service(): void
|
||||
]))
|
||||
->assertSuccessful()
|
||||
->assertNoContent();
|
||||
|
||||
$this->assertDatabaseMissing('services', [
|
||||
'id' => $service->id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_cannot_uninstall_service_because_it_is_being_used(): void
|
||||
@ -112,6 +115,9 @@ public function test_cannot_uninstall_service_because_it_is_being_used(): void
|
||||
->assertJsonValidationErrorFor('service');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<array<string>>
|
||||
*/
|
||||
public static function data(): array
|
||||
{
|
||||
return [
|
||||
|
@ -11,6 +11,7 @@
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
use Tests\Traits\PrepareLoadBalancer;
|
||||
|
||||
@ -27,8 +28,9 @@ protected function setUp(): void
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider create_data
|
||||
* @param array<string, mixed> $inputs
|
||||
*/
|
||||
#[DataProvider('create_data')]
|
||||
public function test_create_site(array $inputs): void
|
||||
{
|
||||
SSH::fake();
|
||||
@ -383,10 +385,11 @@ public function test_update_env(): void
|
||||
->assertJsonFragment([
|
||||
'domain' => $site->domain,
|
||||
]);
|
||||
|
||||
SSH::assertExecuted('edit-file');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<array<array<string, mixed>>>
|
||||
*/
|
||||
public static function create_data(): array
|
||||
{
|
||||
return \Tests\Feature\SitesTest::create_data();
|
||||
|
@ -6,6 +6,7 @@
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SourceControlsTest extends TestCase
|
||||
@ -13,8 +14,9 @@ class SourceControlsTest extends TestCase
|
||||
use RefreshDatabase;
|
||||
|
||||
/**
|
||||
* @dataProvider data
|
||||
* @param array<string, mixed> $input
|
||||
*/
|
||||
#[DataProvider('data')]
|
||||
public function test_connect_provider(string $provider, array $input): void
|
||||
{
|
||||
Sanctum::actingAs($this->user, ['read', 'write']);
|
||||
@ -39,6 +41,7 @@ public function test_connect_provider(string $provider, array $input): void
|
||||
/**
|
||||
* @dataProvider data
|
||||
*/
|
||||
#[DataProvider('data')]
|
||||
public function test_delete_provider(string $provider): void
|
||||
{
|
||||
Sanctum::actingAs($this->user, ['read', 'write']);
|
||||
@ -60,6 +63,7 @@ public function test_delete_provider(string $provider): void
|
||||
/**
|
||||
* @dataProvider data
|
||||
*/
|
||||
#[DataProvider('data')]
|
||||
public function test_cannot_delete_provider(string $provider): void
|
||||
{
|
||||
Sanctum::actingAs($this->user, ['read', 'write']);
|
||||
@ -90,7 +94,10 @@ public function test_cannot_delete_provider(string $provider): void
|
||||
|
||||
/**
|
||||
* @dataProvider data
|
||||
*
|
||||
* @param array<string, mixed> $input
|
||||
*/
|
||||
#[DataProvider('data')]
|
||||
public function test_edit_source_control(string $provider, array $input): void
|
||||
{
|
||||
Http::fake();
|
||||
@ -124,6 +131,9 @@ public function test_edit_source_control(string $provider, array $input): void
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<array<int, mixed>>
|
||||
*/
|
||||
public static function data(): array
|
||||
{
|
||||
return [
|
||||
|
@ -10,6 +10,7 @@
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
class StorageProvidersTest extends TestCase
|
||||
@ -17,8 +18,9 @@ class StorageProvidersTest extends TestCase
|
||||
use RefreshDatabase;
|
||||
|
||||
/**
|
||||
* @dataProvider createData
|
||||
* @param array<string, mixed> $input
|
||||
*/
|
||||
#[DataProvider('createData')]
|
||||
public function test_create(array $input): void
|
||||
{
|
||||
Sanctum::actingAs($this->user, ['read', 'write']);
|
||||
@ -106,7 +108,7 @@ public function test_cannot_delete_provider(): void
|
||||
}
|
||||
|
||||
/**
|
||||
* @TODO: complete FTP tests
|
||||
* @return array<int, array<int, array<string, mixed>>>
|
||||
*/
|
||||
public static function createData(): array
|
||||
{
|
||||
|
Reference in New Issue
Block a user