Fix failing tests due to way nest creation worked

This commit is contained in:
Dane Everitt 2017-11-04 13:01:54 -05:00
parent 233cbfda09
commit f5b20e38c4
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
4 changed files with 46 additions and 35 deletions

View file

@ -1,11 +1,4 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Services\Nests;
@ -19,12 +12,12 @@ class NestCreationService
/**
* @var \Illuminate\Contracts\Config\Repository
*/
protected $config;
private $config;
/**
* @var \Pterodactyl\Contracts\Repository\NestRepositoryInterface
*/
protected $repository;
private $repository;
/**
* NestCreationService constructor.
@ -41,16 +34,16 @@ class NestCreationService
/**
* Create a new nest on the system.
*
* @param array $data
* @param array $data
* @param string|null $author
* @return \Pterodactyl\Models\Nest
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function handle(array $data): Nest
public function handle(array $data, string $author = null): Nest
{
return $this->repository->create([
'uuid' => Uuid::uuid4()->toString(),
'author' => $this->config->get('pterodactyl.service.author'),
'author' => $author ?? $this->config->get('pterodactyl.service.author'),
'name' => array_get($data, 'name'),
'description' => array_get($data, 'description'),
], true, true);