Use more standardized phpcs
This commit is contained in:
parent
a043071e3c
commit
c449ca5155
493 changed files with 1116 additions and 3903 deletions
|
@ -9,8 +9,6 @@ trait IntegrationJsonRequestAssertions
|
|||
{
|
||||
/**
|
||||
* Make assertions about a 404 response on the API.
|
||||
*
|
||||
* @param \Illuminate\Testing\TestResponse $response
|
||||
*/
|
||||
public function assertNotFoundJson(TestResponse $response)
|
||||
{
|
||||
|
@ -30,8 +28,6 @@ trait IntegrationJsonRequestAssertions
|
|||
|
||||
/**
|
||||
* Make assertions about a 403 error returned by the API.
|
||||
*
|
||||
* @param \Illuminate\Testing\TestResponse $response
|
||||
*/
|
||||
public function assertAccessDeniedJson(TestResponse $response)
|
||||
{
|
||||
|
|
|
@ -22,8 +22,6 @@ trait RequestMockHelpers
|
|||
|
||||
/**
|
||||
* Set the class to mock for requests.
|
||||
*
|
||||
* @param string $class
|
||||
*/
|
||||
public function setRequestMockClass(string $class)
|
||||
{
|
||||
|
@ -34,8 +32,6 @@ trait RequestMockHelpers
|
|||
|
||||
/**
|
||||
* Configure the user model that the request mock should return with.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User|null $user
|
||||
*/
|
||||
public function setRequestUserModel(User $user = null)
|
||||
{
|
||||
|
@ -44,9 +40,6 @@ trait RequestMockHelpers
|
|||
|
||||
/**
|
||||
* Generates a new request user model and also returns the generated model.
|
||||
*
|
||||
* @param array $args
|
||||
* @return \Pterodactyl\Models\User
|
||||
*/
|
||||
public function generateRequestUserModel(array $args = []): User
|
||||
{
|
||||
|
@ -59,8 +52,7 @@ trait RequestMockHelpers
|
|||
/**
|
||||
* Set a request attribute on the mock object.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setRequestAttribute(string $attribute, $value)
|
||||
{
|
||||
|
@ -69,8 +61,6 @@ trait RequestMockHelpers
|
|||
|
||||
/**
|
||||
* Set the request route name.
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function setRequestRouteName(string $name)
|
||||
{
|
||||
|
@ -83,7 +73,7 @@ trait RequestMockHelpers
|
|||
protected function buildRequestMock()
|
||||
{
|
||||
$this->request = m::mock($this->requestMockClass);
|
||||
if (! $this->request instanceof Request) {
|
||||
if (!$this->request instanceof Request) {
|
||||
throw new InvalidArgumentException('Request mock class must be an instance of ' . Request::class . ' when mocked.');
|
||||
}
|
||||
|
||||
|
@ -94,8 +84,6 @@ trait RequestMockHelpers
|
|||
* Sets the mocked request user. If a user model is not provided, a factory model
|
||||
* will be created and returned.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User|null $user
|
||||
* @return \Pterodactyl\Models\User
|
||||
* @deprecated
|
||||
*/
|
||||
protected function setRequestUser(User $user = null): User
|
||||
|
|
|
@ -20,8 +20,6 @@ trait CreatesTestModels
|
|||
*
|
||||
* The returned server model will have all of the relationships loaded onto it.
|
||||
*
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return \Pterodactyl\Models\Server
|
||||
*/
|
||||
public function createServerModel(array $attributes = [])
|
||||
|
@ -30,14 +28,14 @@ trait CreatesTestModels
|
|||
$attributes['owner_id'] = $attributes['user_id'];
|
||||
}
|
||||
|
||||
if (! isset($attributes['owner_id'])) {
|
||||
if (!isset($attributes['owner_id'])) {
|
||||
/** @var \Pterodactyl\Models\User $user */
|
||||
$user = User::factory()->create();
|
||||
$attributes['owner_id'] = $user->id;
|
||||
}
|
||||
|
||||
if (! isset($attributes['node_id'])) {
|
||||
if (! isset($attributes['location_id'])) {
|
||||
if (!isset($attributes['node_id'])) {
|
||||
if (!isset($attributes['location_id'])) {
|
||||
/** @var \Pterodactyl\Models\Location $location */
|
||||
$location = Location::factory()->create();
|
||||
$attributes['location_id'] = $location->id;
|
||||
|
@ -48,23 +46,23 @@ trait CreatesTestModels
|
|||
$attributes['node_id'] = $node->id;
|
||||
}
|
||||
|
||||
if (! isset($attributes['allocation_id'])) {
|
||||
if (!isset($attributes['allocation_id'])) {
|
||||
/** @var \Pterodactyl\Models\Allocation $allocation */
|
||||
$allocation = Allocation::factory()->create(['node_id' => $attributes['node_id']]);
|
||||
$attributes['allocation_id'] = $allocation->id;
|
||||
}
|
||||
|
||||
if (! isset($attributes['nest_id'])) {
|
||||
if (!isset($attributes['nest_id'])) {
|
||||
/** @var \Pterodactyl\Models\Nest $nest */
|
||||
$nest = Nest::with('eggs')->first();
|
||||
$attributes['nest_id'] = $nest->id;
|
||||
|
||||
if (! isset($attributes['egg_id'])) {
|
||||
if (!isset($attributes['egg_id'])) {
|
||||
$attributes['egg_id'] = $nest->getRelation('eggs')->first()->id;
|
||||
}
|
||||
}
|
||||
|
||||
if (! isset($attributes['egg_id'])) {
|
||||
if (!isset($attributes['egg_id'])) {
|
||||
/** @var \Pterodactyl\Models\Egg $egg */
|
||||
$egg = Egg::where('nest_id', $attributes['nest_id'])->first();
|
||||
$attributes['egg_id'] = $egg->id;
|
||||
|
@ -85,9 +83,6 @@ trait CreatesTestModels
|
|||
/**
|
||||
* Clones a given egg allowing us to make modifications that don't affect other
|
||||
* tests that rely on the egg existing in the correct state.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
* @return \Pterodactyl\Models\Egg
|
||||
*/
|
||||
protected function cloneEggAndVariables(Egg $egg): Egg
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@ trait MocksPdoConnection
|
|||
*/
|
||||
protected function tearDownPdoMock()
|
||||
{
|
||||
if (! self::$initialResolver) {
|
||||
if (!self::$initialResolver) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@ trait MocksRequestException
|
|||
* Configure the exception mock to work with the Panel's default exception
|
||||
* handler actions.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @param null $response
|
||||
* @param null $response
|
||||
*/
|
||||
protected function configureExceptionMock(string $abstract = RequestException::class, $response = null)
|
||||
{
|
||||
|
@ -32,9 +31,6 @@ trait MocksRequestException
|
|||
|
||||
/**
|
||||
* Return a mocked instance of the request exception.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @return \Mockery\MockInterface
|
||||
*/
|
||||
protected function getExceptionMock(string $abstract = RequestException::class): MockInterface
|
||||
{
|
||||
|
|
|
@ -37,8 +37,6 @@ trait MocksUuids
|
|||
|
||||
/**
|
||||
* Returns the known UUID for tests to use.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKnownUuid(): string
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue