Push more tests for location services, setup travis CI integration

This commit is contained in:
Dane Everitt 2017-06-15 23:03:22 -05:00
parent 13cd01cfe6
commit 760525a673
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
8 changed files with 279 additions and 69 deletions

View file

@ -64,15 +64,16 @@ class LocationService
/**
* Update location model in the DB.
*
* @param \Pterodactyl\Models\Location $location
* @param array $data
* @param int $id
* @param array $data
* @return \Pterodactyl\Models\Location
*
* @throws \Throwable
* @throws \Watson\Validating\ValidationException
*/
public function update(Location $location, array $data)
public function update($id, array $data)
{
$location = $this->model->findOrFail($id);
$location->fill($data)->saveOrFail();
return $location;
@ -81,15 +82,15 @@ class LocationService
/**
* Delete a model from the DB.
*
* @param \Pterodactyl\Models\Location $location
* @param int $id
* @return bool
*
* @throws \Exception
* @throws \Pterodactyl\Exceptions\DisplayException
*/
public function delete(Location $location)
public function delete($id)
{
if ($location->nodes()->count() > 0) {
$location = $this->model->withCount('nodes')->findOrFail($id);
if ($location->nodes_count > 0) {
throw new DisplayException('Cannot delete a location that has nodes assigned to it.');
}