Use more standardized phpcs

This commit is contained in:
Dane Everitt 2021-01-23 12:33:34 -08:00
parent a043071e3c
commit c449ca5155
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
493 changed files with 1116 additions and 3903 deletions

View file

@ -48,8 +48,6 @@ class AdminAuthenticateTest extends MiddlewareTestCase
/**
* Return an instance of the middleware using mocked dependencies.
*
* @return \Pterodactyl\Http\Middleware\AdminAuthenticate
*/
private function getMiddleware(): AdminAuthenticate
{

View file

@ -44,11 +44,9 @@ class AuthenticateUserTest extends MiddlewareTestCase
/**
* Return an instance of the middleware for testing.
*
* @return \Pterodactyl\Http\Middleware\Api\Application\AuthenticateApplicationUser
*/
private function getMiddleware(): AuthenticateApplicationUser
{
return new AuthenticateApplicationUser;
return new AuthenticateApplicationUser();
}
}

View file

@ -65,8 +65,6 @@ class AuthenticateIPAccessTest extends MiddlewareTestCase
/**
* Return an instance of the middleware to be used when testing.
*
* @return \Pterodactyl\Http\Middleware\Api\AuthenticateIPAccess
*/
private function getMiddleware(): AuthenticateIPAccess
{

View file

@ -68,7 +68,7 @@ class AuthenticateKeyTest extends MiddlewareTestCase
$this->expectException(AccessDeniedHttpException::class);
$this->request->shouldReceive('bearerToken')->withNoArgs()->twice()->andReturn('abcd1234');
$this->repository->shouldReceive('findFirstWhere')->andThrow(new RecordNotFoundException);
$this->repository->shouldReceive('findFirstWhere')->andThrow(new RecordNotFoundException());
$this->getMiddleware()->handle($this->request, $this->getClosureAssertions(), ApiKey::TYPE_APPLICATION);
}
@ -160,8 +160,6 @@ class AuthenticateKeyTest extends MiddlewareTestCase
/**
* Return an instance of the middleware with mocked dependencies for testing.
*
* @return \Pterodactyl\Http\Middleware\Api\AuthenticateKey
*/
private function getMiddleware(): AuthenticateKey
{

View file

@ -70,7 +70,6 @@ class DaemonAuthenticateTest extends MiddlewareTestCase
* Test that passing in an invalid node daemon secret will result in a bad request
* exception being returned.
*
* @param string $token
* @dataProvider badTokenDataProvider
*/
public function testResponseShouldFailIfTokenFormatIsIncorrect(string $token)
@ -159,8 +158,6 @@ class DaemonAuthenticateTest extends MiddlewareTestCase
/**
* Return an instance of the middleware using mocked dependencies.
*
* @return \Pterodactyl\Http\Middleware\Api\Daemon\DaemonAuthenticate
*/
private function getMiddleware(): DaemonAuthenticate
{

View file

@ -36,8 +36,6 @@ class SetSessionDriverTest extends MiddlewareTestCase
/**
* Return an instance of the middleware with mocked dependencies for testing.
*
* @return \Pterodactyl\Http\Middleware\Api\SetSessionDriver
*/
private function getMiddleware(): SetSessionDriver
{

View file

@ -31,8 +31,6 @@ class AuthenticateTest extends MiddlewareTestCase
/**
* Return an instance of the middleware using mocked dependencies.
*
* @return \Pterodactyl\Http\Middleware\Authenticate
*/
private function getMiddleware(): Authenticate
{

View file

@ -50,8 +50,6 @@ class LanguageMiddlewareTest extends MiddlewareTestCase
/**
* Return an instance of the middleware using mocked dependencies.
*
* @return \Pterodactyl\Http\Middleware\LanguageMiddleware
*/
private function getMiddleware(): LanguageMiddleware
{

View file

@ -54,15 +54,12 @@ class MaintenanceMiddlewareTest extends MiddlewareTestCase
$this->response->shouldReceive('view')
->once()
->with('errors.maintenance')
->andReturn(new Response);
->andReturn(new Response());
$response = $this->getMiddleware()->handle($this->request, $this->getClosureAssertions());
$this->assertInstanceOf(Response::class, $response);
}
/**
* @return \Pterodactyl\Http\Middleware\MaintenanceMiddleware
*/
private function getMiddleware(): MaintenanceMiddleware
{
return new MaintenanceMiddleware($this->response);

View file

@ -9,7 +9,9 @@ use Pterodactyl\Tests\Assertions\MiddlewareAttributeAssertionsTrait;
abstract class MiddlewareTestCase extends TestCase
{
use MiddlewareAttributeAssertionsTrait, MocksMiddlewareClosure, RequestMockHelpers;
use MiddlewareAttributeAssertionsTrait;
use MocksMiddlewareClosure;
use RequestMockHelpers;
/**
* Setup tests with a mocked request object and normal attributes.

View file

@ -50,8 +50,6 @@ class RedirectIfAuthenticatedTest extends MiddlewareTestCase
/**
* Return an instance of the middleware using mocked dependencies.
*
* @return \Pterodactyl\Http\Middleware\RedirectIfAuthenticated
*/
private function getMiddleware(): RedirectIfAuthenticated
{

View file

@ -117,8 +117,6 @@ class AccessingValidServerTest extends MiddlewareTestCase
/**
* Provide test data that checks that the correct view is returned for each model type.
*
* @return array
*/
public function viewDataProvider(): array
{
@ -134,8 +132,6 @@ class AccessingValidServerTest extends MiddlewareTestCase
/**
* Return an instance of the middleware using mocked dependencies.
*
* @return \Pterodactyl\Http\Middleware\Server\AccessingValidServer
*/
private function getMiddleware(): AccessingValidServer
{

View file

@ -12,7 +12,7 @@ class UsernameTest extends TestCase
*/
public function testRuleIsStringable()
{
$this->assertSame('p_username', (string) new Username);
$this->assertSame('p_username', (string) new Username());
}
/**
@ -22,7 +22,7 @@ class UsernameTest extends TestCase
*/
public function testValidUsernames(string $username)
{
$this->assertTrue((new Username)->passes('test', $username), 'Assert username is valid.');
$this->assertTrue((new Username())->passes('test', $username), 'Assert username is valid.');
}
/**
@ -32,12 +32,11 @@ class UsernameTest extends TestCase
*/
public function testInvalidUsernames(string $username)
{
$this->assertFalse((new Username)->passes('test', $username), 'Assert username is not valid.');
$this->assertFalse((new Username())->passes('test', $username), 'Assert username is not valid.');
}
/**
* Provide valid usernames.
* @return array
*/
public function validUsernameDataProvider(): array
{
@ -54,8 +53,6 @@ class UsernameTest extends TestCase
/**
* Provide invalid usernames.
*
* @return array
*/
public function invalidUsernameDataProvider(): array
{

View file

@ -30,8 +30,6 @@ class AdminAclTest extends TestCase
/**
* Provide valid and invalid permissions combos for testing.
*
* @return array
*/
public function permissionsDataProvider(): array
{

View file

@ -149,8 +149,6 @@ class KeyCreationServiceTest extends TestCase
/**
* Provide key types that are not an application specific key.
*
* @return array
*/
public function keyTypeDataProvider(): array
{
@ -161,8 +159,6 @@ class KeyCreationServiceTest extends TestCase
/**
* Return an instance of the service with mocked dependencies for testing.
*
* @return \Pterodactyl\Services\Api\KeyCreationService
*/
private function getService(): KeyCreationService
{