mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 22:33:44 +02:00
Use more standardized phpcs
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user