mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-11 02:43:45 +02:00
tests(integration): fix new tests using legacy factories
This commit is contained in:
@@ -27,11 +27,11 @@ class BackupAuthorizationTest extends ClientApiIntegrationTestCase
|
||||
|
||||
// Set the API $user as a subuser of server 2, but with no permissions
|
||||
// to do anything with the backups for that server.
|
||||
factory(Subuser::class)->create(['server_id' => $server2->id, 'user_id' => $user->id]);
|
||||
Subuser::factory()->create(['server_id' => $server2->id, 'user_id' => $user->id]);
|
||||
|
||||
$backup1 = factory(Backup::class)->create(['server_id' => $server1->id, 'completed_at' => CarbonImmutable::now()]);
|
||||
$backup2 = factory(Backup::class)->create(['server_id' => $server2->id, 'completed_at' => CarbonImmutable::now()]);
|
||||
$backup3 = factory(Backup::class)->create(['server_id' => $server3->id, 'completed_at' => CarbonImmutable::now()]);
|
||||
$backup1 = Backup::factory()->create(['server_id' => $server1->id, 'completed_at' => CarbonImmutable::now()]);
|
||||
$backup2 = Backup::factory()->create(['server_id' => $server2->id, 'completed_at' => CarbonImmutable::now()]);
|
||||
$backup3 = Backup::factory()->create(['server_id' => $server3->id, 'completed_at' => CarbonImmutable::now()]);
|
||||
|
||||
$this->instance(DeleteBackupService::class, $mock = Mockery::mock(DeleteBackupService::class));
|
||||
|
||||
|
||||
@@ -27,15 +27,15 @@ class DatabaseAuthorizationTest extends ClientApiIntegrationTestCase
|
||||
// And as no access to $server3.
|
||||
$server3 = $this->createServerModel();
|
||||
|
||||
$host = factory(DatabaseHost::class)->create([]);
|
||||
$host = DatabaseHost::factory()->create([]);
|
||||
|
||||
// Set the API $user as a subuser of server 2, but with no permissions
|
||||
// to do anything with the databases for that server.
|
||||
factory(Subuser::class)->create(['server_id' => $server2->id, 'user_id' => $user->id]);
|
||||
Subuser::factory()->create(['server_id' => $server2->id, 'user_id' => $user->id]);
|
||||
|
||||
$database1 = factory(Database::class)->create(['server_id' => $server1->id, 'database_host_id' => $host->id]);
|
||||
$database2 = factory(Database::class)->create(['server_id' => $server2->id, 'database_host_id' => $host->id]);
|
||||
$database3 = factory(Database::class)->create(['server_id' => $server3->id, 'database_host_id' => $host->id]);
|
||||
$database1 = Database::factory()->create(['server_id' => $server1->id, 'database_host_id' => $host->id]);
|
||||
$database2 = Database::factory()->create(['server_id' => $server2->id, 'database_host_id' => $host->id]);
|
||||
$database3 = Database::factory()->create(['server_id' => $server3->id, 'database_host_id' => $host->id]);
|
||||
|
||||
$this->instance(DatabasePasswordService::class, $mock = Mockery::mock(DatabasePasswordService::class));
|
||||
$this->instance(DatabaseManagementService::class, $mock2 = Mockery::mock(DatabaseManagementService::class));
|
||||
|
||||
@@ -32,11 +32,11 @@ class ScheduleAuthorizationTest extends ClientApiIntegrationTestCase
|
||||
|
||||
// Set the API $user as a subuser of server 2, but with no permissions
|
||||
// to do anything with the schedules for that server.
|
||||
factory(Subuser::class)->create(['server_id' => $server2->id, 'user_id' => $user->id]);
|
||||
Subuser::factory()->create(['server_id' => $server2->id, 'user_id' => $user->id]);
|
||||
|
||||
$schedule1 = factory(Schedule::class)->create(['server_id' => $server1->id]);
|
||||
$schedule2 = factory(Schedule::class)->create(['server_id' => $server2->id]);
|
||||
$schedule3 = factory(Schedule::class)->create(['server_id' => $server3->id]);
|
||||
$schedule1 = Schedule::factory()->create(['server_id' => $server1->id]);
|
||||
$schedule2 = Schedule::factory()->create(['server_id' => $server2->id]);
|
||||
$schedule3 = Schedule::factory()->create(['server_id' => $server3->id]);
|
||||
|
||||
// This is the only valid call for this test, accessing the schedule for the same
|
||||
// server that the API user is the owner of.
|
||||
|
||||
Reference in New Issue
Block a user