More service structure testing and configuration

Tests aren't working as well as I had hoped, so a lot are commented out while I wait to hear back on this bug causing them to fail.
This commit is contained in:
Dane Everitt 2017-06-24 19:49:09 -05:00
parent ce2b2447d0
commit 2235481765
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
18 changed files with 755 additions and 401 deletions

View file

@ -24,6 +24,7 @@
namespace Pterodactyl\Services;
use Pterodactyl\Exceptions\Model\DataValidationException;
use Pterodactyl\Models\Location;
use Pterodactyl\Exceptions\DisplayException;
@ -50,13 +51,15 @@ class LocationService
* @param array $data
* @return \Pterodactyl\Models\Location
*
* @throws \Throwable
* @throws \Watson\Validating\ValidationException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function create(array $data)
{
$location = $this->model->fill($data);
$location->saveOrFail();
$location = $this->model->newInstance($data);
if (! $location->save()) {
throw new DataValidationException($location->getValidator());
}
return $location;
}
@ -64,17 +67,19 @@ class LocationService
/**
* Update location model in the DB.
*
* @param int $id
* @param array $data
* @param int $id
* @param array $data
* @return \Pterodactyl\Models\Location
*
* @throws \Throwable
* @throws \Watson\Validating\ValidationException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/
public function update($id, array $data)
{
$location = $this->model->findOrFail($id);
$location->fill($data)->saveOrFail();
$location = $this->model->findOrFail($id)->fill($data);
if (! $location->save()) {
throw new DataValidationException($location->getValidator());
}
return $location;
}
@ -84,6 +89,7 @@ class LocationService
*
* @param int $id
* @return bool
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/
public function delete($id)