Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Dec 12, 2023
1 parent efbcc39 commit f471fb5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/Api/Controllers/UploadTopImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public function data(ServerRequestInterface $request, Document $document)
if (!$file instanceof UploadedFile) {
if (is_array($file)) {
$file = Arr::first($file);

} else {

Check failure on line 74 in src/Api/Controllers/UploadTopImageController.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.3

Else branch is unreachable because previous condition is always true.

Check failure on line 74 in src/Api/Controllers/UploadTopImageController.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 7.4

Else branch is unreachable because previous condition is always true.

Check failure on line 74 in src/Api/Controllers/UploadTopImageController.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.0

Else branch is unreachable because previous condition is always true.

Check failure on line 74 in src/Api/Controllers/UploadTopImageController.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.1

Else branch is unreachable because previous condition is always true.

Check failure on line 74 in src/Api/Controllers/UploadTopImageController.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.2

Else branch is unreachable because previous condition is always true.

Check failure on line 74 in src/Api/Controllers/UploadTopImageController.php

View workflow job for this annotation

GitHub Actions / run / PHPStan PHP 8.3

Else branch is unreachable because previous condition is always true.
throw new ValidationException(['file' => 'Not an UploadFile instance']);
}
Expand All @@ -82,7 +81,7 @@ public function data(ServerRequestInterface $request, Document $document)

switch ($id) {
case 1:
$size = 150;;
$size = 150;
break;
case 2:
$size = 125;
Expand Down
9 changes: 9 additions & 0 deletions tests/EnhancedTestCase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of fof/gamification.
*
* Copyright (c) FriendsOfFlarum.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace FoF\Gamification\Tests;

use Flarum\Testing\integration\TestCase as BaseTestCase;
Expand Down
17 changes: 14 additions & 3 deletions tests/integration/api/TopImageTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of fof/gamification.
*
* Copyright (c) FriendsOfFlarum.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace FoF\Gamification\Tests\integration\api;

use Flarum\Testing\integration\RetrievesAuthorizedUsers;
Expand All @@ -8,7 +17,7 @@
class TopImageTest extends EnhancedTestCase
{
use RetrievesAuthorizedUsers;

public function setUp(): void
{
parent::setUp();
Expand All @@ -18,8 +27,8 @@ public function setUp(): void
$this->prepareDatabase([
'users' => [
$this->normalUser(),
]
]);
],
]);
}

public function topImagesProvider()
Expand All @@ -33,6 +42,7 @@ public function topImagesProvider()

/**
* @dataProvider topImagesProvider
*
* @test
*/
public function normal_user_cannot_upload_top_image(int $imageNo)
Expand All @@ -52,6 +62,7 @@ public function normal_user_cannot_upload_top_image(int $imageNo)

/**
* @dataProvider topImagesProvider
*
* @test
*/
public function admin_can_upload_top_image(int $imageNo)
Expand Down
8 changes: 5 additions & 3 deletions tests/integration/setup.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

/*
* This file is part of Flarum.
* This file is part of fof/gamification.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
* Copyright (c) FriendsOfFlarum.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Flarum\Testing\integration\Setup\SetupScript;
Expand Down

0 comments on commit f471fb5

Please sign in to comment.