Refactor (again)

This commit is contained in:
Dane Everitt 2017-07-09 12:29:18 -05:00
parent 8953f83f87
commit 1f4f6024cc
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
10 changed files with 29 additions and 29 deletions

View File

@ -22,13 +22,13 @@
* SOFTWARE. * SOFTWARE.
*/ */
namespace Pterodactyl\Services; namespace Pterodactyl\Services\Api;
use Illuminate\Database\ConnectionInterface; use Illuminate\Database\ConnectionInterface;
use Illuminate\Contracts\Encryption\Encrypter; use Illuminate\Contracts\Encryption\Encrypter;
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface; use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
class ApiKeyService class KeyService
{ {
const PUB_CRYPTO_BYTES = 8; const PUB_CRYPTO_BYTES = 8;
const PRIV_CRYPTO_BYTES = 32; const PRIV_CRYPTO_BYTES = 32;
@ -44,7 +44,7 @@ class ApiKeyService
protected $encrypter; protected $encrypter;
/** /**
* @var \Pterodactyl\Services\ApiPermissionService * @var \Pterodactyl\Services\Api\PermissionService
*/ */
protected $permissionService; protected $permissionService;
@ -59,13 +59,13 @@ class ApiKeyService
* @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository * @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository
* @param \Illuminate\Database\ConnectionInterface $database * @param \Illuminate\Database\ConnectionInterface $database
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter * @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
* @param \Pterodactyl\Services\ApiPermissionService $permissionService * @param \Pterodactyl\Services\Api\PermissionService $permissionService
*/ */
public function __construct( public function __construct(
ApiKeyRepositoryInterface $repository, ApiKeyRepositoryInterface $repository,
ConnectionInterface $database, ConnectionInterface $database,
Encrypter $encrypter, Encrypter $encrypter,
ApiPermissionService $permissionService PermissionService $permissionService
) { ) {
$this->repository = $repository; $this->repository = $repository;
$this->database = $database; $this->database = $database;

View File

@ -22,11 +22,11 @@
* SOFTWARE. * SOFTWARE.
*/ */
namespace Pterodactyl\Services; namespace Pterodactyl\Services\Api;
use Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface; use Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface;
class ApiPermissionService class PermissionService
{ {
/** /**
* @var \Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface * @var \Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface

View File

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
namespace Pterodactyl\Services\Administrative; namespace Pterodactyl\Services\Database;
use Illuminate\Database\DatabaseManager; use Illuminate\Database\DatabaseManager;
use Illuminate\Contracts\Encryption\Encrypter; use Illuminate\Contracts\Encryption\Encrypter;

View File

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
namespace Pterodactyl\Services\Administrative; namespace Pterodactyl\Services;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface; use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;

View File

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
namespace Pterodactyl\Services\Administrative; namespace Pterodactyl\Services;
use Illuminate\Foundation\Application; use Illuminate\Foundation\Application;
use Illuminate\Contracts\Hashing\Hasher; use Illuminate\Contracts\Hashing\Hasher;

View File

@ -22,18 +22,18 @@
* SOFTWARE. * SOFTWARE.
*/ */
namespace Tests\Unit\Services; namespace Tests\Unit\Services\Api;
use Illuminate\Contracts\Encryption\Encrypter; use Illuminate\Contracts\Encryption\Encrypter;
use Illuminate\Database\ConnectionInterface; use Illuminate\Database\ConnectionInterface;
use Mockery as m; use Mockery as m;
use phpmock\phpunit\PHPMock; use phpmock\phpunit\PHPMock;
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface; use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
use Pterodactyl\Services\ApiKeyService; use Pterodactyl\Services\Api\KeyService;
use Pterodactyl\Services\ApiPermissionService; use Pterodactyl\Services\Api\PermissionService;
use Tests\TestCase; use Tests\TestCase;
class ApiKeyServiceTest extends TestCase class KeyServiceTest extends TestCase
{ {
use PHPMock; use PHPMock;
@ -48,7 +48,7 @@ class ApiKeyServiceTest extends TestCase
protected $encrypter; protected $encrypter;
/** /**
* @var \Pterodactyl\Services\ApiPermissionService * @var \Pterodactyl\Services\Api\PermissionService
*/ */
protected $permissions; protected $permissions;
@ -58,7 +58,7 @@ class ApiKeyServiceTest extends TestCase
protected $repository; protected $repository;
/** /**
* @var \Pterodactyl\Services\ApiKeyService * @var \Pterodactyl\Services\Api\KeyService
*/ */
protected $service; protected $service;
@ -68,10 +68,10 @@ class ApiKeyServiceTest extends TestCase
$this->database = m::mock(ConnectionInterface::class); $this->database = m::mock(ConnectionInterface::class);
$this->encrypter = m::mock(Encrypter::class); $this->encrypter = m::mock(Encrypter::class);
$this->permissions = m::mock(ApiPermissionService::class); $this->permissions = m::mock(PermissionService::class);
$this->repository = m::mock(ApiKeyRepositoryInterface::class); $this->repository = m::mock(ApiKeyRepositoryInterface::class);
$this->service = new ApiKeyService( $this->service = new KeyService(
$this->repository, $this->database, $this->encrypter, $this->permissions $this->repository, $this->database, $this->encrypter, $this->permissions
); );
} }
@ -81,7 +81,7 @@ class ApiKeyServiceTest extends TestCase
*/ */
public function test_create_function() public function test_create_function()
{ {
$this->getFunctionMock('\\Pterodactyl\\Services', 'random_bytes') $this->getFunctionMock('\\Pterodactyl\\Services\\Api', 'random_bytes')
->expects($this->exactly(2)) ->expects($this->exactly(2))
->willReturnCallback(function ($bytes) { ->willReturnCallback(function ($bytes) {
return hex2bin(str_pad('', $bytes * 2, '0')); return hex2bin(str_pad('', $bytes * 2, '0'));

View File

@ -27,10 +27,10 @@ namespace Tests\Unit\Services;
use Mockery as m; use Mockery as m;
use Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface; use Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface;
use Pterodactyl\Models\APIPermission; use Pterodactyl\Models\APIPermission;
use Pterodactyl\Services\ApiPermissionService; use Pterodactyl\Services\Api\PermissionService;
use Tests\TestCase; use Tests\TestCase;
class ApiPermissionServiceTest extends TestCase class PermissionServiceTest extends TestCase
{ {
/** /**
* @var \Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface * @var \Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface
@ -38,7 +38,7 @@ class ApiPermissionServiceTest extends TestCase
protected $repository; protected $repository;
/** /**
* @var \Pterodactyl\Services\ApiPermissionService * @var \Pterodactyl\Services\Api\PermissionService
*/ */
protected $service; protected $service;
@ -50,7 +50,7 @@ class ApiPermissionServiceTest extends TestCase
parent::setUp(); parent::setUp();
$this->repository = m::mock(ApiPermissionRepositoryInterface::class); $this->repository = m::mock(ApiPermissionRepositoryInterface::class);
$this->service = new ApiPermissionService($this->repository); $this->service = new PermissionService($this->repository);
} }
/** /**

View File

@ -30,7 +30,7 @@ use Illuminate\Database\DatabaseManager;
use Illuminate\Contracts\Encryption\Encrypter; use Illuminate\Contracts\Encryption\Encrypter;
use Pterodactyl\Extensions\DynamicDatabaseConnection; use Pterodactyl\Extensions\DynamicDatabaseConnection;
use Pterodactyl\Contracts\Repository\DatabaseHostInterface; use Pterodactyl\Contracts\Repository\DatabaseHostInterface;
use Pterodactyl\Services\Administrative\DatabaseHostService; use Pterodactyl\Services\Database\DatabaseHostService;
class DatabaseHostServiceTest extends TestCase class DatabaseHostServiceTest extends TestCase
{ {
@ -55,7 +55,7 @@ class DatabaseHostServiceTest extends TestCase
protected $repository; protected $repository;
/** /**
* @var \Pterodactyl\Services\Administrative\DatabaseHostService * @var \Pterodactyl\Services\Database\DatabaseHostService
*/ */
protected $service; protected $service;

View File

@ -26,7 +26,7 @@ namespace Tests\Unit\Services;
use Mockery as m; use Mockery as m;
use Tests\TestCase; use Tests\TestCase;
use Pterodactyl\Services\Administrative\LocationService; use Pterodactyl\Services\LocationService;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface; use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
class LocationServiceTest extends TestCase class LocationServiceTest extends TestCase
@ -37,7 +37,7 @@ class LocationServiceTest extends TestCase
protected $repository; protected $repository;
/** /**
* @var \Pterodactyl\Services\Administrative\LocationService * @var \Pterodactyl\Services\LocationService
*/ */
protected $service; protected $service;

View File

@ -31,7 +31,7 @@ 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\Administrative\UserService; use Pterodactyl\Services\UserService;
use Pterodactyl\Services\Helpers\TemporaryPasswordService; use Pterodactyl\Services\Helpers\TemporaryPasswordService;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface; use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
@ -68,7 +68,7 @@ class UserServiceTest extends TestCase
protected $repository; protected $repository;
/** /**
* @var \Pterodactyl\Services\Administrative\UserService * @var \Pterodactyl\Services\UserService
*/ */
protected $service; protected $service;