Use more standardized phpcs
This commit is contained in:
parent
a043071e3c
commit
c449ca5155
493 changed files with 1116 additions and 3903 deletions
|
@ -15,7 +15,9 @@ use Pterodactyl\Tests\Traits\Http\IntegrationJsonRequestAssertions;
|
|||
|
||||
abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase
|
||||
{
|
||||
use CreatesTestModels, DatabaseTransactions, IntegrationJsonRequestAssertions;
|
||||
use CreatesTestModels;
|
||||
use DatabaseTransactions;
|
||||
use IntegrationJsonRequestAssertions;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Models\ApiKey
|
||||
|
@ -44,17 +46,11 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase
|
|||
$this->withMiddleware('api..key:' . ApiKey::TYPE_APPLICATION);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Pterodactyl\Models\User
|
||||
*/
|
||||
public function getApiUser(): User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Pterodactyl\Models\ApiKey
|
||||
*/
|
||||
public function getApiKey(): ApiKey
|
||||
{
|
||||
return $this->key;
|
||||
|
@ -62,10 +58,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase
|
|||
|
||||
/**
|
||||
* Creates a new default API key and refreshes the headers using it.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @param array $permissions
|
||||
* @return \Pterodactyl\Models\ApiKey
|
||||
*/
|
||||
protected function createNewDefaultApiKey(User $user, array $permissions = []): ApiKey
|
||||
{
|
||||
|
@ -77,8 +69,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase
|
|||
|
||||
/**
|
||||
* Refresh the authorization header for a request to use a different API key.
|
||||
*
|
||||
* @param \Pterodactyl\Models\ApiKey $key
|
||||
*/
|
||||
protected function refreshHeaders(ApiKey $key)
|
||||
{
|
||||
|
@ -87,8 +77,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase
|
|||
|
||||
/**
|
||||
* Create an administrative user.
|
||||
*
|
||||
* @return \Pterodactyl\Models\User
|
||||
*/
|
||||
protected function createApiUser(): User
|
||||
{
|
||||
|
@ -99,10 +87,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase
|
|||
|
||||
/**
|
||||
* Create a new application API key for a given user model.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @param array $permissions
|
||||
* @return \Pterodactyl\Models\ApiKey
|
||||
*/
|
||||
protected function createApiKey(User $user, array $permissions = []): ApiKey
|
||||
{
|
||||
|
@ -123,9 +107,6 @@ abstract class ApplicationApiIntegrationTestCase extends IntegrationTestCase
|
|||
|
||||
/**
|
||||
* Return a transformer that can be used for testing purposes.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @return \Pterodactyl\Transformers\Api\Application\BaseTransformer
|
||||
*/
|
||||
protected function getTransformer(string $abstract): BaseTransformer
|
||||
{
|
||||
|
|
|
@ -61,7 +61,9 @@ class EggControllerTest extends ApplicationApiIntegrationTestCase
|
|||
$expected = json_encode(Arr::sortRecursive($datum['attributes']));
|
||||
$actual = json_encode(Arr::sortRecursive($this->getTransformer(EggTransformer::class)->transform($egg)));
|
||||
|
||||
$this->assertSame($expected, $actual,
|
||||
$this->assertSame(
|
||||
$expected,
|
||||
$actual,
|
||||
'Unable to find JSON fragment: ' . PHP_EOL . PHP_EOL . "[{$expected}]" . PHP_EOL . PHP_EOL . 'within' . PHP_EOL . PHP_EOL . "[{$actual}]."
|
||||
);
|
||||
}
|
||||
|
|
|
@ -292,9 +292,6 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
|||
* Test that an API key without write permissions cannot create, update, or
|
||||
* delete a user model.
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $url
|
||||
*
|
||||
* @dataProvider userWriteEndpointsDataProvider
|
||||
*/
|
||||
public function testApiKeyWithoutWritePermissions(string $method, string $url)
|
||||
|
@ -313,8 +310,6 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
|
|||
/**
|
||||
* Endpoints that should return a 403 error when the key does not have write
|
||||
* permissions for user management.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function userWriteEndpointsDataProvider(): array
|
||||
{
|
||||
|
|
Reference in a new issue