From 22e67f98b6eb01b79c378198834861d3943bde80 Mon Sep 17 00:00:00 2001 From: Felix Huber Date: Wed, 22 Mar 2023 22:10:37 +0100 Subject: [PATCH 1/5] upgrade l10 + pest2 --- composer-dev.json | 76 ---------------------- composer.json | 23 ++++--- phpunit.xml | 60 ++++++++--------- tests/Integration/ContactTest.php | 2 +- tests/Integration/HelperControllerTest.php | 8 ++- tests/TestCase.php | 8 ++- 6 files changed, 50 insertions(+), 127 deletions(-) delete mode 100644 composer-dev.json diff --git a/composer-dev.json b/composer-dev.json deleted file mode 100644 index e54a0b6a..00000000 --- a/composer-dev.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "seatplus/web", - "description": "Web frontend of seatplus", - "license": "MIT", - "authors": [ - { - "name": "Felix Huber", - "email": "felix.a.huber@gmx.net" - } - ], - "autoload": { - "psr-4": { - "Seatplus\\Web\\": "src/", - "Seatplus\\Web\\Database\\Factories\\": "database/factories" - }, - "files": [ - "./src/Helpers/helpers.php" - ] - }, - "autoload-dev": { - "psr-4": { - "Seatplus\\Web\\Tests\\": "tests/" - } - }, - "minimum-stability": "dev", - "prefer-stable": true, - "repositories": [ - { - "type": "path", - "url": "../eveapi" - }, - { - "type": "path", - "url": "../auth" - } - ], - "require": { - "php": "^8.1", - "laravel/framework": "^9.0", - "laravel/socialite": "^5.0", - "seatplus/eveapi": "*", - "seatplus/auth": "*", - "inertiajs/inertia-laravel": "^0.5.4", - "tightenco/ziggy": "^1.0.4", - "spatie/laravel-permission": "^5.4", - "spatie/data-transfer-object": "^3.7", - "conedevelopment/i18n": "^1.1", - "doctrine/dbal": "^3.0", - "itsgoingd/clockwork": "^5.1" - }, - "require-dev": { - "orchestra/testbench": "^7.0", - "nunomaduro/collision": "^6.1", - "rector/rector": "^0.12.15", - "brianium/paratest": "^6.2", - "pestphp/pest": "^1.20", - "pestphp/pest-plugin-laravel": "^1.2" - }, - "extra": { - "laravel": { - "providers": [ - "Seatplus\\Web\\WebServiceProvider" - ] - } - }, - "scripts": { - "test": "vendor/bin/pest", - "test-coverage": "XDEBUG_MODE=coverage ./vendor/bin/pest --coverage", - "parallel": "vendor/bin/testbench package:test --parallel --no-coverage" - }, - "config": { - "allow-plugins": { - "pestphp/pest-plugin": true - } - } -} diff --git a/composer.json b/composer.json index ff87a919..6c93f9eb 100644 --- a/composer.json +++ b/composer.json @@ -22,28 +22,27 @@ "Seatplus\\Web\\Tests\\": "tests/" } }, - "minimum-stability": "dev", + "minimum-stability": "stable", "prefer-stable": true, - "require": { + "require": { "php": "^8.1", - "laravel/framework": "^9.0", + "laravel/framework": "^10.0", "laravel/socialite": "^5.0", - "seatplus/eveapi": "^2.0", - "seatplus/auth": "^2.0", - "inertiajs/inertia-laravel": "^0.5.4", + "seatplus/eveapi": "^3.0", + "seatplus/auth": "^3.0", "tightenco/ziggy": "^1.0.4", "spatie/laravel-permission": "^5.4", "spatie/data-transfer-object": "^3.7", "conedevelopment/i18n": "^1.1", - "doctrine/dbal": "^3.0" + "doctrine/dbal": "^3.0", + "inertiajs/inertia-laravel": "^0.6.9" }, "require-dev": { - "orchestra/testbench": "^7.0", - "nunomaduro/collision": "^6.1", + "orchestra/testbench": "^8.0", + "nunomaduro/collision": "^7.0", "rector/rector": "^0.14.3", - "brianium/paratest": "^6.2", - "pestphp/pest": "^1.20", - "pestphp/pest-plugin-laravel": "^1.2" + "pestphp/pest": "^2.0", + "pestphp/pest-plugin-laravel": "^2.0" }, "extra": { "laravel": { diff --git a/phpunit.xml b/phpunit.xml index 09f048d6..2f74a08c 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,36 +1,28 @@ - - - - - ./tests/ - - - - - ./src/ - - - - - - - - - - - - - - - - + + + + ./src/ + + + + + + + + ./tests/ + + + + + + + + + + + + + + diff --git a/tests/Integration/ContactTest.php b/tests/Integration/ContactTest.php index 4e9b3fc9..a00b8127 100644 --- a/tests/Integration/ContactTest.php +++ b/tests/Integration/ContactTest.php @@ -103,7 +103,7 @@ ->has( 'data.0', fn (AssertableJson $json) => - $json->where('corporation_standing', json_decode(json_encode($corp_standing, JSON_THROW_ON_ERROR), null, 512, JSON_THROW_ON_ERROR)) + $json->where('corporation_standing', json_decode(json_encode($corp_standing, JSON_NUMERIC_CHECK), null, 512, JSON_NUMERIC_CHECK)) ->etc() ) ->etc() diff --git a/tests/Integration/HelperControllerTest.php b/tests/Integration/HelperControllerTest.php index 3d45278c..c1dc3976 100644 --- a/tests/Integration/HelperControllerTest.php +++ b/tests/Integration/HelperControllerTest.php @@ -10,6 +10,7 @@ use Seatplus\Eveapi\Models\Universe\System; use Seatplus\Eveapi\Models\Universe\Type; use Seatplus\Eveapi\Services\Facade\RetrieveEsiData; +use function Pest\Laravel\get; uses(\Seatplus\Web\Tests\Traits\MockRetrieveEsiDataAction::class); @@ -98,9 +99,10 @@ System::factory()->count(4)->create(); - $result = test()->actingAs(test()->test_user) - ->get(route('autosuggestion.search', ['search' => 'J', 'categories' => ['system']])) - ->assertInvalid(['search' => 'The search must be at least 3 characters.']); + test()->actingAs(test()->test_user); + + get(route('autosuggestion.search', ['search' => 'J', 'categories' => ['system']])) + ->assertInvalid(['search' => 'The search field must be at least 3 characters.']); RetrieveEsiData::shouldReceive('execute') ->twice() diff --git a/tests/TestCase.php b/tests/TestCase.php index 24dd8ed6..1d4bd5b9 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -7,6 +7,7 @@ use Illuminate\Foundation\Testing\LazilyRefreshDatabase; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Queue; +use Illuminate\Support\Str; use Inertia\Inertia; use Inertia\ServiceProvider as InertiaServiceProviderAlias; use Laravel\Horizon\HorizonServiceProvider; @@ -17,6 +18,7 @@ use Seatplus\Eveapi\EveapiServiceProvider; use Seatplus\Eveapi\Models\Character\CharacterInfo; use Seatplus\Web\Http\Middleware\Authenticate; +use Seatplus\Web\Models\Asset\Asset; use Seatplus\Web\Tests\Stubs\ConsoleKernel; use Seatplus\Web\Tests\Stubs\Kernel; use Seatplus\Web\Tests\Traits\MockRetrieveEsiDataAction; @@ -37,7 +39,11 @@ protected function setUp(): void parent::setUp(); Factory::guessFactoryNamesUsing( - fn (string $modelName) => 'Seatplus\\Web\\Database\\Factories\\'.class_basename($modelName).'Factory' + fn (string $modelName) => match (true) { + Str::startsWith($modelName, 'Seatplus\Auth') => 'Seatplus\\Auth\\Database\\Factories\\' . class_basename($modelName) . 'Factory', + Str::startsWith($modelName, 'Seatplus\Eveapi'), Asset::class === $modelName => 'Seatplus\\Eveapi\\Database\\Factories\\' . class_basename($modelName) . 'Factory', + Str::startsWith($modelName, 'Seatplus\Web') => 'Seatplus\\Web\\Database\\Factories\\' . class_basename($modelName) . 'Factory', + } ); //Setup Inertia Root View From 38473800f19a53697d4ba183f01b841f90b71b08 Mon Sep 17 00:00:00 2001 From: Felix Huber Date: Wed, 22 Mar 2023 22:29:13 +0100 Subject: [PATCH 2/5] upgrade rector --- composer.json | 3 ++- rector.php | 40 ++++++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index 6c93f9eb..601c118d 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,8 @@ "require-dev": { "orchestra/testbench": "^8.0", "nunomaduro/collision": "^7.0", - "rector/rector": "^0.14.3", + "rector/rector": "^0.15.21", + "driftingly/rector-laravel": "^0.17.0", "pestphp/pest": "^2.0", "pestphp/pest-plugin-laravel": "^2.0" }, diff --git a/rector.php b/rector.php index 92dd51cb..a12f57dd 100644 --- a/rector.php +++ b/rector.php @@ -2,27 +2,31 @@ declare(strict_types=1); -use Rector\Core\Configuration\Option; -use Rector\Laravel\Set\LaravelSetList; -use Rector\Php74\Rector\Property\TypedPropertyRector; -use Rector\Set\ValueObject\LevelSetList; -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; +use Rector\Config\RectorConfig; +use Rector\Core\ValueObject\PhpVersion; +use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector; +use Rector\Set\ValueObject\SetList; +use RectorLaravel\Set\LaravelSetList; -return static function (ContainerConfigurator $containerConfigurator): void { - // get parameters - $parameters = $containerConfigurator->parameters(); - $parameters->set(Option::PATHS, [ - __DIR__ . '/src', - __DIR__ . '/tests' +return static function (RectorConfig $rectorConfig): void { + // here we can define, what sets of rules will be applied + // tip: use "SetList" class to autocomplete sets + $rectorConfig->sets([ + //SetList::CODE_QUALITY, + LaravelSetList::LARAVEL_100, + LaravelSetList::LARAVEL_CODE_QUALITY, + SetList::PHP_81, ]); + // paths to refactor; solid alternative to CLI arguments + $rectorConfig->paths([__DIR__ . '/src', __DIR__ . '/tests']); - // Define what rule sets will be applied - $containerConfigurator->import(LevelSetList::UP_TO_PHP_80); - $containerConfigurator->import(LaravelSetList::LARAVEL_80); + // is your PHP version different from the one you refactor to? [default: your PHP version], uses PHP_VERSION_ID format + $rectorConfig->phpVersion(PhpVersion::PHP_81); - // get services (needed for register a single rule) - // $services = $containerConfigurator->services(); + $rectorConfig->skip([ + RemoveExtraParametersRector::class => [ __DIR__ . '/src/Services/SsoSettings/UpdateOrCreateSsoSettings.php'] + ]); - // register a single rule - // $services->set(TypedPropertyRector::class); + // register single rule + //$rectorConfig->rule(TypedPropertyRector::class); }; From fd4df4e8f4499a5f7532410d696b5ff046c28cb0 Mon Sep 17 00:00:00 2001 From: Felix Huber Date: Wed, 22 Mar 2023 22:48:00 +0100 Subject: [PATCH 3/5] run php8.1 upgrade through rector --- rector.php | 7 ++++++- src/Http/Actions/Wallet/GetRefTypesAction.php | 2 +- .../MemberTracking/MemberTrackingController.php | 4 ++-- .../Recruitment/GetRecruitmentIndexController.php | 4 ++-- src/Http/Controllers/Queue/DispatchJobController.php | 2 +- src/Services/ACL/SyncRoleAffiliations.php | 4 ++-- src/Services/ACL/SyncRoleName.php | 2 +- src/Services/ACL/SyncRolePermissions.php | 6 +++--- ...GetCorporationMemberComplianceAffiliatedIdsService.php | 2 +- src/Services/Controller/CreateDispatchTransferObject.php | 2 +- src/Services/GetEntityFromId.php | 8 ++++---- src/Services/GetIdsFromNamesService.php | 2 +- src/Services/GetNamesFromIdsService.php | 2 +- src/Services/Mails/EveMailService.php | 4 ++-- src/Services/Sidebar/SidebarEntries.php | 2 +- src/Services/SsoSettings/UpdateOrCreateSsoSettings.php | 8 ++++---- tests/Integration/AssetTest.php | 2 +- tests/Integration/ComplianceLifeCycleTest.php | 2 +- tests/Integration/ManualLocationLifecycleTest.php | 6 +++--- tests/Integration/WalletsTest.php | 2 +- .../GetAffiliatedCorporationsControllerTest.php | 2 +- 21 files changed, 40 insertions(+), 35 deletions(-) diff --git a/rector.php b/rector.php index a12f57dd..be7c280a 100644 --- a/rector.php +++ b/rector.php @@ -5,6 +5,7 @@ use Rector\Config\RectorConfig; use Rector\Core\ValueObject\PhpVersion; use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector; +use Rector\Php81\Rector\Array_\FirstClassCallableRector; use Rector\Set\ValueObject\SetList; use RectorLaravel\Set\LaravelSetList; @@ -24,7 +25,11 @@ $rectorConfig->phpVersion(PhpVersion::PHP_81); $rectorConfig->skip([ - RemoveExtraParametersRector::class => [ __DIR__ . '/src/Services/SsoSettings/UpdateOrCreateSsoSettings.php'] + RemoveExtraParametersRector::class => [ __DIR__ . '/src/Services/SsoSettings/UpdateOrCreateSsoSettings.php'], + FirstClassCallableRector::class => [ + __DIR__ . '/src/Http/Controllers/AccessControl/ControlGroupsController.php', + __DIR__ . '/src/Http/Controllers/Shared/ManualLocationController.php', + ] ]); // register single rule diff --git a/src/Http/Actions/Wallet/GetRefTypesAction.php b/src/Http/Actions/Wallet/GetRefTypesAction.php index 16be96c8..f020f0e0 100644 --- a/src/Http/Actions/Wallet/GetRefTypesAction.php +++ b/src/Http/Actions/Wallet/GetRefTypesAction.php @@ -59,7 +59,7 @@ private function getRefTypes(): Collection private function alphabetToNumber($string): float { - $string = strtoupper($string); + $string = strtoupper((string) $string); $length = strlen($string); $number = 0; $level = 1; diff --git a/src/Http/Controllers/Corporation/MemberTracking/MemberTrackingController.php b/src/Http/Controllers/Corporation/MemberTracking/MemberTrackingController.php index ead21a27..d2fc0109 100644 --- a/src/Http/Controllers/Corporation/MemberTracking/MemberTrackingController.php +++ b/src/Http/Controllers/Corporation/MemberTracking/MemberTrackingController.php @@ -91,8 +91,8 @@ private function getAffiliatedCorporations(object $dispatchTransferObject) ->get() ->map(function ($corporation) { $corporation->required_scopes = collect([ - json_decode($corporation->corporation_scopes, true), - json_decode($corporation->alliance_scopes, true), + json_decode((string) $corporation->corporation_scopes, true), + json_decode((string) $corporation->alliance_scopes, true), ])->flatten()->filter()->unique()->toArray(); return $corporation; diff --git a/src/Http/Controllers/Corporation/Recruitment/GetRecruitmentIndexController.php b/src/Http/Controllers/Corporation/Recruitment/GetRecruitmentIndexController.php index b684bd08..87ec15da 100644 --- a/src/Http/Controllers/Corporation/Recruitment/GetRecruitmentIndexController.php +++ b/src/Http/Controllers/Corporation/Recruitment/GetRecruitmentIndexController.php @@ -35,8 +35,8 @@ class GetRecruitmentIndexController extends Controller { - public const MANAGEPERMISSION = 'can open or close corporations for recruitment'; - public const RECRUITERPERMISSION = 'can accept or deny applications'; + final public const MANAGEPERMISSION = 'can open or close corporations for recruitment'; + final public const RECRUITERPERMISSION = 'can accept or deny applications'; public function __invoke() { diff --git a/src/Http/Controllers/Queue/DispatchJobController.php b/src/Http/Controllers/Queue/DispatchJobController.php index 9fdbf5ad..eb33be18 100644 --- a/src/Http/Controllers/Queue/DispatchJobController.php +++ b/src/Http/Controllers/Queue/DispatchJobController.php @@ -43,7 +43,7 @@ class DispatchJobController extends Controller protected array $dispatch_transfer_object; public function __construct( - private WebJobsRepository $web_jobs + private readonly WebJobsRepository $web_jobs ) { } diff --git a/src/Services/ACL/SyncRoleAffiliations.php b/src/Services/ACL/SyncRoleAffiliations.php index b38b5044..54af3ede 100644 --- a/src/Services/ACL/SyncRoleAffiliations.php +++ b/src/Services/ACL/SyncRoleAffiliations.php @@ -37,12 +37,12 @@ class SyncRoleAffiliations { private $current_affiliations; - private \Illuminate\Support\Collection $target_affiliations; + private readonly \Illuminate\Support\Collection $target_affiliations; public function __construct(/** * @var \Seatplus\Auth\Models\Permissions\Role */ - private Role $role + private readonly Role $role ) { $this->current_affiliations = $role->affiliations; $this->target_affiliations = collect(); diff --git a/src/Services/ACL/SyncRoleName.php b/src/Services/ACL/SyncRoleName.php index aee8d75d..ce7fa200 100644 --- a/src/Services/ACL/SyncRoleName.php +++ b/src/Services/ACL/SyncRoleName.php @@ -33,7 +33,7 @@ class SyncRoleName /** * SyncRoleName constructor. */ - public function __construct(private Role $role) + public function __construct(private readonly Role $role) { } diff --git a/src/Services/ACL/SyncRolePermissions.php b/src/Services/ACL/SyncRolePermissions.php index 60f38099..e3589564 100644 --- a/src/Services/ACL/SyncRolePermissions.php +++ b/src/Services/ACL/SyncRolePermissions.php @@ -33,14 +33,14 @@ class SyncRolePermissions { - private \Illuminate\Support\Collection $current_permissions; + private readonly \Illuminate\Support\Collection $current_permissions; - private \Illuminate\Support\Collection $target_permissions; + private readonly \Illuminate\Support\Collection $target_permissions; public function __construct(/** * @var \Seatplus\Auth\Models\Permissions\Role */ - private Role $role + private readonly Role $role ) { $this->current_permissions = $role->permissions()->pluck('name'); $this->target_permissions = collect(); diff --git a/src/Services/Affiliations/GetCorporationMemberComplianceAffiliatedIdsService.php b/src/Services/Affiliations/GetCorporationMemberComplianceAffiliatedIdsService.php index b56904a2..408562f4 100644 --- a/src/Services/Affiliations/GetCorporationMemberComplianceAffiliatedIdsService.php +++ b/src/Services/Affiliations/GetCorporationMemberComplianceAffiliatedIdsService.php @@ -11,7 +11,7 @@ class GetCorporationMemberComplianceAffiliatedIdsService { public function __construct( - private AffiliationsDto $affiliationsDto + private readonly AffiliationsDto $affiliationsDto ) { } diff --git a/src/Services/Controller/CreateDispatchTransferObject.php b/src/Services/Controller/CreateDispatchTransferObject.php index de8198f4..ee324e18 100644 --- a/src/Services/Controller/CreateDispatchTransferObject.php +++ b/src/Services/Controller/CreateDispatchTransferObject.php @@ -42,7 +42,7 @@ class CreateDispatchTransferObject { - private array $transferObjectArray; + private readonly array $transferObjectArray; private bool $isCharacter = true; diff --git a/src/Services/GetEntityFromId.php b/src/Services/GetEntityFromId.php index ff77bee3..26174dca 100644 --- a/src/Services/GetEntityFromId.php +++ b/src/Services/GetEntityFromId.php @@ -33,13 +33,13 @@ class GetEntityFromId { private string $type; - private Collection $names; + private readonly Collection $names; - private GetNamesFromIdsService $get_names_from_ids_service; + private readonly GetNamesFromIdsService $get_names_from_ids_service; - private string $cache_key; + private readonly string $cache_key; - private ?array $cached_affiliation; + private readonly ?array $cached_affiliation; public function __construct(public int $id) { diff --git a/src/Services/GetIdsFromNamesService.php b/src/Services/GetIdsFromNamesService.php index 20c5b6c6..37a95b5e 100644 --- a/src/Services/GetIdsFromNamesService.php +++ b/src/Services/GetIdsFromNamesService.php @@ -32,7 +32,7 @@ class GetIdsFromNamesService { - private Collection $result; + private readonly Collection $result; public function __construct() { diff --git a/src/Services/GetNamesFromIdsService.php b/src/Services/GetNamesFromIdsService.php index b1dad579..05242667 100644 --- a/src/Services/GetNamesFromIdsService.php +++ b/src/Services/GetNamesFromIdsService.php @@ -32,7 +32,7 @@ class GetNamesFromIdsService { - private Collection $result; + private readonly Collection $result; public function __construct() { diff --git a/src/Services/Mails/EveMailService.php b/src/Services/Mails/EveMailService.php index 46f13f1b..0147b44c 100644 --- a/src/Services/Mails/EveMailService.php +++ b/src/Services/Mails/EveMailService.php @@ -34,9 +34,9 @@ class EveMailService { - private Collection $namesToResolve; + private readonly Collection $namesToResolve; - public function __construct(private Mail $mail) + public function __construct(private readonly Mail $mail) { $this->namesToResolve = collect(); } diff --git a/src/Services/Sidebar/SidebarEntries.php b/src/Services/Sidebar/SidebarEntries.php index a6244929..25c2efd6 100644 --- a/src/Services/Sidebar/SidebarEntries.php +++ b/src/Services/Sidebar/SidebarEntries.php @@ -35,7 +35,7 @@ class SidebarEntries { - private array $sidebar; + private readonly array $sidebar; public function __construct( private ?User $user = null diff --git a/src/Services/SsoSettings/UpdateOrCreateSsoSettings.php b/src/Services/SsoSettings/UpdateOrCreateSsoSettings.php index 6a25baf9..7e2a209e 100644 --- a/src/Services/SsoSettings/UpdateOrCreateSsoSettings.php +++ b/src/Services/SsoSettings/UpdateOrCreateSsoSettings.php @@ -41,12 +41,12 @@ class UpdateOrCreateSsoSettings */ private Collection $selected_scopes; - private Collection $entities; + private readonly Collection $entities; - private string $type; + private readonly string $type; public function __construct( - private array $request + private readonly array $request ) { $this->buildSelectedScopes(); @@ -90,7 +90,7 @@ private function buildSelectedScopes(): void $this->selected_scopes = collect(); collect(Arr::get($this->request, 'selectedScopes')) - ->flatMap(fn ($scope) => explode(',', $scope)) + ->flatMap(fn ($scope) => explode(',', (string) $scope)) ->each(function ($scope) { // If it is a corporation scope, we need to know the characters role if (Str::of($scope)->contains('corporation')) { diff --git a/tests/Integration/AssetTest.php b/tests/Integration/AssetTest.php index 120b679f..6ff76d89 100644 --- a/tests/Integration/AssetTest.php +++ b/tests/Integration/AssetTest.php @@ -65,7 +65,7 @@ $response = test()->actingAs(test()->test_user) ->get(route('get.affiliated.characters', [ 'permission' => 'assets', - 'search' => substr(test()->test_character->name, 5), + 'search' => substr((string) test()->test_character->name, 5), ])); //->assertOk(); diff --git a/tests/Integration/ComplianceLifeCycleTest.php b/tests/Integration/ComplianceLifeCycleTest.php index 589dd36c..cbab37bd 100644 --- a/tests/Integration/ComplianceLifeCycleTest.php +++ b/tests/Integration/ComplianceLifeCycleTest.php @@ -89,7 +89,7 @@ ->getJson(route('corporation.compliance', [ 'corporation_id' => test()->secondary_character->corporation->corporation_id, 'type' => 'default', - 'search' => substr(test()->secondary_character->name, 5), + 'search' => substr((string) test()->secondary_character->name, 5), ])) ->assertOk(); diff --git a/tests/Integration/ManualLocationLifecycleTest.php b/tests/Integration/ManualLocationLifecycleTest.php index 18e48fb7..4c611a36 100644 --- a/tests/Integration/ManualLocationLifecycleTest.php +++ b/tests/Integration/ManualLocationLifecycleTest.php @@ -95,7 +95,7 @@ ->assertOk(); // check that there are 5 suggestions - expect(json_decode($response->content(), null, 512, JSON_THROW_ON_ERROR)->data)->toHaveCount(5); + expect(json_decode((string) $response->content(), null, 512, JSON_THROW_ON_ERROR)->data)->toHaveCount(5); // Make sure there is no suggestion in universe_locations test()->assertNull(Location::firstWhere(['location_id' => 12345])); @@ -115,7 +115,7 @@ $response = test()->actingAs(test()->test_user) ->get(route('get.manuel_locations.suggestions')) ->assertOk(); - expect(json_decode($response->content(), null, 512, JSON_THROW_ON_ERROR)->data)->toHaveCount(1); + expect(json_decode((string) $response->content(), null, 512, JSON_THROW_ON_ERROR)->data)->toHaveCount(1); }); test('one get accepted suggestion', function () { @@ -176,7 +176,7 @@ ->assertOk(); // check that there are no suggestions - expect(json_decode($response->content(), null, 512, JSON_THROW_ON_ERROR)->data)->toHaveCount(0); + expect(json_decode((string) $response->content(), null, 512, JSON_THROW_ON_ERROR)->data)->toHaveCount(0); expect(ManualLocation::all())->toBeEmpty(); }); diff --git a/tests/Integration/WalletsTest.php b/tests/Integration/WalletsTest.php index b558c210..40fffe4f 100644 --- a/tests/Integration/WalletsTest.php +++ b/tests/Integration/WalletsTest.php @@ -9,7 +9,7 @@ assignPermissionToTestUser('superuser'); test()->actingAs(test()->test_user) - ->get(route('wallet.journalTypes', ['search' => substr($journal->ref_type, 0, -5)])) + ->get(route('wallet.journalTypes', ['search' => substr((string) $journal->ref_type, 0, -5)])) ->assertJson( fn (AssertableJson $json) => $json ->has(1) diff --git a/tests/Unit/Controller/GetAffiliatedCorporationsControllerTest.php b/tests/Unit/Controller/GetAffiliatedCorporationsControllerTest.php index 9147e555..c50b1651 100644 --- a/tests/Unit/Controller/GetAffiliatedCorporationsControllerTest.php +++ b/tests/Unit/Controller/GetAffiliatedCorporationsControllerTest.php @@ -39,7 +39,7 @@ ->get(route('get.affiliated.corporations', [ 'permission' => 'wallet_journals', 'corporation_role' => 'Accountant|Junior_Accountant', - 'search' => substr(test()->test_character->corporation->name, 5), + 'search' => substr((string) test()->test_character->corporation->name, 5), ])); $response->assertOk(); From 806fb89799b39a09600d35fdf0af705852f57b95 Mon Sep 17 00:00:00 2001 From: herpaderpaldent Date: Wed, 22 Mar 2023 21:53:15 +0000 Subject: [PATCH 4/5] Fix styling --- tests/Integration/HelperControllerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Integration/HelperControllerTest.php b/tests/Integration/HelperControllerTest.php index c1dc3976..7abe44c2 100644 --- a/tests/Integration/HelperControllerTest.php +++ b/tests/Integration/HelperControllerTest.php @@ -3,6 +3,7 @@ use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Http; +use function Pest\Laravel\get; use Seatplus\Eveapi\Containers\EsiRequestContainer; use Seatplus\Eveapi\Models\Universe\Category; use Seatplus\Eveapi\Models\Universe\Group; @@ -10,7 +11,6 @@ use Seatplus\Eveapi\Models\Universe\System; use Seatplus\Eveapi\Models\Universe\Type; use Seatplus\Eveapi\Services\Facade\RetrieveEsiData; -use function Pest\Laravel\get; uses(\Seatplus\Web\Tests\Traits\MockRetrieveEsiDataAction::class); From 6408c4bf4083dd32411f5dad6e10b03f44b4f2e4 Mon Sep 17 00:00:00 2001 From: Felix Huber Date: Wed, 22 Mar 2023 22:55:39 +0100 Subject: [PATCH 5/5] adapt workflow --- .github/workflows/laravel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index 4bc4dbcc..d71463f2 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -2,9 +2,9 @@ name: Laravel on: push: - branches: [ 1.x, 2.x ] + branches: [ 2.x, 3.x ] pull_request: - branches: [ 1.x, 2.x ] + branches: [ 2.x, 3.x ] jobs: laravel: