mirror of
https://github.com/pelican-dev/panel.git
synced 2025-06-16 22:41:08 +02:00
Fix tests
This commit is contained in:
parent
804ff64a71
commit
50ffaf4d01
@ -87,6 +87,7 @@ class ServerCreationServiceTest extends IntegrationTestCase
|
||||
'environment' => [
|
||||
'BUNGEE_VERSION' => '123',
|
||||
'SERVER_JARFILE' => 'server2.jar',
|
||||
'SERVER_PORT' => '1234',
|
||||
],
|
||||
'start_on_completion' => true,
|
||||
];
|
||||
@ -98,13 +99,14 @@ class ServerCreationServiceTest extends IntegrationTestCase
|
||||
'environment' => [
|
||||
'BUNGEE_VERSION' => '',
|
||||
'SERVER_JARFILE' => 'server2.jar',
|
||||
'SERVER_PORT' => '1234',
|
||||
],
|
||||
]), $deployment);
|
||||
|
||||
$this->fail('This execution pathway should not be reached.');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertCount(1, $exception->errors());
|
||||
$this->assertArrayHasKey('environment.BUNGEE_VERSION', $exception->errors());
|
||||
$this->assertArrayNotHasKey('environment.SERVER_JARFILE', $exception->errors());
|
||||
$this->assertSame('The Bungeecord Version variable field is required.', $exception->errors()['environment.BUNGEE_VERSION'][0]);
|
||||
}
|
||||
|
||||
@ -114,7 +116,7 @@ class ServerCreationServiceTest extends IntegrationTestCase
|
||||
$this->assertNotNull($response->uuid);
|
||||
$this->assertSame($response->uuid_short, substr($response->uuid, 0, 8));
|
||||
$this->assertSame($egg->id, $response->egg_id);
|
||||
$this->assertCount(2, $response->variables);
|
||||
$this->assertCount(3, $response->variables);
|
||||
$this->assertSame('123', $response->variables[0]->server_value);
|
||||
$this->assertSame('server2.jar', $response->variables[1]->server_value);
|
||||
|
||||
@ -167,6 +169,7 @@ class ServerCreationServiceTest extends IntegrationTestCase
|
||||
'environment' => [
|
||||
'BUNGEE_VERSION' => '123',
|
||||
'SERVER_JARFILE' => 'server2.jar',
|
||||
'SERVER_PORT' => '1234',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -29,6 +29,7 @@ class StartupModificationServiceTest extends IntegrationTestCase
|
||||
'environment' => [
|
||||
'BUNGEE_VERSION' => '$$',
|
||||
'SERVER_JARFILE' => 'server.jar',
|
||||
'SERVER_PORT' => '1234',
|
||||
],
|
||||
]);
|
||||
|
||||
@ -54,11 +55,12 @@ class StartupModificationServiceTest extends IntegrationTestCase
|
||||
'environment' => [
|
||||
'BUNGEE_VERSION' => '1234',
|
||||
'SERVER_JARFILE' => 'test.jar',
|
||||
'SERVER_PORT' => '1234',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertInstanceOf(Server::class, $result);
|
||||
$this->assertCount(2, $result->variables);
|
||||
$this->assertCount(3, $result->variables);
|
||||
$this->assertSame($server->startup, $result->startup);
|
||||
$this->assertSame('1234', $result->variables[0]->server_value);
|
||||
$this->assertSame('test.jar', $result->variables[1]->server_value);
|
||||
@ -125,7 +127,7 @@ class StartupModificationServiceTest extends IntegrationTestCase
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertCount(2, $response->variables);
|
||||
$this->assertCount(3, $response->variables);
|
||||
$this->assertSame('EXIST', $response->variables[0]->server_value);
|
||||
$this->assertSame('test.jar', $response->variables[1]->server_value);
|
||||
|
||||
@ -135,12 +137,14 @@ class StartupModificationServiceTest extends IntegrationTestCase
|
||||
'environment' => [
|
||||
'BUNGEE_VERSION' => '1234',
|
||||
'SERVER_JARFILE' => 'test.jar',
|
||||
'SERVER_PORT' => '1111',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertCount(2, $response->variables);
|
||||
$this->assertCount(3, $response->variables);
|
||||
$this->assertSame('1234', $response->variables[0]->server_value);
|
||||
$this->assertSame('test.jar', $response->variables[1]->server_value);
|
||||
$this->assertSame('1111', $response->variables[2]->server_value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,25 +94,28 @@ class VariableValidatorServiceTest extends IntegrationTestCase
|
||||
$this->getService()->setUserLevel(User::USER_LEVEL_ADMIN)->handle($egg->id, [
|
||||
'BUNGEE_VERSION' => '1.2.3',
|
||||
'SERVER_JARFILE' => 'server.jar',
|
||||
'SERVER_PORT' => '1234',
|
||||
]);
|
||||
|
||||
$this->fail('This statement should not be reached.');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertCount(1, $exception->errors());
|
||||
$this->assertArrayHasKey('environment.BUNGEE_VERSION', $exception->errors());
|
||||
}
|
||||
|
||||
$response = $this->getService()->setUserLevel(User::USER_LEVEL_ADMIN)->handle($egg->id, [
|
||||
'BUNGEE_VERSION' => '123',
|
||||
'SERVER_JARFILE' => 'server.jar',
|
||||
'SERVER_PORT' => '1234',
|
||||
]);
|
||||
|
||||
$this->assertInstanceOf(Collection::class, $response);
|
||||
$this->assertCount(2, $response);
|
||||
$this->assertCount(3, $response);
|
||||
$this->assertSame('BUNGEE_VERSION', $response->get(0)->key);
|
||||
$this->assertSame('123', $response->get(0)->value);
|
||||
$this->assertSame('SERVER_JARFILE', $response->get(1)->key);
|
||||
$this->assertSame('server.jar', $response->get(1)->value);
|
||||
$this->assertSame('SERVER_PORT', $response->get(2)->key);
|
||||
$this->assertSame('1234', $response->get(2)->value);
|
||||
}
|
||||
|
||||
public function testNullableEnvironmentVariablesCanBeUsedCorrectly(): void
|
||||
|
Loading…
x
Reference in New Issue
Block a user