Apply fixes from StyleCI (#577)

This commit is contained in:
Dane Everitt 2017-08-05 17:26:30 -05:00 committed by GitHub
parent 4da7922de6
commit a4b61846ac
44 changed files with 198 additions and 201 deletions

View file

@ -3,10 +3,10 @@
namespace Pterodactyl\Exceptions; namespace Pterodactyl\Exceptions;
use Exception; use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Prologue\Alerts\Facades\Alert; use Prologue\Alerts\Facades\Alert;
use Illuminate\Auth\AuthenticationException;
use Pterodactyl\Exceptions\Model\DataValidationException; use Pterodactyl\Exceptions\Model\DataValidationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler class Handler extends ExceptionHandler
{ {

View file

@ -24,10 +24,10 @@
namespace Pterodactyl\Extensions; namespace Pterodactyl\Extensions;
use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
use Pterodactyl\Models\DatabaseHost; use Pterodactyl\Models\DatabaseHost;
use Illuminate\Contracts\Encryption\Encrypter; use Illuminate\Contracts\Encryption\Encrypter;
use Illuminate\Config\Repository as ConfigRepository; use Illuminate\Config\Repository as ConfigRepository;
use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
class DynamicDatabaseConnection class DynamicDatabaseConnection
{ {

View file

@ -28,8 +28,8 @@ use Fractal;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Repositories\old_Daemon\PowerRepository;
use Pterodactyl\Transformers\User\ServerTransformer; use Pterodactyl\Transformers\User\ServerTransformer;
use Pterodactyl\Repositories\old_Daemon\PowerRepository;
use Pterodactyl\Repositories\old_Daemon\CommandRepository; use Pterodactyl\Repositories\old_Daemon\CommandRepository;
class ServerController extends Controller class ServerController extends Controller

View file

@ -24,13 +24,13 @@
namespace Pterodactyl\Http\Controllers\Admin; namespace Pterodactyl\Http\Controllers\Admin;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
use Pterodactyl\Models\Location; use Pterodactyl\Models\Location;
use Prologue\Alerts\AlertsMessageBag; use Prologue\Alerts\AlertsMessageBag;
use Pterodactyl\Services\LocationService;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Http\Requests\Admin\LocationRequest; use Pterodactyl\Http\Requests\Admin\LocationRequest;
use Pterodactyl\Services\LocationService; use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
class LocationController extends Controller class LocationController extends Controller
{ {

View file

@ -24,26 +24,25 @@
namespace Pterodactyl\Http\Controllers\Admin; namespace Pterodactyl\Http\Controllers\Admin;
use Illuminate\Cache\Repository as CacheRepository;
use Illuminate\Contracts\Translation\Translator;
use Log; use Log;
use Alert; use Alert;
use Cache;
use Javascript; use Javascript;
use Prologue\Alerts\AlertsMessageBag;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Http\Requests\Admin\NodeFormRequest;
use Pterodactyl\Models\Allocation;
use Pterodactyl\Models\Node;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\Node;
use Pterodactyl\Models\Allocation;
use Prologue\Alerts\AlertsMessageBag;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Repositories\NodeRepository; use Pterodactyl\Repositories\NodeRepository;
use Pterodactyl\Exceptions\DisplayValidationException; use Pterodactyl\Services\Nodes\UpdateService;
use Pterodactyl\Services\Nodes\CreationService; use Pterodactyl\Services\Nodes\CreationService;
use Pterodactyl\Services\Nodes\DeletionService; use Pterodactyl\Services\Nodes\DeletionService;
use Pterodactyl\Services\Nodes\UpdateService; use Illuminate\Contracts\Translation\Translator;
use Illuminate\Cache\Repository as CacheRepository;
use Pterodactyl\Http\Requests\Admin\NodeFormRequest;
use Pterodactyl\Exceptions\DisplayValidationException;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
class NodesController extends Controller class NodesController extends Controller
{ {

View file

@ -24,31 +24,30 @@
namespace Pterodactyl\Http\Controllers\Admin; namespace Pterodactyl\Http\Controllers\Admin;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
use Alert;
use Javascript; use Javascript;
use Prologue\Alerts\AlertsMessageBag;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Http\Requests\Admin\ServerFormRequest;
use Pterodactyl\Models\Server;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\Server;
use Prologue\Alerts\AlertsMessageBag;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Repositories\Eloquent\DatabaseHostRepository;
use Pterodactyl\Services\Database\DatabaseManagementService;
use Pterodactyl\Services\Servers\BuildModificationService;
use Pterodactyl\Services\Servers\ContainerRebuildService;
use Pterodactyl\Services\Servers\CreationService; use Pterodactyl\Services\Servers\CreationService;
use Pterodactyl\Services\Servers\DeletionService; use Pterodactyl\Services\Servers\DeletionService;
use Pterodactyl\Services\Servers\DetailsModificationService;
use Pterodactyl\Services\Servers\ReinstallService; use Pterodactyl\Services\Servers\ReinstallService;
use Pterodactyl\Services\Servers\StartupModificationService;
use Pterodactyl\Services\Servers\SuspensionService; use Pterodactyl\Services\Servers\SuspensionService;
use Pterodactyl\Http\Requests\Admin\ServerFormRequest;
use Pterodactyl\Services\Servers\ContainerRebuildService;
use Pterodactyl\Services\Servers\BuildModificationService;
use Pterodactyl\Services\Database\DatabaseManagementService;
use Pterodactyl\Services\Servers\DetailsModificationService;
use Pterodactyl\Services\Servers\StartupModificationService;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Repositories\Eloquent\DatabaseHostRepository;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
class ServersController extends Controller class ServersController extends Controller
{ {

View file

@ -32,8 +32,8 @@ use Illuminate\Http\Request;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Repositories\ServerRepository; use Pterodactyl\Repositories\ServerRepository;
use Pterodactyl\Repositories\old_Daemon\FileRepository;
use Pterodactyl\Exceptions\DisplayValidationException; use Pterodactyl\Exceptions\DisplayValidationException;
use Pterodactyl\Repositories\old_Daemon\FileRepository;
class ServerController extends Controller class ServerController extends Controller
{ {

View file

@ -24,8 +24,8 @@
namespace Pterodactyl\Http\Requests\Admin; namespace Pterodactyl\Http\Requests\Admin;
use Illuminate\Validation\Rule;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Validation\Rule;
class ServerFormRequest extends AdminFormRequest class ServerFormRequest extends AdminFormRequest
{ {

View file

@ -80,11 +80,11 @@ class DatabaseHost extends Model implements ValidableContract
'node_id' => 'sometimes|required', 'node_id' => 'sometimes|required',
]; ];
/** /**
* Validation rules to assign to this model. * Validation rules to assign to this model.
* *
* @var array * @var array
*/ */
// @todo the node_id field doesn't validate correctly if no node is provided in request // @todo the node_id field doesn't validate correctly if no node is provided in request
protected static $dataIntegrityRules = [ protected static $dataIntegrityRules = [
'name' => 'string|max:255', 'name' => 'string|max:255',

View file

@ -25,34 +25,34 @@
namespace Pterodactyl\Providers; namespace Pterodactyl\Providers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface; use Pterodactyl\Repositories\Eloquent\NodeRepository;
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface; use Pterodactyl\Repositories\Eloquent\UserRepository;
use Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\OptionVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Repositories\Daemon\ConfigurationRepository;
use Pterodactyl\Repositories\Daemon\ServerRepository as DaemonServerRepository;
use Pterodactyl\Repositories\Eloquent\AllocationRepository;
use Pterodactyl\Repositories\Eloquent\ApiKeyRepository; use Pterodactyl\Repositories\Eloquent\ApiKeyRepository;
use Pterodactyl\Repositories\Eloquent\ApiPermissionRepository; use Pterodactyl\Repositories\Eloquent\ServerRepository;
use Pterodactyl\Repositories\Eloquent\DatabaseHostRepository; use Pterodactyl\Repositories\Eloquent\ServiceRepository;
use Pterodactyl\Repositories\Eloquent\DatabaseRepository; use Pterodactyl\Repositories\Eloquent\DatabaseRepository;
use Pterodactyl\Repositories\Eloquent\LocationRepository; use Pterodactyl\Repositories\Eloquent\LocationRepository;
use Pterodactyl\Repositories\Eloquent\NodeRepository; use Pterodactyl\Repositories\Eloquent\AllocationRepository;
use Pterodactyl\Repositories\Eloquent\OptionVariableRepository; use Pterodactyl\Repositories\Daemon\ConfigurationRepository;
use Pterodactyl\Repositories\Eloquent\ServerRepository; use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Repositories\Eloquent\ServerVariableRepository;
use Pterodactyl\Repositories\Eloquent\ServiceRepository;
use Pterodactyl\Repositories\Eloquent\UserRepository;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface; use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Repositories\Eloquent\DatabaseHostRepository;
use Pterodactyl\Repositories\Eloquent\ApiPermissionRepository;
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Repositories\Eloquent\OptionVariableRepository;
use Pterodactyl\Repositories\Eloquent\ServerVariableRepository;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
use Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface;
use Pterodactyl\Contracts\Repository\OptionVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface;
use Pterodactyl\Repositories\Daemon\ServerRepository as DaemonServerRepository;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
class RepositoryServiceProvider extends ServiceProvider class RepositoryServiceProvider extends ServiceProvider
{ {

View file

@ -26,9 +26,9 @@ namespace Pterodactyl\Repositories\Daemon;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use Illuminate\Foundation\Application; use Illuminate\Foundation\Application;
use Pterodactyl\Contracts\Repository\Daemon\BaseRepositoryInterface;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface; use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Illuminate\Contracts\Config\Repository as ConfigRepository; use Illuminate\Contracts\Config\Repository as ConfigRepository;
use Pterodactyl\Contracts\Repository\Daemon\BaseRepositoryInterface;
class BaseRepository implements BaseRepositoryInterface class BaseRepository implements BaseRepositoryInterface
{ {

View file

@ -24,9 +24,9 @@
namespace Pterodactyl\Repositories\Daemon; namespace Pterodactyl\Repositories\Daemon;
use Pterodactyl\Services\Servers\EnvironmentService;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface; use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface as DatabaseServerRepositoryInterface; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface as DatabaseServerRepositoryInterface;
use Pterodactyl\Services\Servers\EnvironmentService;
class ServerRepository extends BaseRepository implements ServerRepositoryInterface class ServerRepository extends BaseRepository implements ServerRepositoryInterface
{ {

View file

@ -24,10 +24,10 @@
namespace Pterodactyl\Repositories\Eloquent; namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface; use Pterodactyl\Models\DatabaseHost;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException; use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
use Pterodactyl\Models\DatabaseHost; use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
class DatabaseHostRepository extends EloquentRepository implements DatabaseHostRepositoryInterface class DatabaseHostRepository extends EloquentRepository implements DatabaseHostRepositoryInterface
{ {

View file

@ -24,9 +24,9 @@
namespace Pterodactyl\Repositories\Eloquent; namespace Pterodactyl\Repositories\Eloquent;
use Illuminate\Database\DatabaseManager;
use Pterodactyl\Models\Database; use Pterodactyl\Models\Database;
use Illuminate\Foundation\Application; use Illuminate\Foundation\Application;
use Illuminate\Database\DatabaseManager;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface; use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;

View file

@ -24,9 +24,9 @@
namespace Pterodactyl\Repositories\Eloquent; namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Models\Node;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface; use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException; use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
use Pterodactyl\Models\Node;
use Pterodactyl\Repositories\Eloquent\Attributes\SearchableRepository; use Pterodactyl\Repositories\Eloquent\Attributes\SearchableRepository;
class NodeRepository extends SearchableRepository implements NodeRepositoryInterface class NodeRepository extends SearchableRepository implements NodeRepositoryInterface

View file

@ -24,9 +24,9 @@
namespace Pterodactyl\Repositories\Eloquent; namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
use Pterodactyl\Models\Service; use Pterodactyl\Models\Service;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface;
class ServiceRepository extends EloquentRepository implements ServiceRepositoryInterface class ServiceRepository extends EloquentRepository implements ServiceRepositoryInterface
{ {

View file

@ -24,10 +24,10 @@
namespace Pterodactyl\Repositories\Eloquent; namespace Pterodactyl\Repositories\Eloquent;
use Illuminate\Contracts\Config\Repository as ConfigRepository; use Pterodactyl\Models\User;
use Illuminate\Foundation\Application; use Illuminate\Foundation\Application;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface; use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Models\User; use Illuminate\Contracts\Config\Repository as ConfigRepository;
use Pterodactyl\Repositories\Eloquent\Attributes\SearchableRepository; use Pterodactyl\Repositories\Eloquent\Attributes\SearchableRepository;
class UserRepository extends SearchableRepository implements UserRepositoryInterface class UserRepository extends SearchableRepository implements UserRepositoryInterface

View file

@ -24,8 +24,8 @@
namespace Pterodactyl\Services\Database; namespace Pterodactyl\Services\Database;
use Illuminate\Contracts\Encryption\Encrypter;
use Illuminate\Database\DatabaseManager; use Illuminate\Database\DatabaseManager;
use Illuminate\Contracts\Encryption\Encrypter;
use Pterodactyl\Extensions\DynamicDatabaseConnection; use Pterodactyl\Extensions\DynamicDatabaseConnection;
use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface; use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;

View file

@ -24,11 +24,11 @@
namespace Pterodactyl\Services\Nodes; namespace Pterodactyl\Services\Nodes;
use Illuminate\Contracts\Translation\Translator;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
use Pterodactyl\Exceptions\DisplayException;
use Illuminate\Contracts\Translation\Translator;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
class DeletionService class DeletionService
{ {

View file

@ -24,12 +24,12 @@
namespace Pterodactyl\Services\Nodes; namespace Pterodactyl\Services\Nodes;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Log\Writer; use Illuminate\Log\Writer;
use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
use GuzzleHttp\Exception\RequestException;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface;
class UpdateService class UpdateService
{ {

View file

@ -24,15 +24,15 @@
namespace Pterodactyl\Services\Servers; namespace Pterodactyl\Services\Servers;
use Illuminate\Log\Writer;
use Pterodactyl\Models\Server;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Illuminate\Database\ConnectionInterface; use Illuminate\Database\ConnectionInterface;
use Illuminate\Log\Writer;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException; use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
use Pterodactyl\Models\Server; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
class BuildModificationService class BuildModificationService
{ {

View file

@ -24,12 +24,12 @@
namespace Pterodactyl\Services\Servers; namespace Pterodactyl\Services\Servers;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Log\Writer; use Illuminate\Log\Writer;
use Pterodactyl\Models\Server;
use GuzzleHttp\Exception\RequestException;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface; use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\Server;
class ContainerRebuildService class ContainerRebuildService
{ {

View file

@ -24,11 +24,11 @@
namespace Pterodactyl\Services\Servers; namespace Pterodactyl\Services\Servers;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Log\Writer;
use Pterodactyl\Exceptions\DisplayException;
use Ramsey\Uuid\Uuid; use Ramsey\Uuid\Uuid;
use Illuminate\Log\Writer;
use Illuminate\Database\DatabaseManager; use Illuminate\Database\DatabaseManager;
use GuzzleHttp\Exception\RequestException;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface; use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface; use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;

View file

@ -24,11 +24,11 @@
namespace Pterodactyl\Services\Servers; namespace Pterodactyl\Services\Servers;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Database\DatabaseManager;
use Illuminate\Log\Writer; use Illuminate\Log\Writer;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Database\DatabaseManager;
use GuzzleHttp\Exception\RequestException;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Repositories\Eloquent\ServerRepository; use Pterodactyl\Repositories\Eloquent\ServerRepository;
use Pterodactyl\Repositories\Daemon\ServerRepository as DaemonServerRepository; use Pterodactyl\Repositories\Daemon\ServerRepository as DaemonServerRepository;

View file

@ -24,11 +24,11 @@
namespace Pterodactyl\Services\Servers; namespace Pterodactyl\Services\Servers;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Log\Writer; use Illuminate\Log\Writer;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Database\ConnectionInterface; use Illuminate\Database\ConnectionInterface;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface; use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;

View file

@ -24,14 +24,14 @@
namespace Pterodactyl\Services\Servers; namespace Pterodactyl\Services\Servers;
use Illuminate\Log\Writer;
use Pterodactyl\Models\Server;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Illuminate\Database\ConnectionInterface; use Illuminate\Database\ConnectionInterface;
use Illuminate\Log\Writer; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface; use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
use Pterodactyl\Models\Server;
class StartupModificationService class StartupModificationService
{ {

View file

@ -24,13 +24,13 @@
namespace Pterodactyl\Services\Servers; namespace Pterodactyl\Services\Servers;
use Illuminate\Log\Writer;
use Pterodactyl\Models\Server;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Illuminate\Database\ConnectionInterface; use Illuminate\Database\ConnectionInterface;
use Illuminate\Log\Writer; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface; use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\Server;
class SuspensionService class SuspensionService
{ {

View file

@ -24,11 +24,11 @@
namespace Pterodactyl\Services\Servers; namespace Pterodactyl\Services\Servers;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface;
use Pterodactyl\Exceptions\DisplayValidationException; use Pterodactyl\Exceptions\DisplayValidationException;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Illuminate\Contracts\Validation\Factory as ValidationFactory; use Illuminate\Contracts\Validation\Factory as ValidationFactory;
use Pterodactyl\Contracts\Repository\OptionVariableRepositoryInterface; use Pterodactyl\Contracts\Repository\OptionVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface;
class VariableValidatorService class VariableValidatorService
{ {

View file

@ -24,11 +24,11 @@
namespace Pterodactyl\Services\Users; namespace Pterodactyl\Services\Users;
use Illuminate\Contracts\Translation\Translator;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Exceptions\DisplayException;
use Illuminate\Contracts\Translation\Translator;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
class DeletionService class DeletionService
{ {

View file

@ -24,14 +24,14 @@
namespace Tests\Unit\Services\Api; namespace Tests\Unit\Services\Api;
use Illuminate\Contracts\Encryption\Encrypter;
use Illuminate\Database\ConnectionInterface;
use Mockery as m; use Mockery as m;
use phpmock\phpunit\PHPMock;
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
use Pterodactyl\Services\Api\KeyService;
use Pterodactyl\Services\Api\PermissionService;
use Tests\TestCase; use Tests\TestCase;
use phpmock\phpunit\PHPMock;
use Pterodactyl\Services\Api\KeyService;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Contracts\Encryption\Encrypter;
use Pterodactyl\Services\Api\PermissionService;
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
class KeyServiceTest extends TestCase class KeyServiceTest extends TestCase
{ {

View file

@ -25,10 +25,10 @@
namespace Tests\Unit\Services; namespace Tests\Unit\Services;
use Mockery as m; use Mockery as m;
use Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface; use Tests\TestCase;
use Pterodactyl\Models\APIPermission; use Pterodactyl\Models\APIPermission;
use Pterodactyl\Services\Api\PermissionService; use Pterodactyl\Services\Api\PermissionService;
use Tests\TestCase; use Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface;
class PermissionServiceTest extends TestCase class PermissionServiceTest extends TestCase
{ {

View file

@ -156,7 +156,7 @@ class DatabaseHostServiceTest extends TestCase
} }
/** /**
* Test that passing no or empty password will skip storing it * Test that passing no or empty password will skip storing it.
*/ */
public function test_update_without_password() public function test_update_without_password()
{ {

View file

@ -25,10 +25,10 @@
namespace Tests\Unit\Services\Nodes; namespace Tests\Unit\Services\Nodes;
use Mockery as m; use Mockery as m;
use phpmock\phpunit\PHPMock;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Services\Nodes\CreationService;
use Tests\TestCase; use Tests\TestCase;
use phpmock\phpunit\PHPMock;
use Pterodactyl\Services\Nodes\CreationService;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
class CreationServiceTest extends TestCase class CreationServiceTest extends TestCase
{ {

View file

@ -24,13 +24,13 @@
namespace Tests\Unit\Services\Nodes; namespace Tests\Unit\Services\Nodes;
use Illuminate\Contracts\Translation\Translator;
use Mockery as m; use Mockery as m;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface; use Tests\TestCase;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
use Pterodactyl\Services\Nodes\DeletionService; use Pterodactyl\Services\Nodes\DeletionService;
use Tests\TestCase; use Illuminate\Contracts\Translation\Translator;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
class DeletionServiceTest extends TestCase class DeletionServiceTest extends TestCase
{ {

View file

@ -25,17 +25,17 @@
namespace Tests\Unit\Services\Nodes; namespace Tests\Unit\Services\Nodes;
use Exception; use Exception;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Log\Writer;
use Mockery as m; use Mockery as m;
use phpmock\phpunit\PHPMock;
use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\Node;
use Pterodactyl\Services\Nodes\CreationService;
use Pterodactyl\Services\Nodes\UpdateService;
use Tests\TestCase; use Tests\TestCase;
use Illuminate\Log\Writer;
use phpmock\phpunit\PHPMock;
use Pterodactyl\Models\Node;
use GuzzleHttp\Exception\RequestException;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Services\Nodes\UpdateService;
use Pterodactyl\Services\Nodes\CreationService;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface;
class UpdateServiceTest extends TestCase class UpdateServiceTest extends TestCase
{ {

View file

@ -25,13 +25,13 @@
namespace Tests\Unit\Services\Servers; namespace Tests\Unit\Services\Servers;
use Exception; use Exception;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Log\Writer;
use Mockery as m; use Mockery as m;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\Server;
use Pterodactyl\Services\Servers\ContainerRebuildService;
use Tests\TestCase; use Tests\TestCase;
use Illuminate\Log\Writer;
use Pterodactyl\Models\Server;
use GuzzleHttp\Exception\RequestException;
use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Services\Servers\ContainerRebuildService;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface; use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
@ -133,7 +133,7 @@ class ContainerRebuildServiceTest extends TestCase
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertInstanceOf(DisplayException::class, $exception); $this->assertInstanceOf(DisplayException::class, $exception);
$this->assertEquals( $this->assertEquals(
trans('admin/server.exceptions.daemon_exception', ['code' => 400,]), $exception->getMessage() trans('admin/server.exceptions.daemon_exception', ['code' => 400]), $exception->getMessage()
); );
} }
} }

View file

@ -24,20 +24,20 @@
namespace Tests\Unit\Services\Servers; namespace Tests\Unit\Services\Servers;
use Illuminate\Log\Writer;
use Mockery as m; use Mockery as m;
use phpmock\phpunit\PHPMock;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Services\Servers\CreationService;
use Pterodactyl\Services\Servers\UsernameGenerationService;
use Pterodactyl\Services\Servers\VariableValidatorService;
use Ramsey\Uuid\Uuid;
use Tests\TestCase; use Tests\TestCase;
use Ramsey\Uuid\Uuid;
use Illuminate\Log\Writer;
use phpmock\phpunit\PHPMock;
use Illuminate\Database\DatabaseManager; use Illuminate\Database\DatabaseManager;
use Pterodactyl\Services\Servers\CreationService;
use Pterodactyl\Services\Servers\VariableValidatorService;
use Pterodactyl\Services\Servers\UsernameGenerationService;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface; use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface; use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
class CreationServiceTest extends TestCase class CreationServiceTest extends TestCase

View file

@ -25,9 +25,9 @@
namespace Tests\Unit\Services\Servers; namespace Tests\Unit\Services\Servers;
use Exception; use Exception;
use Illuminate\Log\Writer;
use Mockery as m; use Mockery as m;
use Tests\TestCase; use Tests\TestCase;
use Illuminate\Log\Writer;
use phpmock\phpunit\PHPMock; use phpmock\phpunit\PHPMock;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Illuminate\Database\DatabaseManager; use Illuminate\Database\DatabaseManager;
@ -258,7 +258,7 @@ class DetailsModificationServiceTest extends TestCase
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertInstanceOf(DisplayException::class, $exception); $this->assertInstanceOf(DisplayException::class, $exception);
$this->assertEquals( $this->assertEquals(
trans('admin/server.exceptions.daemon_exception', ['code' => 400,]), $exception->getMessage() trans('admin/server.exceptions.daemon_exception', ['code' => 400]), $exception->getMessage()
); );
} }
} }
@ -371,7 +371,7 @@ class DetailsModificationServiceTest extends TestCase
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertInstanceOf(DisplayException::class, $exception); $this->assertInstanceOf(DisplayException::class, $exception);
$this->assertEquals( $this->assertEquals(
trans('admin/server.exceptions.daemon_exception', ['code' => 400,]), $exception->getMessage() trans('admin/server.exceptions.daemon_exception', ['code' => 400]), $exception->getMessage()
); );
} }
} }

View file

@ -25,14 +25,14 @@
namespace Tests\Unit\Services\Servers; namespace Tests\Unit\Services\Servers;
use Exception; use Exception;
use Mockery as m;
use Tests\TestCase;
use Illuminate\Log\Writer;
use Pterodactyl\Models\Server;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Illuminate\Database\ConnectionInterface; use Illuminate\Database\ConnectionInterface;
use Illuminate\Log\Writer;
use Mockery as m;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\Server;
use Pterodactyl\Services\Servers\ReinstallService; use Pterodactyl\Services\Servers\ReinstallService;
use Tests\TestCase;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface; use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
@ -162,7 +162,7 @@ class ReinstallServiceTest extends TestCase
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertInstanceOf(DisplayException::class, $exception); $this->assertInstanceOf(DisplayException::class, $exception);
$this->assertEquals( $this->assertEquals(
trans('admin/server.exceptions.daemon_exception', ['code' => 400,]), $exception->getMessage() trans('admin/server.exceptions.daemon_exception', ['code' => 400]), $exception->getMessage()
); );
} }
} }

View file

@ -25,16 +25,16 @@
namespace Tests\Unit\Services\Servers; namespace Tests\Unit\Services\Servers;
use Exception; use Exception;
use Mockery as m;
use Tests\TestCase;
use Illuminate\Log\Writer;
use Pterodactyl\Models\Server;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Illuminate\Database\ConnectionInterface; use Illuminate\Database\ConnectionInterface;
use Illuminate\Log\Writer;
use Mockery as m;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\Server;
use Pterodactyl\Services\Servers\SuspensionService; use Pterodactyl\Services\Servers\SuspensionService;
use Tests\TestCase; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface;
class SuspensionServiceTest extends TestCase class SuspensionServiceTest extends TestCase
{ {
@ -127,9 +127,8 @@ class SuspensionServiceTest extends TestCase
$this->assertTrue($this->service->toggle($this->server)); $this->assertTrue($this->service->toggle($this->server));
} }
/** /**
* Test that server is unsuspended if action=unsuspend * Test that server is unsuspended if action=unsuspend.
*/ */
public function testServerShouldBeUnsuspendedWhenUnsuspendActionIsPassed() public function testServerShouldBeUnsuspendedWhenUnsuspendActionIsPassed()
{ {
@ -148,7 +147,7 @@ class SuspensionServiceTest extends TestCase
} }
/** /**
* Test that nothing happens if a server is already unsuspended and action=unsuspend * Test that nothing happens if a server is already unsuspended and action=unsuspend.
*/ */
public function testNoActionShouldHappenIfServerIsAlreadyUnsuspendedAndActionIsUnsuspend() public function testNoActionShouldHappenIfServerIsAlreadyUnsuspendedAndActionIsUnsuspend()
{ {
@ -158,7 +157,7 @@ class SuspensionServiceTest extends TestCase
} }
/** /**
* Test that nothing happens if a server is already suspended and action=suspend * Test that nothing happens if a server is already suspended and action=suspend.
*/ */
public function testNoActionShouldHappenIfServerIsAlreadySuspendedAndActionIsSuspend() public function testNoActionShouldHappenIfServerIsAlreadySuspendedAndActionIsSuspend()
{ {
@ -191,7 +190,7 @@ class SuspensionServiceTest extends TestCase
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertInstanceOf(DisplayException::class, $exception); $this->assertInstanceOf(DisplayException::class, $exception);
$this->assertEquals( $this->assertEquals(
trans('admin/server.exceptions.daemon_exception', ['code' => 400,]), $exception->getMessage() trans('admin/server.exceptions.daemon_exception', ['code' => 400]), $exception->getMessage()
); );
} }
} }

View file

@ -149,15 +149,15 @@ class VariableValidatorServiceTest extends TestCase
$this->validator->shouldReceive('make')->with([ $this->validator->shouldReceive('make')->with([
'variable_value' => 'Test_SomeValue_0', 'variable_value' => 'Test_SomeValue_0',
], [ ], [
'variable_value' => $this->variables{0}->rules, 'variable_value' => $this->variables[0]->rules,
])->once()->andReturnSelf() ])->once()->andReturnSelf()
->shouldReceive('fails')->withNoArgs()->once()->andReturn(false); ->shouldReceive('fails')->withNoArgs()->once()->andReturn(false);
$response = $this->service->setFields([ $response = $this->service->setFields([
$this->variables{0}->env_variable => 'Test_SomeValue_0', $this->variables[0]->env_variable => 'Test_SomeValue_0',
$this->variables{1}->env_variable => 'Test_SomeValue_1', $this->variables[1]->env_variable => 'Test_SomeValue_1',
$this->variables{2}->env_variable => 'Test_SomeValue_2', $this->variables[2]->env_variable => 'Test_SomeValue_2',
$this->variables{3}->env_variable => 'Test_SomeValue_3', $this->variables[3]->env_variable => 'Test_SomeValue_3',
])->validate(1)->getResults(); ])->validate(1)->getResults();
$this->assertEquals(1, count($response), 'Assert response has a single item in array.'); $this->assertEquals(1, count($response), 'Assert response has a single item in array.');
@ -166,8 +166,8 @@ class VariableValidatorServiceTest extends TestCase
$this->assertArrayHasKey('key', $response[0]); $this->assertArrayHasKey('key', $response[0]);
$this->assertArrayHasKey('value', $response[0]); $this->assertArrayHasKey('value', $response[0]);
$this->assertEquals($this->variables{0}->id, $response[0]['id']); $this->assertEquals($this->variables[0]->id, $response[0]['id']);
$this->assertEquals($this->variables{0}->env_variable, $response[0]['key']); $this->assertEquals($this->variables[0]->env_variable, $response[0]['key']);
$this->assertEquals('Test_SomeValue_0', $response[0]['value']); $this->assertEquals('Test_SomeValue_0', $response[0]['value']);
} }
@ -178,32 +178,32 @@ class VariableValidatorServiceTest extends TestCase
{ {
$this->optionVariableRepository->shouldReceive('findWhere')->with([['option_id', '=', 1]])->andReturn($this->variables); $this->optionVariableRepository->shouldReceive('findWhere')->with([['option_id', '=', 1]])->andReturn($this->variables);
foreach($this->variables as $key => $variable) { foreach ($this->variables as $key => $variable) {
$this->validator->shouldReceive('make')->with([ $this->validator->shouldReceive('make')->with([
'variable_value' => 'Test_SomeValue_' . $key, 'variable_value' => 'Test_SomeValue_' . $key,
], [ ], [
'variable_value' => $this->variables{$key}->rules, 'variable_value' => $this->variables[$key]->rules,
])->andReturnSelf() ])->andReturnSelf()
->shouldReceive('fails')->withNoArgs()->once()->andReturn(false); ->shouldReceive('fails')->withNoArgs()->once()->andReturn(false);
} }
$response = $this->service->isAdmin()->setFields([ $response = $this->service->isAdmin()->setFields([
$this->variables{0}->env_variable => 'Test_SomeValue_0', $this->variables[0]->env_variable => 'Test_SomeValue_0',
$this->variables{1}->env_variable => 'Test_SomeValue_1', $this->variables[1]->env_variable => 'Test_SomeValue_1',
$this->variables{2}->env_variable => 'Test_SomeValue_2', $this->variables[2]->env_variable => 'Test_SomeValue_2',
$this->variables{3}->env_variable => 'Test_SomeValue_3', $this->variables[3]->env_variable => 'Test_SomeValue_3',
])->validate(1)->getResults(); ])->validate(1)->getResults();
$this->assertEquals(4, count($response), 'Assert response has all four items in array.'); $this->assertEquals(4, count($response), 'Assert response has all four items in array.');
foreach($response as $key => $values) { foreach ($response as $key => $values) {
$this->assertArrayHasKey($key, $response); $this->assertArrayHasKey($key, $response);
$this->assertArrayHasKey('id', $response[$key]); $this->assertArrayHasKey('id', $response[$key]);
$this->assertArrayHasKey('key', $response[$key]); $this->assertArrayHasKey('key', $response[$key]);
$this->assertArrayHasKey('value', $response[$key]); $this->assertArrayHasKey('value', $response[$key]);
$this->assertEquals($this->variables{$key}->id, $response[$key]['id']); $this->assertEquals($this->variables[$key]->id, $response[$key]['id']);
$this->assertEquals($this->variables{$key}->env_variable, $response[$key]['key']); $this->assertEquals($this->variables[$key]->env_variable, $response[$key]['key']);
$this->assertEquals('Test_SomeValue_' . $key, $response[$key]['value']); $this->assertEquals('Test_SomeValue_' . $key, $response[$key]['value']);
} }
} }
@ -218,7 +218,7 @@ class VariableValidatorServiceTest extends TestCase
$this->validator->shouldReceive('make')->with([ $this->validator->shouldReceive('make')->with([
'variable_value' => null, 'variable_value' => null,
], [ ], [
'variable_value' => $this->variables{0}->rules, 'variable_value' => $this->variables[0]->rules,
])->once()->andReturnSelf() ])->once()->andReturnSelf()
->shouldReceive('fails')->withNoArgs()->once()->andReturn(true); ->shouldReceive('fails')->withNoArgs()->once()->andReturn(true);
@ -227,7 +227,7 @@ class VariableValidatorServiceTest extends TestCase
try { try {
$this->service->setFields([ $this->service->setFields([
$this->variables{0}->env_variable => null, $this->variables[0]->env_variable => null,
])->validate(1); ])->validate(1);
} catch (DisplayValidationException $exception) { } catch (DisplayValidationException $exception) {
$decoded = json_decode($exception->getMessage()); $decoded = json_decode($exception->getMessage());
@ -235,7 +235,7 @@ class VariableValidatorServiceTest extends TestCase
$this->assertEquals(0, json_last_error(), 'Assert that response is decodable JSON.'); $this->assertEquals(0, json_last_error(), 'Assert that response is decodable JSON.');
$this->assertObjectHasAttribute('notice', $decoded); $this->assertObjectHasAttribute('notice', $decoded);
$this->assertEquals( $this->assertEquals(
trans('admin/server.exceptions.bad_variable', ['name' => $this->variables{0}->name]), trans('admin/server.exceptions.bad_variable', ['name' => $this->variables[0]->name]),
$decoded->notice[0] $decoded->notice[0]
); );
} }

View file

@ -25,13 +25,13 @@
namespace Tests\Unit\Services; namespace Tests\Unit\Services;
use Mockery as m; use Mockery as m;
use Pterodactyl\Services\Users\CreationService;
use Tests\TestCase; use Tests\TestCase;
use Illuminate\Foundation\Application; use Illuminate\Foundation\Application;
use Illuminate\Contracts\Hashing\Hasher; use Illuminate\Contracts\Hashing\Hasher;
use Illuminate\Database\ConnectionInterface; use Illuminate\Database\ConnectionInterface;
use Illuminate\Notifications\ChannelManager; use Illuminate\Notifications\ChannelManager;
use Pterodactyl\Notifications\AccountCreated; use Pterodactyl\Notifications\AccountCreated;
use Pterodactyl\Services\Users\CreationService;
use Pterodactyl\Services\Helpers\TemporaryPasswordService; use Pterodactyl\Services\Helpers\TemporaryPasswordService;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface; use Pterodactyl\Contracts\Repository\UserRepositoryInterface;

View file

@ -24,13 +24,13 @@
namespace Tests\Unit\Services\Users; namespace Tests\Unit\Services\Users;
use Illuminate\Contracts\Translation\Translator;
use Mockery as m; use Mockery as m;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Tests\TestCase;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Services\Users\DeletionService; use Pterodactyl\Services\Users\DeletionService;
use Tests\TestCase; use Illuminate\Contracts\Translation\Translator;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
class DeletionServiceTest extends TestCase class DeletionServiceTest extends TestCase
{ {

View file

@ -24,11 +24,11 @@
namespace Tests\Unit\Services\Users; namespace Tests\Unit\Services\Users;
use Illuminate\Contracts\Hashing\Hasher;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Services\Users\UpdateService;
use Tests\TestCase;
use Mockery as m; use Mockery as m;
use Tests\TestCase;
use Illuminate\Contracts\Hashing\Hasher;
use Pterodactyl\Services\Users\UpdateService;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
class UpdateServiceTest extends TestCase class UpdateServiceTest extends TestCase
{ {