Fix test coverage for creating account API keys

This commit is contained in:
Dane Everitt 2021-08-07 15:20:43 -07:00
parent 3d14974d64
commit 815ce0e451
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
6 changed files with 62 additions and 148 deletions

View file

@ -0,0 +1,28 @@
<?php
namespace Database\Factories;
use Illuminate\Support\Str;
use Pterodactyl\Models\PersonalAccessToken;
use Illuminate\Database\Eloquent\Factories\Factory;
class PersonalAccessTokenFactory extends Factory
{
/**
* @var string
*/
protected $model = PersonalAccessToken::class;
/**
* @return array
*/
public function definition()
{
return [
'token_id' => PersonalAccessToken::generateTokenIdentifier(),
'token' => hash('sha256', Str::random(PersonalAccessToken::TOKEN_LENGTH)),
'description' => 'Generated test token',
'abilities' => ['*'],
];
}
}