Add test cases for services
This commit is contained in:
parent
3ecab82358
commit
e2cdb3b4b1
5 changed files with 245 additions and 11 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue