Run cs-fixer on files
This commit is contained in:
parent
afd0a8f768
commit
fb1f75353d
17 changed files with 25 additions and 50 deletions
17
.github/workflows/tests.yml
vendored
17
.github/workflows/tests.yml
vendored
|
@ -12,8 +12,8 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: [ 7.4, 8.0 ]
|
||||
database: [ 'mariadb:10.2', 'mysql:8' ]
|
||||
php: [ 7.4, 8.0, 8.1 ]
|
||||
database: [ 'mariadb:10.6', 'mysql:8' ]
|
||||
services:
|
||||
database:
|
||||
image: ${{ matrix.database }}
|
||||
|
@ -51,21 +51,14 @@ jobs:
|
|||
run: composer install --prefer-dist --no-interaction --no-progress
|
||||
- name: Run cs-fixer
|
||||
run: vendor/bin/php-cs-fixer fix --dry-run --diff --format=txt --config .php-cs-fixer.dist.php
|
||||
continue-on-error: true
|
||||
- name: Static Analysis
|
||||
if: ${{ matrix.php }} == '8.0'
|
||||
run: |
|
||||
php artisan ide-helper:models -N
|
||||
./vendor/bin/phpstan analyse --memory-limit=2G
|
||||
env:
|
||||
TESTING_DB_PORT: ${{ job.services.database.ports[3306] }}
|
||||
- name: Execute Unit Tests
|
||||
run: php artisan test tests/Unit
|
||||
if: ${{ always() }}
|
||||
env:
|
||||
DB_PORT: ${{ job.services.database.ports[3306] }}
|
||||
- name: Execute Integration Tests
|
||||
run: php artisan test tests/Integration
|
||||
if: ${{ always() }}
|
||||
DB_PORT: ${{ job.services.database.ports[3306] }}
|
||||
- name: Execute Tests
|
||||
run: php artisan test
|
||||
env:
|
||||
DB_PORT: ${{ job.services.database.ports[3306] }}
|
||||
|
|
|
@ -119,6 +119,7 @@ class AppSettingsCommand extends Command
|
|||
foreach ($validator->errors()->all() as $error) {
|
||||
$this->output->error($error);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ use Pterodactyl\Exceptions\Http\QueryValueOutOfRangeHttpException;
|
|||
use Pterodactyl\Http\Requests\Api\Application\Eggs\GetEggsRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Eggs\StoreEggRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Eggs\DeleteEggRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Eggs\UpdateEggRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Eggs\ExportEggRequest;
|
||||
use Pterodactyl\Http\Requests\Api\Application\Eggs\UpdateEggRequest;
|
||||
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
|
||||
|
||||
class EggController extends ApplicationApiController
|
||||
|
|
|
@ -7,12 +7,9 @@ use Illuminate\Support\Str;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Pterodactyl\Models\SecurityKey;
|
||||
use Nyholm\Psr7\Factory\Psr17Factory;
|
||||
use Illuminate\Contracts\Cache\Repository;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Webauthn\PublicKeyCredentialCreationOptions;
|
||||
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
|
||||
use Pterodactyl\Transformers\Api\Client\SecurityKeyTransformer;
|
||||
use Pterodactyl\Repositories\SecurityKeys\WebauthnServerRepository;
|
||||
use Pterodactyl\Services\Users\SecurityKeys\StoreSecurityKeyService;
|
||||
|
|
|
@ -4,10 +4,10 @@ namespace Pterodactyl\Http\Controllers\Auth;
|
|||
|
||||
use Carbon\CarbonImmutable;
|
||||
use Carbon\CarbonInterface;
|
||||
use Pterodactyl\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use PragmaRX\Google2FA\Google2FA;
|
||||
use Pterodactyl\Models\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use PragmaRX\Google2FA\Google2FA;
|
||||
use Pterodactyl\Models\SecurityKey;
|
||||
use Illuminate\Contracts\Encryption\Encrypter;
|
||||
use Webauthn\PublicKeyCredentialRequestOptions;
|
||||
|
|
|
@ -19,9 +19,6 @@ class LoginController extends AbstractLoginController
|
|||
|
||||
protected GeneratePublicKeyCredentialsRequestService $service;
|
||||
|
||||
/**
|
||||
* @param \Pterodactyl\Services\Users\SecurityKeys\GeneratePublicKeyCredentialsRequestService $service
|
||||
*/
|
||||
public function __construct(GeneratePublicKeyCredentialsRequestService $service)
|
||||
{
|
||||
parent::__construct();
|
||||
|
|
|
@ -113,9 +113,6 @@ class SecurityKey extends Model
|
|||
|
||||
/**
|
||||
* Returns a PSR17 Request factory to be used by different Webauthn tooling.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Psr\Http\Message\ServerRequestInterface
|
||||
*/
|
||||
public static function getPsrRequestFactory(Request $request): ServerRequestInterface
|
||||
{
|
||||
|
|
|
@ -231,9 +231,6 @@ class User extends Model implements
|
|||
->groupBy('servers.id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Webauthn\PublicKeyCredentialUserEntity
|
||||
*/
|
||||
public function toPublicKeyCredentialEntity(): PublicKeyCredentialUserEntity
|
||||
{
|
||||
return new PublicKeyCredentialUserEntity($this->username, $this->uuid, $this->email, null);
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
|
||||
namespace Pterodactyl\Repositories\SecurityKeys;
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Pterodactyl\Models\User;
|
||||
use Illuminate\Container\Container;
|
||||
use Pterodactyl\Models\SecurityKey;
|
||||
use Webauthn\PublicKeyCredentialSource;
|
||||
use Webauthn\PublicKeyCredentialUserEntity;
|
||||
use Pterodactyl\Models\SecurityKey;
|
||||
use Webauthn\PublicKeyCredentialSourceRepository as PublicKeyRepositoryInterface;
|
||||
|
||||
class PublicKeyCredentialSourceRepository implements PublicKeyRepositoryInterface
|
||||
|
|
|
@ -20,7 +20,8 @@ class SuspensionService
|
|||
/**
|
||||
* SuspensionService constructor.
|
||||
*/
|
||||
public function __construct(DaemonServerRepository $daemonServerRepository) {
|
||||
public function __construct(DaemonServerRepository $daemonServerRepository)
|
||||
{
|
||||
$this->daemonServerRepository = $daemonServerRepository;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,18 +11,11 @@ class GeneratePublicKeyCredentialsRequestService
|
|||
{
|
||||
protected WebauthnServerRepository $serverRepository;
|
||||
|
||||
/**
|
||||
* @param \Pterodactyl\Repositories\SecurityKeys\WebauthnServerRepository $serverRepository
|
||||
*/
|
||||
public function __construct(WebauthnServerRepository $serverRepository)
|
||||
{
|
||||
$this->serverRepository = $serverRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return \Webauthn\PublicKeyCredentialRequestOptions
|
||||
*/
|
||||
public function handle(User $user): PublicKeyCredentialRequestOptions
|
||||
{
|
||||
$credentials = $user->securityKeys->map(function (SecurityKey $key) {
|
||||
|
@ -31,7 +24,8 @@ class GeneratePublicKeyCredentialsRequestService
|
|||
|
||||
$response = $this->serverRepository->getServer($user)
|
||||
->generatePublicKeyCredentialRequestOptions(
|
||||
PublicKeyCredentialRequestOptions::USER_VERIFICATION_REQUIREMENT_PREFERRED, $credentials
|
||||
PublicKeyCredentialRequestOptions::USER_VERIFICATION_REQUIREMENT_PREFERRED,
|
||||
$credentials
|
||||
);
|
||||
|
||||
return $response->setTimeout(300);
|
||||
|
|
|
@ -26,7 +26,6 @@ class SecurityKeyFactory extends Factory
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return $this
|
||||
*/
|
||||
public function withUser(User $user): self
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSecurityKeysTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MakeStartupFieldNullableOnServersTable extends Migration
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class DropWebauthnKeysTable extends Migration
|
||||
{
|
||||
|
|
|
@ -4,9 +4,9 @@ namespace Pterodactyl\Tests\Integration\Api\Application\Location;
|
|||
|
||||
use Illuminate\Http\Response;
|
||||
use Pterodactyl\Models\Location;
|
||||
use Pterodactyl\Transformers\Api\Application\LocationTransformer;
|
||||
use Pterodactyl\Transformers\Api\Application\NodeTransformer;
|
||||
use Pterodactyl\Transformers\Api\Application\ServerTransformer;
|
||||
use Pterodactyl\Transformers\Api\Application\LocationTransformer;
|
||||
use Pterodactyl\Tests\Integration\Api\Application\ApplicationApiIntegrationTestCase;
|
||||
|
||||
class LocationControllerTest extends ApplicationApiIntegrationTestCase
|
||||
|
@ -128,13 +128,13 @@ class LocationControllerTest extends ApplicationApiIntegrationTestCase
|
|||
|
||||
$response = $this->patchJson('/api/application/locations/' . $location->id, [
|
||||
'short' => 'new inhouse',
|
||||
'long' => 'This is my new inhouse location'
|
||||
'long' => 'This is my new inhouse location',
|
||||
]);
|
||||
$response->assertStatus(Response::HTTP_OK);
|
||||
$response->assertJsonCount(2);
|
||||
$response->assertJsonStructure([
|
||||
'object',
|
||||
'attributes' => ['id', 'short', 'long', 'created_at', 'updated_at']
|
||||
'attributes' => ['id', 'short', 'long', 'created_at', 'updated_at'],
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('locations', ['short' => 'new inhouse', 'long' => 'This is my new inhouse location']);
|
||||
|
|
Loading…
Reference in a new issue