mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-19 06:43:45 +02:00
Add test cases for services
This commit is contained in:
@@ -15,19 +15,22 @@ class ScheduleUpdateService
|
||||
* @var \Illuminate\Database\ConnectionInterface
|
||||
*/
|
||||
private $connection;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\ScheduleRepositoryInterface
|
||||
*/
|
||||
private $repository;
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\TaskRepositoryInterface
|
||||
*/
|
||||
private $taskRepository;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Services\Schedules\Tasks\TaskCreationService
|
||||
*/
|
||||
private $taskCreationService;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\TaskRepositoryInterface
|
||||
*/
|
||||
private $taskRepository;
|
||||
|
||||
/**
|
||||
* ScheduleUpdateService constructor.
|
||||
*
|
||||
|
||||
@@ -37,14 +37,15 @@ class StartupCommandViewService
|
||||
$server = $this->repository->getPrimaryAllocation($response->server);
|
||||
|
||||
$find = ['{{SERVER_MEMORY}}', '{{SERVER_IP}}', '{{SERVER_PORT}}'];
|
||||
$replace = [$server->memory, $server->allocation->ip, $server->allocation->port];
|
||||
$replace = [$server->memory, $server->getRelation('allocation')->ip, $server->getRelation('allocation')->port];
|
||||
|
||||
$variables = $server->egg->variables->each(function ($variable) use (&$find, &$replace, $response) {
|
||||
$find[] = '{{' . $variable->env_variable . '}}';
|
||||
$replace[] = $variable->user_viewable ? $response->data[$variable->env_variable] : '[hidden]';
|
||||
})->filter(function ($variable) {
|
||||
return $variable->user_viewable === 1;
|
||||
});
|
||||
$variables = $server->getRelation('egg')->getRelation('variables')
|
||||
->each(function ($variable) use (&$find, &$replace, $response) {
|
||||
$find[] = '{{' . $variable->env_variable . '}}';
|
||||
$replace[] = $variable->user_viewable ? $response->data[$variable->env_variable] : '[hidden]';
|
||||
})->filter(function ($variable) {
|
||||
return $variable->user_viewable === 1;
|
||||
});
|
||||
|
||||
return collect([
|
||||
'startup' => str_replace($find, $replace, $server->startup),
|
||||
|
||||
Reference in New Issue
Block a user