Use more standardized phpcs
This commit is contained in:
parent
a043071e3c
commit
c449ca5155
493 changed files with 1116 additions and 3903 deletions
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -30,8 +30,6 @@ class AdminAclTest extends TestCase
|
|||
|
||||
/**
|
||||
* Provide valid and invalid permissions combos for testing.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function permissionsDataProvider(): array
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue