mirror of
https://github.com/pelican-dev/panel.git
synced 2026-05-04 18:00:48 +03:00
database-host: reverse node relationship
This commit is contained in:
@@ -24,7 +24,7 @@ class DatabaseAuthorizationTest extends ClientApiIntegrationTestCase
|
||||
// And as no access to $server3.
|
||||
$server3 = $this->createServerModel();
|
||||
|
||||
$host = DatabaseHost::factory()->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.
|
||||
|
||||
@@ -58,7 +58,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
||||
public function testDatabaseCannotBeCreatedIfServerHasReachedLimit()
|
||||
{
|
||||
$server = $this->createServerModel(['database_limit' => 2]);
|
||||
$host = DatabaseHost::factory()->create(['node_id' => $server->node_id]);
|
||||
$host = DatabaseHost::factory()->create();
|
||||
|
||||
Database::factory()->times(2)->create(['server_id' => $server->id, 'database_host_id' => $host->id]);
|
||||
|
||||
@@ -90,8 +90,8 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
||||
$server = $this->createServerModel();
|
||||
$name = DatabaseManagementService::generateUniqueDatabaseName('soemthing', $server->id);
|
||||
|
||||
$host = DatabaseHost::factory()->create(['node_id' => $server->node_id]);
|
||||
$host2 = DatabaseHost::factory()->create(['node_id' => $server->node_id]);
|
||||
$host = DatabaseHost::factory()->create();
|
||||
$host2 = DatabaseHost::factory()->create();
|
||||
Database::factory()->create([
|
||||
'database' => $name,
|
||||
'database_host_id' => $host->id,
|
||||
@@ -119,7 +119,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
||||
$server = $this->createServerModel();
|
||||
$name = DatabaseManagementService::generateUniqueDatabaseName('soemthing', $server->id);
|
||||
|
||||
$host = DatabaseHost::factory()->create(['node_id' => $server->node_id]);
|
||||
$host = DatabaseHost::factory()->create();
|
||||
|
||||
$this->repository->expects('createDatabase')->with($name);
|
||||
|
||||
@@ -177,7 +177,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
|
||||
$server = $this->createServerModel();
|
||||
$name = DatabaseManagementService::generateUniqueDatabaseName('soemthing', $server->id);
|
||||
|
||||
$host = DatabaseHost::factory()->create(['node_id' => $server->node_id]);
|
||||
$host = DatabaseHost::factory()->create();
|
||||
|
||||
$this->repository->expects('createDatabase')->with($name)->andThrows(new \BadMethodCallException());
|
||||
$this->repository->expects('dropDatabase')->with($name);
|
||||
|
||||
@@ -62,7 +62,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase
|
||||
$server = $this->createServerModel();
|
||||
|
||||
$node = Node::factory()->create(['location_id' => $server->location->id]);
|
||||
DatabaseHost::factory()->create(['node_id' => $node->id]);
|
||||
DatabaseHost::factory()->create();
|
||||
|
||||
config()->set('pterodactyl.client_features.databases.allow_random', false);
|
||||
|
||||
@@ -97,8 +97,8 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase
|
||||
$server = $this->createServerModel();
|
||||
|
||||
$node = Node::factory()->create(['location_id' => $server->location->id]);
|
||||
DatabaseHost::factory()->create(['node_id' => $node->id]);
|
||||
$host = DatabaseHost::factory()->create(['node_id' => $server->node_id]);
|
||||
DatabaseHost::factory()->create();
|
||||
$host = DatabaseHost::factory()->create();
|
||||
|
||||
$this->managementService->expects('create')->with($server, [
|
||||
'database_host_id' => $host->id,
|
||||
@@ -124,7 +124,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase
|
||||
$server = $this->createServerModel();
|
||||
|
||||
$node = Node::factory()->create(['location_id' => $server->location->id]);
|
||||
$host = DatabaseHost::factory()->create(['node_id' => $node->id]);
|
||||
$host = DatabaseHost::factory()->create();
|
||||
|
||||
$this->managementService->expects('create')->with($server, [
|
||||
'database_host_id' => $host->id,
|
||||
|
||||
Reference in New Issue
Block a user