Fix failing ApiKeyCreationService test

This commit is contained in:
Dane Everitt 2018-01-13 16:23:43 -06:00
parent e3df0738da
commit e0fb7fa30c
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 35 additions and 50 deletions

View file

@ -3,17 +3,11 @@
namespace Pterodactyl\Services\Api;
use Pterodactyl\Models\APIKey;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Contracts\Encryption\Encrypter;
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
class KeyCreationService
{
/**
* @var \Illuminate\Database\ConnectionInterface
*/
private $connection;
/**
* @var \Illuminate\Contracts\Encryption\Encrypter
*/
@ -28,17 +22,12 @@ class KeyCreationService
* ApiKeyService constructor.
*
* @param \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface $repository
* @param \Illuminate\Database\ConnectionInterface $connection
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
*/
public function __construct(
ApiKeyRepositoryInterface $repository,
ConnectionInterface $connection,
Encrypter $encrypter
) {
$this->repository = $repository;
$this->connection = $connection;
public function __construct(ApiKeyRepositoryInterface $repository, Encrypter $encrypter)
{
$this->encrypter = $encrypter;
$this->repository = $repository;
}
/**
@ -54,7 +43,7 @@ class KeyCreationService
public function handle(array $data): APIKey
{
$data = array_merge($data, [
'identifer' => str_random(APIKey::IDENTIFIER_LENGTH),
'identifier' => str_random(APIKey::IDENTIFIER_LENGTH),
'token' => $this->encrypter->encrypt(str_random(APIKey::KEY_LENGTH)),
]);