From d3b0b9bc988329ae8d03bdddd565aac6ba0ae51b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Parient=C3=A9?= <41431456+arthurpar06@users.noreply.github.com> Date: Wed, 21 Feb 2024 20:16:48 +0100 Subject: [PATCH 1/7] Clean up logs (#1756) * Apply fixes from StyleCI * Clean up logs in PirepController * Apply fixes from StyleCI * Clean up logs in PirepService * Move PIREP Update log to debug * Remove VACentral's listeners * Apply fixes from StyleCI --------- Co-authored-by: StyleCI Bot Co-authored-by: Nabeel S --- app/Http/Controllers/Api/PirepController.php | 14 ++++------- app/Services/PirepService.php | 2 +- .../Listeners/AcarsUpdateListener.php | 25 ------------------- .../Listeners/PirepAcceptedEventListener.php | 19 -------------- .../Providers/EventServiceProvider.php | 7 +----- 5 files changed, 7 insertions(+), 60 deletions(-) delete mode 100644 modules/Vacentral/Listeners/AcarsUpdateListener.php delete mode 100644 modules/Vacentral/Listeners/PirepAcceptedEventListener.php diff --git a/app/Http/Controllers/Api/PirepController.php b/app/Http/Controllers/Api/PirepController.php index b521687a4..e3c52f568 100644 --- a/app/Http/Controllers/Api/PirepController.php +++ b/app/Http/Controllers/Api/PirepController.php @@ -207,8 +207,6 @@ public function get(string $id): PirepResource */ public function prefile(PrefileRequest $request): PirepResource { - Log::info('PIREP Prefile, user '.Auth::id(), $request->post()); - /** * @var $user \App\Models\User */ @@ -221,8 +219,7 @@ public function prefile(PrefileRequest $request): PirepResource $fares = $this->getFares($request); $pirep = $this->pirepSvc->prefile($user, $attrs, $fields, $fares); - Log::info('PIREP PREFILED'); - Log::info($pirep->id); + Log::info('PIREP Prefile, pirep_id: '.$pirep->id.', user_id: '.Auth::id()); return $this->get($pirep->id); } @@ -244,8 +241,7 @@ public function prefile(PrefileRequest $request): PirepResource */ public function update(string $pirep_id, UpdateRequest $request): PirepResource { - Log::info('PIREP Update, user '.Auth::id()); - Log::info($request->getContent()); + Log::debug('PIREP Update, pirep_id: '.$pirep_id.', user_id: '.Auth::id()); /** @var User $user */ $user = Auth::user(); @@ -292,7 +288,7 @@ public function update(string $pirep_id, UpdateRequest $request): PirepResource */ public function file(string $pirep_id, FileRequest $request): PirepResource { - Log::info('PIREP file, user '.Auth::id(), $request->post()); + Log::info('PIREP File, pirep_id: '.$pirep_id.', user_id: '.Auth::id()); /** @var User $user */ $user = Auth::user(); @@ -350,7 +346,7 @@ public function file(string $pirep_id, FileRequest $request): PirepResource */ public function cancel(string $pirep_id, Request $request) { - Log::info('PIREP '.$pirep_id.' Cancel, user '.Auth::id(), $request->post()); + Log::info('PIREP Cancel, pirep_id: '.$pirep_id.', user_id: '.Auth::id()); $pirep = Pirep::find($pirep_id); if (!empty($pirep)) { @@ -502,7 +498,7 @@ public function route_post(string $id, RouteRequest $request): JsonResponse $pirep = Pirep::find($id); $this->checkCancelled($pirep); - Log::info('Posting ROUTE, PIREP: '.$id, $request->post()); + Log::info('Posting ROUTE, pirep_id: '.$id); // Delete the route before posting a new one Acars::where([ diff --git a/app/Services/PirepService.php b/app/Services/PirepService.php index 972ed78fd..3ac9d09f3 100644 --- a/app/Services/PirepService.php +++ b/app/Services/PirepService.php @@ -465,7 +465,7 @@ public function submit(Pirep $pirep) } } - Log::info('New PIREP filed', [$pirep]); + Log::info('New PIREP filed, pirep_id: '.$pirep->id); event(new PirepFiled($pirep)); $pirep->refresh(); diff --git a/modules/Vacentral/Listeners/AcarsUpdateListener.php b/modules/Vacentral/Listeners/AcarsUpdateListener.php deleted file mode 100644 index 78ce4580b..000000000 --- a/modules/Vacentral/Listeners/AcarsUpdateListener.php +++ /dev/null @@ -1,25 +0,0 @@ -vacentral = $vacentral; - } - - /** - * @param AcarsUpdate $event - */ - public function handle(AcarsUpdate $event) - { - Log::info('Received acars update event', [$event]); - } -} diff --git a/modules/Vacentral/Listeners/PirepAcceptedEventListener.php b/modules/Vacentral/Listeners/PirepAcceptedEventListener.php deleted file mode 100644 index 429661a3c..000000000 --- a/modules/Vacentral/Listeners/PirepAcceptedEventListener.php +++ /dev/null @@ -1,19 +0,0 @@ - [AcarsUpdateListener::class], - PirepAccepted::class => [PirepAcceptedEventListener::class], + // ]; } From 548d7b1ba5193ec329cabccaf86b7adef2ece1ea Mon Sep 17 00:00:00 2001 From: "B.Fatih KOZ" Date: Wed, 21 Feb 2024 22:34:00 +0300 Subject: [PATCH 2/7] Admin Dashboard Layout Change (#1760) * Dashboard layout changes * Update news.blade.php * Failsafe for deleted staff/admin --------- Co-authored-by: Nabeel S --- .../views/admin/dashboard/index.blade.php | 4 +- .../views/admin/dashboard/news.blade.php | 95 ++++++++++--------- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/resources/views/admin/dashboard/index.blade.php b/resources/views/admin/dashboard/index.blade.php index 06fabb5d2..931ded767 100644 --- a/resources/views/admin/dashboard/index.blade.php +++ b/resources/views/admin/dashboard/index.blade.php @@ -11,10 +11,10 @@ @endif
-
+
@include('admin.dashboard.news')
-
+
@component('admin.components.infobox') @slot('icon', 'pe-7s-users') @slot('type', 'Pilots') diff --git a/resources/views/admin/dashboard/news.blade.php b/resources/views/admin/dashboard/news.blade.php index 776e414d9..d08f92c1e 100644 --- a/resources/views/admin/dashboard/news.blade.php +++ b/resources/views/admin/dashboard/news.blade.php @@ -1,57 +1,58 @@
- @if($news->count() === 0) -
- No news items -
- @endif - @foreach($news as $item) -
-
-
- {{ $item->subject }} -
-
- {{ Form::open(['route' => 'admin.dashboard.news', 'method' => 'delete', 'class' => 'pjax_news_form']) }} - {{ Form::hidden('news_id', $item->id) }} - {{ - Form::button(' delete', [ - 'type' => 'submit', - 'class' => ' btn btn-danger btn-xs text-small', - 'onclick' => "return confirm('Are you sure?')" - ]) - }} - {{ Form::close() }} -
-
-
- {!! $item->body !!} -
- -
-
- @endforeach

Add News

{{ Form::open(['route' => 'admin.dashboard.news', 'method' => 'post', 'class' => 'pjax_news_form']) }} - - - - - - - - - -
{{ Form::label('subject', 'Subject:') }}{{ Form::text('subject', '', ['class' => 'form-control']) }}
{{ Form::label('body', 'Body:') }}{!! Form::textarea('body', '', ['id' => 'news_editor', 'class' => 'editor']) !!}
-
- {{ Form::button(' add', ['type' => 'submit', 'class' => 'btn btn-success btn-s']) }} - {{ Form::close() }} -
+ + + + + + + + + + + +
{{ Form::label('subject', 'Subject:') }}{{ Form::text('subject', '', ['class' => 'form-control']) }}
{{ Form::label('body', 'Body:') }}{!! Form::textarea('body', '', ['id' => 'news_editor', 'class' => 'editor']) !!}
+ {{ Form::button(' add', ['type' => 'submit', 'class' => 'btn btn-success btn-s']) }} +
+ {{ Form::close() }} +
+
+
+
+ @if($news->count() === 0) +
+ No news items +
+ @else + + + + + + + + + @foreach($news as $item) + + + + + + + + @endforeach +
SubjectBodyPosterDateActions
{{ $item->subject }}{!! $item->body!!}{{ optional($item->user)->name_private }}{{ $item->created_at->format('d.M.y') }} + {{ Form::open(['route' => 'admin.dashboard.news', 'method' => 'delete', 'class' => 'pjax_news_form']) }} + {{ Form::hidden('news_id', $item->id) }} + {{ Form::button('Delete', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs text-small', 'onclick' => "return confirm('Are you sure?')"]) }} + {{ Form::close() }} +
+ @endif
From 110e6b584b2edb7c95f4d16149c4696349543398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Parient=C3=A9?= <41431456+arthurpar06@users.noreply.github.com> Date: Wed, 21 Feb 2024 20:43:35 +0100 Subject: [PATCH 3/7] Upgrade to PHPUnit 10 (#1764) * Remove sempro/phpunit-pretty-print * Bump PHPUnit dependencies * Bump nunomaduro/collision and filp/whoops * Update phpunit.xml * Change setUp to protected * Remove --verbose option * Update phpunit.xml * Remove Bootstrap * Add types in tests * Make tests class final * Remove unused variables * Add .phpunit.cache to .gitignore * Apply fixes from StyleCI * Update phpunit.xml * Break tests (to test CI/CD) * Revert "Break tests (to test CI/CD)" This reverts commit 928b199bc4ee09238f83f33cc7c12304992368ab. * Update composer.lock --------- Co-authored-by: StyleCI Bot Co-authored-by: Nabeel S --- .github/scripts/phpunit.xml | 17 +- .github/workflows/build.yml | 2 +- .gitignore | 1 + Makefile | 2 +- composer.json | 9 +- composer.lock | 688 +++++++++++++-------------------- phpunit.xml | 26 +- symfony.lock | 6 - tests/AcarsTest.php | 74 ++-- tests/AdminControllerTests.php | 6 +- tests/AirlineTest.php | 30 +- tests/AirportTest.php | 10 +- tests/ApiTest.php | 38 +- tests/ApiTestTrait.php | 6 +- tests/AwardsTest.php | 16 +- tests/BidTest.php | 50 +-- tests/Bootstrap.php | 40 -- tests/CreatesApplication.php | 5 +- tests/CronTest.php | 14 +- tests/DatabaseTest.php | 8 +- tests/FinanceTest.php | 67 ++-- tests/FlightTest.php | 54 +-- tests/GeoTest.php | 6 +- tests/ImporterTest.php | 60 +-- tests/MathTest.php | 12 +- tests/MetarTest.php | 44 +-- tests/MoneyTest.php | 4 +- tests/NewsTest.php | 8 +- tests/OAuthTest.php | 4 +- tests/PIREPTest.php | 60 +-- tests/RegistrationTest.php | 6 +- tests/SimBriefTest.php | 55 +-- tests/SubfleetTest.php | 17 +- tests/TestCase.php | 48 +-- tests/TestData.php | 41 +- tests/UserTest.php | 12 +- tests/UtilsTest.php | 26 +- tests/VersionTest.php | 6 +- 38 files changed, 721 insertions(+), 857 deletions(-) delete mode 100644 tests/Bootstrap.php diff --git a/.github/scripts/phpunit.xml b/.github/scripts/phpunit.xml index f0224df1f..73f82171f 100755 --- a/.github/scripts/phpunit.xml +++ b/.github/scripts/phpunit.xml @@ -1,11 +1,9 @@ @@ -13,14 +11,6 @@ ./tests - - - - - - ./app - - @@ -42,4 +32,9 @@ + + + ./app + + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bb7104fd0..0969105b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -103,7 +103,7 @@ jobs: run: | export PHP_CS_FIXER_IGNORE_ENV=1 #vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --dry-run --diff --using-cache=no - vendor/bin/phpunit --debug --verbose + vendor/bin/phpunit # This runs after all of the tests, run have run. Creates a cleaned up version of the # distro, and then creates the artifact to push up to S3 or wherever diff --git a/.gitignore b/.gitignore index 630e9698a..33e2ea4b8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ _ide_helper.php .php_cs.cache .phpstorm.meta.php .phpunit.result.cache +.phpunit.cache /vendor node_modules/ npm-debug.log diff --git a/Makefile b/Makefile index b95ae94ee..9c0e027c4 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ tests: test .PHONY: test test: @#php artisan database:create --reset - @vendor/bin/phpunit --verbose + @vendor/bin/phpunit .PHONY: phpcs phpcs: diff --git a/composer.json b/composer.json index 757bd9d98..d645ef41f 100644 --- a/composer.json +++ b/composer.json @@ -92,12 +92,11 @@ }, "require-dev": { "barryvdh/laravel-debugbar": "^3.8.1", - "filp/whoops": "~2.14.5", + "filp/whoops": "^2.15.3", "friendsofphp/php-cs-fixer": "^3.17.0", "mockery/mockery": "^1.5.0", - "nunomaduro/collision": "^v6.1.0", - "phpunit/phpunit": "~9.5.14", - "sempro/phpunit-pretty-print": "^1.4.0", + "nunomaduro/collision": "^v7.5.0", + "phpunit/phpunit": "^10.5", "laravel/sail": "^1.23" }, "autoload": { @@ -143,7 +142,7 @@ "@php artisan package:discover --ansi", "@php artisan phpvms:caches" ], - "test": "phpunit --verbose" + "test": "phpunit" }, "config": { "bin-dir": "vendor/bin/", diff --git a/composer.lock b/composer.lock index 0bcd753cd..3ba4f9511 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c941a905b922ea1fd07189b46008041e", + "content-hash": "3bc446adf838589e9ad97baa9dc4e65f", "packages": [ { "name": "akaunting/laravel-money", @@ -12838,88 +12838,18 @@ ], "time": "2023-08-25T18:43:57+00:00" }, - { - "name": "doctrine/instantiator", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "shasum": "" - }, - "require": { - "php": "^8.1" - }, - "require-dev": { - "doctrine/coding-standard": "^11", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.9.4", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^5.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-12-30T00:23:10+00:00" - }, { "name": "filp/whoops", - "version": "2.14.6", + "version": "2.15.4", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "f7948baaa0330277c729714910336383286305da" + "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/f7948baaa0330277c729714910336383286305da", - "reference": "f7948baaa0330277c729714910336383286305da", + "url": "https://api.github.com/repos/filp/whoops/zipball/a139776fa3f5985a50b509f2a02ff0f709d2a546", + "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546", "shasum": "" }, "require": { @@ -12969,7 +12899,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.14.6" + "source": "https://github.com/filp/whoops/tree/2.15.4" }, "funding": [ { @@ -12977,7 +12907,7 @@ "type": "github" } ], - "time": "2022-11-02T16:23:29+00:00" + "time": "2023-11-03T12:00:00+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -13337,38 +13267,43 @@ }, { "name": "nunomaduro/collision", - "version": "v6.4.0", + "version": "v7.10.0", "source": { "type": "git", "url": "https://github.com/nunomaduro/collision.git", - "reference": "f05978827b9343cba381ca05b8c7deee346b6015" + "reference": "49ec67fa7b002712da8526678abd651c09f375b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/collision/zipball/f05978827b9343cba381ca05b8c7deee346b6015", - "reference": "f05978827b9343cba381ca05b8c7deee346b6015", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/49ec67fa7b002712da8526678abd651c09f375b2", + "reference": "49ec67fa7b002712da8526678abd651c09f375b2", "shasum": "" }, "require": { - "filp/whoops": "^2.14.5", - "php": "^8.0.0", - "symfony/console": "^6.0.2" + "filp/whoops": "^2.15.3", + "nunomaduro/termwind": "^1.15.1", + "php": "^8.1.0", + "symfony/console": "^6.3.4" + }, + "conflict": { + "laravel/framework": ">=11.0.0" }, "require-dev": { - "brianium/paratest": "^6.4.1", - "laravel/framework": "^9.26.1", - "laravel/pint": "^1.1.1", - "nunomaduro/larastan": "^1.0.3", - "nunomaduro/mock-final-classes": "^1.1.0", - "orchestra/testbench": "^7.7", - "phpunit/phpunit": "^9.5.23", - "spatie/ignition": "^1.4.1" + "brianium/paratest": "^7.3.0", + "laravel/framework": "^10.28.0", + "laravel/pint": "^1.13.3", + "laravel/sail": "^1.25.0", + "laravel/sanctum": "^3.3.1", + "laravel/tinker": "^2.8.2", + "nunomaduro/larastan": "^2.6.4", + "orchestra/testbench-core": "^8.13.0", + "pestphp/pest": "^2.23.2", + "phpunit/phpunit": "^10.4.1", + "sebastian/environment": "^6.0.1", + "spatie/laravel-ignition": "^2.3.1" }, "type": "library", "extra": { - "branch-alias": { - "dev-develop": "6.x-dev" - }, "laravel": { "providers": [ "NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider" @@ -13376,6 +13311,9 @@ } }, "autoload": { + "files": [ + "./src/Adapters/Phpunit/Autoload.php" + ], "psr-4": { "NunoMaduro\\Collision\\": "src/" } @@ -13421,7 +13359,7 @@ "type": "patreon" } ], - "time": "2023-01-03T12:54:54+00:00" + "time": "2023-10-11T15:45:01+00:00" }, { "name": "phar-io/manifest", @@ -13536,35 +13474,35 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.29", + "version": "10.1.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" + "reference": "78c3b7625965c2513ee96569a4dbb62601784145" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/78c3b7625965c2513ee96569a4dbb62601784145", + "reference": "78c3b7625965c2513ee96569a4dbb62601784145", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-text-template": "^3.0", + "sebastian/code-unit-reverse-lookup": "^3.0", + "sebastian/complexity": "^3.0", + "sebastian/environment": "^6.0", + "sebastian/lines-of-code": "^2.0", + "sebastian/version": "^4.0", "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.1" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -13573,7 +13511,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "10.1-dev" } }, "autoload": { @@ -13602,7 +13540,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.11" }, "funding": [ { @@ -13610,32 +13548,32 @@ "type": "github" } ], - "time": "2023-09-19T04:57:46+00:00" + "time": "2023-12-21T15:38:30+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -13662,7 +13600,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" }, "funding": [ { @@ -13670,28 +13609,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2023-08-31T06:24:48+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-pcntl": "*" @@ -13699,7 +13638,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -13725,7 +13664,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" }, "funding": [ { @@ -13733,32 +13672,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2023-02-03T06:56:09+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -13784,7 +13723,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" }, "funding": [ { @@ -13792,32 +13732,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2023-08-31T14:07:24+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -13843,7 +13783,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" }, "funding": [ { @@ -13851,24 +13791,23 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2023-02-03T06:57:52+00:00" }, { "name": "phpunit/phpunit", - "version": "9.5.28", + "version": "10.5.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e" + "reference": "0bd663704f0165c9e76fe4f06ffa6a1ca727fdbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e", - "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0bd663704f0165c9e76fe4f06ffa6a1ca727fdbe", + "reference": "0bd663704f0165c9e76fe4f06ffa6a1ca727fdbe", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -13878,27 +13817,26 @@ "myclabs/deep-copy": "^1.10.1", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", - "sebastian/version": "^3.0.2" + "php": ">=8.1", + "phpunit/php-code-coverage": "^10.1.5", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-invoker": "^4.0", + "phpunit/php-text-template": "^3.0", + "phpunit/php-timer": "^6.0", + "sebastian/cli-parser": "^2.0", + "sebastian/code-unit": "^2.0", + "sebastian/comparator": "^5.0", + "sebastian/diff": "^5.0", + "sebastian/environment": "^6.0", + "sebastian/exporter": "^5.1", + "sebastian/global-state": "^6.0.1", + "sebastian/object-enumerator": "^5.0", + "sebastian/recursion-context": "^5.0", + "sebastian/type": "^4.0", + "sebastian/version": "^4.0" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -13906,7 +13844,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-main": "10.5-dev" } }, "autoload": { @@ -13937,7 +13875,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.9" }, "funding": [ { @@ -13953,32 +13892,32 @@ "type": "tidelift" } ], - "time": "2023-01-14T12:32:24+00:00" + "time": "2024-01-22T14:35:40+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efdc130dbbbb8ef0b545a994fd811725c5282cae", + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -14001,7 +13940,7 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.0" }, "funding": [ { @@ -14009,32 +13948,32 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2023-02-03T06:58:15+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -14057,7 +13996,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" }, "funding": [ { @@ -14065,32 +14004,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2023-02-03T06:58:43+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -14112,7 +14051,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" }, "funding": [ { @@ -14120,34 +14059,36 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2023-02-03T06:59:15+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "2db5010a484d53ebf536087a70b4a5423c102372" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", + "reference": "2db5010a484d53ebf536087a70b4a5423c102372", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/diff": "^5.0", + "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -14186,7 +14127,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" }, "funding": [ { @@ -14194,33 +14136,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2023-08-14T13:18:12+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "68ff824baeae169ec9f2137158ee529584553799" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799", + "reference": "68ff824baeae169ec9f2137158ee529584553799", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.2-dev" } }, "autoload": { @@ -14243,7 +14185,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0" }, "funding": [ { @@ -14251,33 +14194,33 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-12-21T08:37:17+00:00" }, { "name": "sebastian/diff", - "version": "4.0.5", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/fbf413a49e54f6b9b17e12d900ac7f6101591b7f", + "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^10.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -14309,7 +14252,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.0" }, "funding": [ { @@ -14317,27 +14261,27 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2023-12-22T10:55:06+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/43c751b41d74f96cbbd4e07b7aec9675651e2951", + "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-posix": "*" @@ -14345,7 +14289,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -14364,7 +14308,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -14372,7 +14316,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/6.0.1" }, "funding": [ { @@ -14380,34 +14325,34 @@ "type": "github" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2023-04-11T05:39:26+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64f51654862e0f5e318db7e9dcc2292c63cdbddc", + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -14449,7 +14394,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.1" }, "funding": [ { @@ -14457,38 +14403,35 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2023-09-24T13:22:09+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.6", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bde739e7565280bda77be70044ac1047bc007e34" + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", - "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/7ea9ead78f6d380d2a667864c132c2f7b83055e4", + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -14513,7 +14456,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.1" }, "funding": [ { @@ -14521,33 +14465,33 @@ "type": "github" } ], - "time": "2023-08-02T09:26:13+00:00" + "time": "2023-07-19T07:19:23+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -14570,7 +14514,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2" }, "funding": [ { @@ -14578,34 +14523,34 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-12-21T08:38:20+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -14627,7 +14572,7 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" }, "funding": [ { @@ -14635,32 +14580,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2023-02-03T07:08:32+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -14682,7 +14627,7 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" }, "funding": [ { @@ -14690,32 +14635,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2023-02-03T07:06:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "05909fb5bc7df4c52992396d0116aed689f93712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -14745,62 +14690,7 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" }, "funding": [ { @@ -14808,32 +14698,32 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2023-02-03T07:05:40+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -14856,7 +14746,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" }, "funding": [ { @@ -14864,29 +14754,29 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2023-02-03T07:10:45+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -14909,7 +14799,7 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" }, "funding": [ { @@ -14917,45 +14807,7 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" - }, - { - "name": "sempro/phpunit-pretty-print", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/s360digital/phpunit-pretty-print.git", - "reference": "fa623aa8a17aece4a2b69e54b07a5e37572d1f1d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/s360digital/phpunit-pretty-print/zipball/fa623aa8a17aece4a2b69e54b07a5e37572d1f1d", - "reference": "fa623aa8a17aece4a2b69e54b07a5e37572d1f1d", - "shasum": "" - }, - "require": { - "php": ">=7.1.0", - "phpunit/phpunit": "^7 || ^8 || ^9" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.16" - }, - "type": "library", - "autoload": { - "psr-4": { - "Sempro\\PHPUnitPrettyPrinter\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Prettify PHPUnit output", - "support": { - "issues": "https://github.com/s360digital/phpunit-pretty-print/issues", - "source": "https://github.com/s360digital/phpunit-pretty-print/tree/1.4.0" - }, - "time": "2021-01-04T13:25:10+00:00" + "time": "2023-02-07T11:34:05+00:00" }, { "name": "symfony/options-resolver", @@ -15155,5 +15007,5 @@ "ext-zip": "*" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/phpunit.xml b/phpunit.xml index 086e94483..b05bad5bd 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,28 +1,18 @@ - - - - ./app - - + ./tests - - - - - + @@ -41,9 +31,13 @@ - - - - + + + + + + ./app + + diff --git a/symfony.lock b/symfony.lock index 2fc7fcc8f..2e9254589 100644 --- a/symfony.lock +++ b/symfony.lock @@ -74,9 +74,6 @@ "doctrine/inflector": { "version": "2.0.4" }, - "doctrine/instantiator": { - "version": "1.4.0" - }, "doctrine/lexer": { "version": "1.2.2" }, @@ -391,9 +388,6 @@ "sebastian/recursion-context": { "version": "4.0.4" }, - "sebastian/resource-operations": { - "version": "3.0.3" - }, "sebastian/type": { "version": "2.3.4" }, diff --git a/tests/AcarsTest.php b/tests/AcarsTest.php index dfc43426d..971218fbe 100644 --- a/tests/AcarsTest.php +++ b/tests/AcarsTest.php @@ -25,15 +25,15 @@ /** * Test API calls and authentication, etc */ -class AcarsTest extends TestCase +final class AcarsTest extends TestCase { /** @var SettingRepository */ - protected $settingsRepo; + protected SettingRepository $settingsRepo; /** @var FareService */ - protected $fareSvc; + protected FareService $fareSvc; - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->addData('base'); @@ -43,11 +43,11 @@ public function setUp(): void } /** - * @param $route - * @param $points + * @param array $route + * @param array $points * @param array $addtl_fields */ - protected function allPointsInRoute($route, $points, array $addtl_fields = []) + protected function allPointsInRoute(array $route, array $points, array $addtl_fields = []): void { if (empty($addtl_fields)) { $addtl_fields = []; @@ -76,7 +76,7 @@ protected function allPointsInRoute($route, $points, array $addtl_fields = []) } } - protected function getPirep($pirep_id) + protected function getPirep(string $pirep_id): array { $resp = $this->get('/api/pireps/'.$pirep_id); $resp->assertStatus(200); @@ -87,7 +87,7 @@ protected function getPirep($pirep_id) /** * Test some prefile error conditions */ - public function testPrefileErrors() + public function testPrefileErrors(): void { $this->user = User::factory()->create(); @@ -114,7 +114,7 @@ public function testPrefileErrors() $response->assertStatus(400); } - public function testPrefileAircraftNotAtAirport() + public function testPrefileAircraftNotAtAirport(): void { $this->settingsRepo->store('pilots.only_flights_from_current', false); $this->settingsRepo->store('pireps.restrict_aircraft_to_rank', false); @@ -158,7 +158,7 @@ public function testPrefileAircraftNotAtAirport() ); } - public function testBlankAirport() + public function testBlankAirport(): void { $this->user = User::factory()->create(); @@ -277,8 +277,10 @@ public function testAircraftNotAtAirport(): void /** * Post a PIREP into a PREFILE state and post ACARS + * + * @throws \Exception */ - public function testPrefileAndUpdates() + public function testPrefileAndUpdates(): void { $subfleet = $this->createSubfleetWithAircraft(2); $rank = $this->createRank(10, [$subfleet['subfleet']->id]); @@ -395,7 +397,10 @@ public function testPrefileAndUpdates() $this->assertEquals($body['state'], PirepState::CANCELLED); } - public function testPrefileAndInvalidUpdates() + /** + * @throws \Exception + */ + public function testPrefileAndInvalidUpdates(): void { $subfleet = $this->createSubfleetWithAircraft(2); $rank = $this->createRank(10, [$subfleet['subfleet']->id]); @@ -446,7 +451,7 @@ public function testPrefileAndInvalidUpdates() * * @throws \Exception */ - public function testAcarsUpdates() + public function testAcarsUpdates(): void { $subfleet = $this->createSubfleetWithAircraft(2); $rank = $this->createRank(10, [$subfleet['subfleet']->id]); @@ -622,6 +627,8 @@ public function testAcarsUpdates() /** * Post a PIREP into a PREFILE state and post ACARS + * + * @throws \Exception */ public function testFilePirepApi(): void { @@ -688,8 +695,10 @@ public function testFilePirepApi(): void /** * Test aircraft is allowed + * + * @throws \Exception */ - public function testAircraftAllowed() + public function testAircraftAllowed(): void { $this->settingsRepo->store('pireps.restrict_aircraft_to_rank', true); @@ -734,8 +743,10 @@ public function testAircraftAllowed() /** * Test aircraft permissions being ignored + * + * @throws \Exception */ - public function testIgnoreAircraftAllowed() + public function testIgnoreAircraftAllowed(): void { $this->settingsRepo->store('pireps.restrict_aircraft_to_rank', false); @@ -776,9 +787,9 @@ public function testIgnoreAircraftAllowed() /** * Test publishing multiple, batched updates * - * @throws Exception + * @throws \Exception */ - public function testMultipleAcarsPositionUpdates() + public function testMultipleAcarsPositionUpdates(): void { $pirep = $this->createPirep()->toArray(); @@ -811,7 +822,7 @@ public function testMultipleAcarsPositionUpdates() $response->assertStatus(200)->assertJsonCount($acars_count, 'data'); } - public function testNonExistentPirepGet() + public function testNonExistentPirepGet(): void { $this->user = User::factory()->create(); @@ -820,7 +831,7 @@ public function testNonExistentPirepGet() $response->assertStatus(404); } - public function testNonExistentPirepStore() + public function testNonExistentPirepStore(): void { $this->user = User::factory()->create(); @@ -830,7 +841,10 @@ public function testNonExistentPirepStore() $response->assertStatus(404); } - public function testAcarsIsoDate() + /** + * @throws \Exception + */ + public function testAcarsIsoDate(): void { $pirep = $this->createPirep()->toArray(); @@ -851,8 +865,10 @@ public function testAcarsIsoDate() /** * Test the validation + * + * @throws \Exception */ - public function testAcarsInvalidRoutePost() + public function testAcarsInvalidRoutePost(): void { $pirep = $this->createPirep()->toArray(); @@ -881,7 +897,10 @@ public function testAcarsInvalidRoutePost() $response->assertStatus(400); } - public function testAcarsLogPost() + /** + * @throws \Exception + */ + public function testAcarsLogPost(): void { $pirep = $this->createPirep()->toArray(); @@ -918,7 +937,10 @@ public function testAcarsLogPost() $this->assertEquals(1, $body['count']); } - public function testAcarsRoutePost() + /** + * @throws \Exception + */ + public function testAcarsRoutePost(): void { $pirep = $this->createPirep()->toArray(); @@ -975,8 +997,10 @@ public function testAcarsRoutePost() /** * Try to refile the same PIREP + * + * @throws \Exception */ - public function testDuplicatePirep() + public function testDuplicatePirep(): void { $pirep = $this->createPirep()->toArray(); diff --git a/tests/AdminControllerTests.php b/tests/AdminControllerTests.php index 9ef3712a7..aba828609 100644 --- a/tests/AdminControllerTests.php +++ b/tests/AdminControllerTests.php @@ -6,9 +6,9 @@ use App\Models\Subfleet; use App\Models\User; -class AdminControllerTests extends TestCase +final class AdminControllerTests extends TestCase { - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->addData('base'); @@ -29,7 +29,7 @@ private function addAdminUser(): User * * @return void */ - public function testAddSubfleet() + public function testAddSubfleet(): void { $user = $this->addAdminUser(); $add = Subfleet::factory()->make(['type' => 'B737'])->toArray(); diff --git a/tests/AirlineTest.php b/tests/AirlineTest.php index 109a67544..ada1acdb2 100644 --- a/tests/AirlineTest.php +++ b/tests/AirlineTest.php @@ -3,15 +3,18 @@ namespace Tests; use App\Models\Airline; +use App\Models\Flight; use App\Models\Journal; +use App\Models\Pirep; use App\Services\AirlineService; +use Prettus\Validator\Exceptions\ValidatorException; -class AirlineTest extends TestCase +final class AirlineTest extends TestCase { /** @var AirlineService */ - protected $airlineSvc; + protected AirlineService $airlineSvc; - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->addData('base'); @@ -19,9 +22,12 @@ public function setUp(): void $this->airlineSvc = app(AirlineService::class); } - public function testAddAirline() + /** + * @throws ValidatorException + */ + public function testAddAirline(): void { - $attrs = \App\Models\Airline::factory()->make([ + $attrs = Airline::factory()->make([ 'iata' => '', ])->toArray(); @@ -37,7 +43,7 @@ public function testAddAirline() $this->assertCount(1, $journals); // Add another airline, also blank IATA - $attrs = \App\Models\Airline::factory()->make([ + $attrs = Airline::factory()->make([ 'iata' => '', ])->toArray(); $airline = $this->airlineSvc->createAirline($attrs); @@ -47,10 +53,10 @@ public function testAddAirline() /** * Try deleting an airline which has flights/other assets that exist */ - public function testDeleteAirlineWithFlight() + public function testDeleteAirlineWithFlight(): void { - $airline = \App\Models\Airline::factory()->create(); - \App\Models\Flight::factory()->create([ + $airline = Airline::factory()->create(); + Flight::factory()->create([ 'airline_id' => $airline->id, ]); @@ -60,10 +66,10 @@ public function testDeleteAirlineWithFlight() /** * Try deleting an airline with existing PIREPs */ - public function testDeleteAirlineWithPirep() + public function testDeleteAirlineWithPirep(): void { - $airline = \App\Models\Airline::factory()->create(); - \App\Models\Pirep::factory()->create([ + $airline = Airline::factory()->create(); + Pirep::factory()->create([ 'airline_id' => $airline->id, ]); diff --git a/tests/AirportTest.php b/tests/AirportTest.php index 57bc54fdf..cbbe9dc07 100644 --- a/tests/AirportTest.php +++ b/tests/AirportTest.php @@ -5,9 +5,9 @@ use App\Models\Airport; use App\Models\User; -class AirportTest extends TestCase +final class AirportTest extends TestCase { - public function testSavingAirportFromApiResponse() + public function testSavingAirportFromApiResponse(): void { // This is the response from the API $airportResponse = [ @@ -26,7 +26,7 @@ public function testSavingAirportFromApiResponse() $this->assertEquals($airportResponse['tz'], $airport->timezone); } - public function testAirportSearch() + public function testAirportSearch(): void { foreach (['EGLL', 'KAUS', 'KJFK', 'KSFO'] as $a) { Airport::factory()->create(['id' => $a, 'icao' => $a]); @@ -49,7 +49,7 @@ public function testAirportSearch() $this->assertEquals('KJFK', $airports[0]['icao']); } - public function testAirportSearchMultiLetter() + public function testAirportSearchMultiLetter(): void { foreach (['EGLL', 'KAUS', 'KJFK', 'KSFO'] as $a) { Airport::factory()->create(['id' => $a, 'icao' => $a]); @@ -65,7 +65,7 @@ public function testAirportSearchMultiLetter() $this->assertEquals('KJFK', $airports[0]['icao']); } - public function testAirportSearchMissing() + public function testAirportSearchMissing(): void { foreach (['EGLL', 'KAUS', 'KJFK', 'KSFO'] as $a) { Airport::factory()->create(['id' => $a, 'icao' => $a]); diff --git a/tests/ApiTest.php b/tests/ApiTest.php index fe6024880..f5401f6e5 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -20,9 +20,9 @@ /** * Test API calls and authentication, etc */ -class ApiTest extends TestCase +final class ApiTest extends TestCase { - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->addData('base'); @@ -31,7 +31,7 @@ public function setUp(): void /** * Ensure authentication against the API works */ - public function testApiAuthentication() + public function testApiAuthentication(): void { $user = User::factory()->create(); @@ -63,7 +63,7 @@ public function testApiAuthentication() ->assertJson(['data' => ['id' => $user->id]]); } - public function testApiDeniedOnInactiveUser() + public function testApiDeniedOnInactiveUser(): void { $this->user = User::factory()->create([ 'state' => UserState::PENDING, @@ -88,7 +88,7 @@ public function testGetNews(): void /** * @throws Exception */ - public function testGetAirlines() + public function testGetAirlines(): void { $size = random_int(5, 10); $this->user = User::factory()->create([ @@ -105,7 +105,7 @@ public function testGetAirlines() ->assertJson(['data' => ['name' => $airline->name]]); } - public function testGetAirlinesChineseChars() + public function testGetAirlinesChineseChars(): void { $this->user = User::factory()->create([ 'airline_id' => 0, @@ -138,7 +138,7 @@ public function testGetAirlinesChineseChars() /** * @throws Exception */ - public function testPagination() + public function testPagination(): void { $size = random_int(5, 10); $this->user = User::factory()->create([ @@ -184,7 +184,7 @@ public function testPagination() /** * Make sure the airport data is returned */ - public function testAirportRequest() + public function testAirportRequest(): void { $this->user = User::factory()->create(); $airport = Airport::factory()->create(); @@ -200,7 +200,7 @@ public function testAirportRequest() /** * Make sure the airport data is returned */ - public function testAirportRequest5Char() + public function testAirportRequest5Char(): void { $this->user = User::factory()->create(); @@ -218,7 +218,7 @@ public function testAirportRequest5Char() /** * Get all the airports, test the pagination */ - public function testGetAllAirports() + public function testGetAllAirports(): void { $this->user = User::factory()->create(); Airport::factory()->count(70)->create(); @@ -230,7 +230,7 @@ public function testGetAllAirports() $this->assertHasKeys($body, ['data', 'links', 'meta']); } - public function testGetAllAirportsHubs() + public function testGetAllAirportsHubs(): void { $this->user = User::factory()->create(); Airport::factory()->count(10)->create(); @@ -246,7 +246,7 @@ public function testGetAllAirportsHubs() * * @throws Exception */ - public function testGetSubfleets() + public function testGetSubfleets(): void { $this->user = User::factory()->create(); @@ -289,7 +289,7 @@ public function testGetSubfleets() /** * Test getting an aircraft */ - public function testGetAircraft() + public function testGetAircraft(): void { $this->user = User::factory()->create(); @@ -342,14 +342,14 @@ public function testGetAircraft() $this->assertEquals($body['zfw'], $aircraft->zfw); } - public function testGetAllSettings() + public function testGetAllSettings(): void { $this->user = User::factory()->create(); $res = $this->get('/api/settings')->assertStatus(200); $settings = $res->json(); } - public function testGetUser() + public function testGetUser(): void { $this->user = User::factory()->create([ 'avatar' => '/assets/avatar.jpg', @@ -358,7 +358,7 @@ public function testGetUser() $res = $this->get('/api/user')->assertStatus(200); $user = $res->json('data'); $this->assertNotNull($user); - $this->assertTrue(strpos($user['avatar'], 'http') !== -1); + $this->assertNotSame(-1, strpos($user['avatar'], 'http')); // Should go to gravatar @@ -367,13 +367,13 @@ public function testGetUser() $res = $this->get('/api/user')->assertStatus(200); $user = $res->json('data'); $this->assertNotNull($user); - $this->assertTrue(strpos($user['avatar'], 'gravatar') !== -1); + $this->assertNotSame(-1, strpos($user['avatar'], 'gravatar')); } /** * Test that the web cron runs */ - public function testWebCron() + public function testWebCron(): void { $this->updateSetting('cron.random_id', ''); $this->get('/api/cron/sdf')->assertStatus(400); @@ -387,7 +387,7 @@ public function testWebCron() $res->assertStatus(200); } - public function testStatus() + public function testStatus(): void { $res = $this->get('/api/status'); $status = $res->json(); diff --git a/tests/ApiTestTrait.php b/tests/ApiTestTrait.php index 0d18ab307..310782a0b 100644 --- a/tests/ApiTestTrait.php +++ b/tests/ApiTestTrait.php @@ -2,7 +2,7 @@ trait ApiTestTrait { - public function assertApiResponse(array $actualData) + public function assertApiResponse(array $actualData): void { $this->assertApiSuccess(); @@ -13,13 +13,13 @@ public function assertApiResponse(array $actualData) $this->assertModelData($actualData, $responseData); } - public function assertApiSuccess() + public function assertApiSuccess(): void { $this->assertResponseOk(); $this->seeJson(['success' => true]); } - public function assertModelData(array $actualData, array $expectedData) + public function assertModelData(array $actualData, array $expectedData): void { foreach ($actualData as $key => $value) { $this->assertEquals($actualData[$key], $expectedData[$key]); diff --git a/tests/AwardsTest.php b/tests/AwardsTest.php index ba32a91d0..a2cfe1eda 100644 --- a/tests/AwardsTest.php +++ b/tests/AwardsTest.php @@ -11,14 +11,14 @@ use Modules\Awards\Awards\FlightRouteAwards; use Modules\Awards\Awards\PilotFlightAwards; -class AwardsTest extends TestCase +final class AwardsTest extends TestCase { /** @var AwardService */ - private $awardSvc; + private AwardService $awardSvc; - private $pirepSvc; + private PirepService $pirepSvc; - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->addData('base'); @@ -30,7 +30,7 @@ public function setUp(): void /** * Make sure the awards classes are returned */ - public function testGetAwardsClasses() + public function testGetAwardsClasses(): void { $classes = $this->awardSvc->findAllAwardClasses(); $this->assertGreaterThanOrEqual(2, $classes); @@ -38,8 +38,10 @@ public function testGetAwardsClasses() /** * Test to make sure that the award is actually given out + * + * @throws \Exception */ - public function testAwardsGiven() + public function testAwardsGiven(): void { // Create one award that's given out with one flight $award = Award::factory()->create([ @@ -74,7 +76,7 @@ public function testAwardsGiven() /** * Test the flight route */ - public function testFlightRouteAward() + public function testFlightRouteAward(): void { /** @var \App\Models\User $user */ $user = User::factory()->create([ diff --git a/tests/BidTest.php b/tests/BidTest.php index 5dadab197..bb12edfb5 100644 --- a/tests/BidTest.php +++ b/tests/BidTest.php @@ -14,18 +14,18 @@ use App\Services\FareService; use App\Services\FlightService; -class BidTest extends TestCase +final class BidTest extends TestCase { /** @var BidService */ - protected $bidSvc; + protected BidService $bidSvc; /** @var FlightService */ - protected $flightSvc; + protected FlightService $flightSvc; /** @var SettingRepository */ - protected $settingsRepo; + protected SettingRepository $settingsRepo; - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->addData('base'); @@ -35,30 +35,12 @@ public function setUp(): void $this->settingsRepo = app(SettingRepository::class); } - public function addFlight($user, $subfleet = null) - { - $flight = Flight::factory()->create([ - 'airline_id' => $user->airline_id, - ]); - - if ($subfleet === null) { - /** @var Subfleet $subfleet */ - $subfleet = Subfleet::factory()->create([ - 'airline_id' => $user->airline_id, - ])->id; - } - - $flight->subfleets()->syncWithoutDetaching([$subfleet]); - - return $flight; - } - /** * Add/remove a bid, test the API, etc * - * @throws Exception|\Exception + * @throws \Exception */ - public function testBids() + public function testBids(): void { $this->settingsRepo->store('bids.allow_multiple_bids', true); $this->settingsRepo->store('bids.disable_flight_on_bid', false); @@ -85,7 +67,7 @@ public function testBids() $headers = $this->headers($user); /** @var Flight $flight */ - $flight = $this->addFlight($user, $subfleet['subfleet']->id); + $flight = $this->addFlight($user, [], $subfleet['subfleet']->id); $bid = $this->bidSvc->addBid($flight, $user, $subfleet['aircraft'][0]); $this->assertEquals($user->id, $bid->user_id); @@ -163,7 +145,7 @@ public function testBids() $this->assertCount(0, $body); } - public function testMultipleBidsSingleFlight() + public function testMultipleBidsSingleFlight(): void { $this->settingsRepo->store('bids.disable_flight_on_bid', true); @@ -185,7 +167,7 @@ public function testMultipleBidsSingleFlight() /** * Add a flight bid VIA the API */ - public function testAddBidApi() + public function testAddBidApi(): void { $this->user = User::factory()->create(); $user2 = User::factory()->create(); @@ -222,8 +204,10 @@ public function testAddBidApi() /** * Delete a flight and make sure all the bids are gone + * + * @throws \Exception */ - public function testDeleteFlightWithBids() + public function testDeleteFlightWithBids(): void { $user = User::factory()->create(); $headers = $this->headers($user); @@ -262,8 +246,10 @@ public function testDeleteFlightWithBids() /** * Create a bid with an aircraft and check the aircraft booking + * + * @throws \Exception */ - public function testBidWithAircraft() + public function testBidWithAircraft(): void { $this->settingsRepo->store('pireps.restrict_aircraft_to_rank', false); $this->settingsRepo->store('pireps.only_aircraft_at_dpt_airport', false); @@ -277,7 +263,7 @@ public function testBidWithAircraft() $subfleet = $this->createSubfleetWithAircraft(10); $aircraft = $subfleet['aircraft']->first(); - $flight = $this->addFlight($user, $subfleet['subfleet']->id); + $flight = $this->addFlight($user, [], $subfleet['subfleet']->id); $flight->subfleets()->syncWithoutDetaching([$subfleet_unused['subfleet']->id]); $bid = $this->bidSvc->addBid($flight, $user, $aircraft); @@ -293,7 +279,7 @@ public function testBidWithAircraft() $this->assertEquals(1, $aircraft->bid->count()); // Now add another bid on another flight with the same aircraft, should throw an exception - $flight2 = $this->addFlight($user, $subfleet['subfleet']->id); + $flight2 = $this->addFlight($user, [], $subfleet['subfleet']->id); $this->expectException(BidExistsForAircraft::class); $bid2 = $this->bidSvc->addBid($flight2, $user, $aircraft); diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php deleted file mode 100644 index 51f79bbb6..000000000 --- a/tests/Bootstrap.php +++ /dev/null @@ -1,40 +0,0 @@ -createApplication()->make(Kernel::class); - $commands = [ - 'config:cache', - 'event:cache', - ]; - - foreach ($commands as $command) { - $console->call($command); - } - } - - public function executeAfterLastTest(): void - { - array_map('unlink', glob('bootstrap/cache/*.phpunit.php')); - } -} diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index a75c48c92..4ab0ad5d4 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -3,15 +3,16 @@ namespace Tests; use Illuminate\Contracts\Console\Kernel; +use Illuminate\Foundation\Application; trait CreatesApplication { /** * Creates the application. * - * @return \Illuminate\Foundation\Application + * @return Application */ - public function createApplication() + public function createApplication(): Application { $app = require __DIR__.'/../bootstrap/app.php'; $app->loadEnvironmentFrom(''); diff --git a/tests/CronTest.php b/tests/CronTest.php index 79d533dd3..879d35445 100644 --- a/tests/CronTest.php +++ b/tests/CronTest.php @@ -10,7 +10,7 @@ use App\Models\User; use Carbon\Carbon; -class CronTest extends TestCase +final class CronTest extends TestCase { /** * Create a new sample PIREP @@ -35,7 +35,7 @@ protected static function getPirep($subtractTime): Pirep /** * @throws \Exception */ - public function testExpiredFlightNotBeingRemoved() + public function testExpiredFlightNotBeingRemoved(): void { $this->updateSetting('acars.live_time', 0); $pirep = $this->getPirep(2); @@ -53,7 +53,7 @@ public function testExpiredFlightNotBeingRemoved() * * @throws \Exception */ - public function testExpiredFlightShouldNotBeRemoved() + public function testExpiredFlightShouldNotBeRemoved(): void { $this->updateSetting('acars.live_time', 3); $pirep = $this->getPirep(2); @@ -71,7 +71,7 @@ public function testExpiredFlightShouldNotBeRemoved() * * @throws \Exception */ - public function testExpiredFlightShouldBeRemoved() + public function testExpiredFlightShouldBeRemoved(): void { $this->updateSetting('acars.live_time', 3); $pirep = $this->getPirep(4); @@ -89,7 +89,7 @@ public function testExpiredFlightShouldBeRemoved() * * @throws \Exception */ - public function testCompletedFlightsShouldNotBeDeleted() + public function testCompletedFlightsShouldNotBeDeleted(): void { $this->updateSetting('acars.live_time', 3); $pirep = $this->getPirep(4); @@ -111,7 +111,7 @@ public function testCompletedFlightsShouldNotBeDeleted() * * @throws \Exception */ - public function testDeleteRejectedPireps() + public function testDeleteRejectedPireps(): void { $this->updateSetting('pireps.delete_rejected_hours', 3); $pirep = $this->getPirep(4); @@ -133,7 +133,7 @@ public function testDeleteRejectedPireps() * * @throws \Exception */ - public function testDeleteCancelledPireps() + public function testDeleteCancelledPireps(): void { $this->updateSetting('pireps.delete_cancelled_hours', 3); $pirep = $this->getPirep(4); diff --git a/tests/DatabaseTest.php b/tests/DatabaseTest.php index a77856706..65c493b87 100644 --- a/tests/DatabaseTest.php +++ b/tests/DatabaseTest.php @@ -6,12 +6,12 @@ use App\Support\Database; use Symfony\Component\Yaml\Yaml; -class DatabaseTest extends TestCase +final class DatabaseTest extends TestCase { /** * Make sure the seeder works correctly */ - public function testSeeder() + public function testSeeder(): void { /** @var DatabaseService $dbSvc */ $file = file_get_contents(base_path('tests/data/seed.yml')); @@ -36,7 +36,7 @@ public function testSeeder() $this->assertEquals('changed', $value); } - public function testSeederValueIgnoreValue() + public function testSeederValueIgnoreValue(): void { /** @var DatabaseService $dbSvc */ $file = file_get_contents(base_path('tests/data/seed.yml')); @@ -55,7 +55,7 @@ public function testSeederValueIgnoreValue() $this->assertEquals('default', $value); } - public function testSeederDontIgnoreValue() + public function testSeederDontIgnoreValue(): void { /** @var DatabaseService $dbSvc */ $file = file_get_contents(base_path('tests/data/seed.yml')); diff --git a/tests/FinanceTest.php b/tests/FinanceTest.php index 95bed4189..c57d7e4b7 100644 --- a/tests/FinanceTest.php +++ b/tests/FinanceTest.php @@ -27,27 +27,27 @@ use App\Support\Money; use Exception; -class FinanceTest extends TestCase +final class FinanceTest extends TestCase { - /** @var \App\Repositories\ExpenseRepository */ - private $expenseRepo; + /** @var ExpenseRepository */ + private ExpenseRepository $expenseRepo; - /** @var \App\Services\FareService */ - private $fareSvc; + /** @var FareService */ + private FareService $fareSvc; /** @var PirepFinanceService */ - private $financeSvc; + private PirepFinanceService $financeSvc; /** @var FleetService */ - private $fleetSvc; + private FleetService $fleetSvc; /** @var PirepService */ - private $pirepSvc; + private PirepService $pirepSvc; /** * @throws Exception */ - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->addData('base'); @@ -68,7 +68,7 @@ public function setUp(): void * * @return array */ - public function createFullPirep() + public function createFullPirep(): array { /** * Setup tests @@ -187,7 +187,7 @@ public function createFullPirep() * The fares, etc for a subfleet has to be adjusted to the fleet * https://github.com/nabeelio/phpvms/issues/905 */ - public function testFlightFaresOverAPI() + public function testFlightFaresOverAPI(): void { $this->updateSetting('pireps.only_aircraft_at_dpt_airport', false); $this->updateSetting('pireps.restrict_aircraft_to_rank', false); @@ -257,7 +257,7 @@ public function testFlightFaresOverAPI() $this->assertEquals(20, $body['subfleets'][0]['fares'][0]['cost']); } - public function testFlightFaresOverAPIOnUserBids() + public function testFlightFaresOverAPIOnUserBids(): void { $this->updateSetting('pireps.only_aircraft_at_dpt_airport', false); $this->updateSetting('pireps.restrict_aircraft_to_rank', false); @@ -295,7 +295,7 @@ public function testFlightFaresOverAPIOnUserBids() $this->assertEquals($fare->capacity, $body[0]['flight']['fares'][0]['capacity']); } - public function testSubfleetFaresOverAPI() + public function testSubfleetFaresOverAPI(): void { $this->updateSetting('pireps.only_aircraft_at_dpt_airport', false); $this->updateSetting('pireps.restrict_aircraft_to_rank', false); @@ -327,7 +327,7 @@ public function testSubfleetFaresOverAPI() /** * Assign percentage values and make sure they're valid */ - public function testFlightFareOverrideAsPercent() + public function testFlightFareOverrideAsPercent(): void { /** @var Flight $flight */ $flight = Flight::factory()->create(); @@ -362,7 +362,7 @@ public function testFlightFareOverrideAsPercent() $this->assertEquals($new_capacity, $ac_fares[0]->capacity); } - public function testSubfleetFaresNoOverride() + public function testSubfleetFaresNoOverride(): void { $subfleet = Subfleet::factory()->create(); $fare = Fare::factory()->create(); @@ -393,7 +393,7 @@ public function testSubfleetFaresNoOverride() $this->assertCount(0, $this->fareSvc->getForSubfleet($subfleet)); } - public function testSubfleetFaresOverride() + public function testSubfleetFaresOverride(): void { $subfleet = Subfleet::factory()->create(); $fare = Fare::factory()->create(); @@ -430,7 +430,7 @@ public function testSubfleetFaresOverride() /** * Assign percentage values and make sure they're valid */ - public function testSubfleetFareOverrideAsPercent() + public function testSubfleetFareOverrideAsPercent(): void { $subfleet = Subfleet::factory()->create(); $fare = Fare::factory()->create(); @@ -461,7 +461,7 @@ public function testSubfleetFareOverrideAsPercent() * Test getting the fares from the flight svc. Have a few base fares * and then override some of them */ - public function testGetFaresWithOverrides() + public function testGetFaresWithOverrides(): void { $flight = Flight::factory()->create(); $subfleet = Subfleet::factory()->create(); @@ -515,7 +515,7 @@ public function testGetFaresWithOverrides() } } - public function testGetFaresNoFlightOverrides() + public function testGetFaresNoFlightOverrides(): void { $subfleet = Subfleet::factory()->create(); [$fare1, $fare2, $fare3] = Fare::factory()->count(3)->create(); @@ -558,8 +558,10 @@ public function testGetFaresNoFlightOverrides() /** * Get the pilot pay, derived from the rank + * + * @throws Exception */ - public function testGetPilotPayNoOverride() + public function testGetPilotPayNoOverride(): void { $subfleet = $this->createSubfleetWithAircraft(2); $rank = $this->createRank(10, [$subfleet['subfleet']->id]); @@ -581,8 +583,10 @@ public function testGetPilotPayNoOverride() /** * Get the pilot pay, but include different overrides + * + * @throws Exception */ - public function testGetPilotPayWithOverride() + public function testGetPilotPayWithOverride(): void { $acars_pay_rate = 100; @@ -632,8 +636,10 @@ public function testGetPilotPayWithOverride() /** * Get the payment for a pilot + * + * @throws Exception */ - public function testGetPirepPilotPay() + public function testGetPirepPilotPay(): void { $acars_pay_rate = 100; @@ -668,7 +674,10 @@ public function testGetPirepPilotPay() $this->assertEquals($payment->getValue(), 150); } - public function testGetPirepPilotPayWithFixedPrice() + /** + * @throws Exception + */ + public function testGetPirepPilotPayWithFixedPrice(): void { $acars_pay_rate = 100; @@ -766,7 +775,7 @@ public function testJournalOperations(): void /** * @throws Exception */ - public function testPirepFares() + public function testPirepFares(): void { [$user, $pirep, $fares] = $this->createFullPirep(); @@ -796,7 +805,7 @@ public function testPirepFares() /** * Test that all expenses are pulled properly */ - public function testPirepExpenses() + public function testPirepExpenses(): void { /** @var Airline $airline */ $airline = Airline::factory()->create(); @@ -858,7 +867,7 @@ public function testPirepExpenses() $this->assertEquals($obj->id, $expense->ref_model_id); } - public function testAirportExpenses() + public function testAirportExpenses(): void { /** @var Airport $apt1 */ $apt1 = Airport::factory()->create(); @@ -899,7 +908,7 @@ public function testAirportExpenses() /** * @throws Exception */ - public function testPirepFinances() + public function testPirepFinances(): void { $journalRepo = app(JournalRepository::class); @@ -956,7 +965,7 @@ public function testPirepFinances() /** * @throws Exception */ - public function testPirepFinancesSpecificExpense() + public function testPirepFinancesSpecificExpense(): void { $journalRepo = app(JournalRepository::class); @@ -1078,7 +1087,7 @@ public function testPirepFinancesSpecificExpense() /** * @throws Exception */ - public function testPirepFinancesExpensesMultiAirline() + public function testPirepFinancesExpensesMultiAirline(): void { /** @var Airline $airline */ $airline = Airline::factory()->create(); diff --git a/tests/FlightTest.php b/tests/FlightTest.php index 870cac945..8006ea48f 100644 --- a/tests/FlightTest.php +++ b/tests/FlightTest.php @@ -19,12 +19,12 @@ use Carbon\Carbon; use Exception; -class FlightTest extends TestCase +final class FlightTest extends TestCase { - protected $flightSvc; - protected $settingsRepo; + protected FlightService $flightSvc; + protected SettingRepository $settingsRepo; - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->addData('base'); @@ -36,7 +36,7 @@ public function setUp(): void /** * Test adding a flight and also if there are duplicates */ - public function testDuplicateFlight() + public function testDuplicateFlight(): void { $this->user = User::factory()->create(); $flight = $this->addFlight($this->user); @@ -96,7 +96,7 @@ public function testDuplicateFlight() $this->assertFalse($this->flightSvc->isFlightDuplicate($flight_leg)); } - public function testGetFlight() + public function testGetFlight(): void { $this->user = User::factory()->create(); $flight = $this->addFlight($this->user, [ @@ -123,7 +123,7 @@ public function testGetFlight() /** * Search based on all different criteria */ - public function testSearchFlight() + public function testSearchFlight(): void { /** @var \App\Models\User user */ $this->user = User::factory()->create(); @@ -141,10 +141,10 @@ public function testSearchFlight() $req->assertStatus(200); $data = $req->json('data'); - $this->assertEquals(1, count($data)); + $this->assertCount(1, $data); } - public function testSearchFlightInactiveAirline() + public function testSearchFlightInactiveAirline(): void { /** @var \App\Models\Airline $airline_inactive */ $airline_inactive = Airline::factory()->create(['active' => 0]); @@ -163,7 +163,7 @@ public function testSearchFlightInactiveAirline() $req->assertStatus(200); $body = $req->json('data'); - $this->assertEquals(1, count($body)); + $this->assertCount(1, $body); $this->assertEquals($airline_active->id, $body[0]['airline_id']); } @@ -172,7 +172,7 @@ public function testSearchFlightInactiveAirline() * * @throws Exception */ - public function testFlightRoute() + public function testFlightRoute(): void { $this->user = User::factory()->create(); $flight = $this->addFlight($this->user); @@ -206,7 +206,7 @@ public function testFlightRoute() /** * Find all of the flights */ - public function testFindAllFlights() + public function testFindAllFlights(): void { $this->user = User::factory()->create(); Flight::factory()->count(20)->create([ @@ -225,7 +225,7 @@ public function testFindAllFlights() /** * Search for flights based on a subfleet. If subfleet is blank */ - public function testSearchFlightBySubfleet() + public function testSearchFlightBySubfleet(): void { $airline = Airline::factory()->create(); $subfleetA = Subfleet::factory()->create(['airline_id' => $airline->id]); @@ -259,7 +259,7 @@ public function testSearchFlightBySubfleet() /** * Search for flights based on a subfleet. If subfleet is blank */ - public function testSearchFlightBySubfleetPagination() + public function testSearchFlightBySubfleetPagination(): void { /** @var Airline $airline */ $airline = Airline::factory()->create(); @@ -366,7 +366,7 @@ public function testDayOfWeekActive(): void $res = $this->get('/api/flights'); $body = $res->json('data'); - $flights = collect($body)->where('id', $flight->id)->first(); + $flights = collect($body)->firstWhere('id', $flight->id); $this->assertNull($flights); } @@ -419,10 +419,10 @@ public function testStartEndDate(): void $res = $this->get('/api/flights'); $body = $res->json('data'); - $flights = collect($body)->where('id', $flight->id)->first(); + $flights = collect($body)->firstWhere('id', $flight->id); $this->assertNotNull($flights); - $flights = collect($body)->where('id', $flight_not_active->id)->first(); + $flights = collect($body)->firstWhere('id', $flight_not_active->id); $this->assertNull($flights); } @@ -458,14 +458,14 @@ public function testStartEndDateDayOfWeek(): void $res = $this->get('/api/flights'); $body = $res->json('data'); - $flights = collect($body)->where('id', $flight->id)->first(); + $flights = collect($body)->firstWhere('id', $flight->id); $this->assertNotNull($flights); - $flights = collect($body)->where('id', $flight_not_active->id)->first(); + $flights = collect($body)->firstWhere('id', $flight_not_active->id); $this->assertNull($flights); } - public function testFlightSearchApi() + public function testFlightSearchApi(): void { $this->user = User::factory()->create(); $flights = Flight::factory()->count(10)->create([ @@ -481,7 +481,7 @@ public function testFlightSearchApi() $this->assertEquals($flight->id, $body['data'][0]['id']); } - public function testFlightSearchApiDepartureAirport() + public function testFlightSearchApiDepartureAirport(): void { $this->user = User::factory()->create(); Flight::factory()->count(10)->create([ @@ -501,7 +501,7 @@ public function testFlightSearchApiDepartureAirport() $this->assertEquals($flight->id, $body['data'][0]['id']); } - public function testFlightSearchApiDistance() + public function testFlightSearchApiDistance(): void { $total_flights = 10; @@ -544,7 +544,7 @@ public function testFlightSearchApiDistance() $this->assertEquals($flight->id, $body['data'][0]['id']); } - public function testAddSubfleet() + public function testAddSubfleet(): void { $subfleet = Subfleet::factory()->create(); $flight = Flight::factory()->create(); @@ -565,8 +565,10 @@ public function testAddSubfleet() /** * Delete a flight and make sure all the bids are gone + * + * @throws Exception */ - public function testDeleteFlight() + public function testDeleteFlight(): void { $user = User::factory()->create(); @@ -577,7 +579,7 @@ public function testDeleteFlight() $this->assertNull($empty_flight); } - public function testAirportDistance() + public function testAirportDistance(): void { // KJFK $fromIcao = Airport::factory()->create([ @@ -597,7 +599,7 @@ public function testAirportDistance() $this->assertEquals(2244.33, $distance['nmi']); } - public function testAirportDistanceApi() + public function testAirportDistanceApi(): void { $user = User::factory()->create(); $headers = $this->headers($user); diff --git a/tests/GeoTest.php b/tests/GeoTest.php index 903e76324..dd0a904cc 100644 --- a/tests/GeoTest.php +++ b/tests/GeoTest.php @@ -6,11 +6,11 @@ use Exception; use Illuminate\Foundation\Testing\WithoutMiddleware; -class GeoTest extends TestCase +final class GeoTest extends TestCase { use WithoutMiddleware; - public function testClosestPoint() + public function testClosestPoint(): void { $geoSvc = app('\App\Services\GeoService'); @@ -42,7 +42,7 @@ public function testClosestPoint() * * @throws Exception */ - public function testGetCoords() + public function testGetCoords(): void { $geoSvc = app('\App\Services\GeoService'); diff --git a/tests/ImporterTest.php b/tests/ImporterTest.php index df21d3ff5..f0af5c3bd 100644 --- a/tests/ImporterTest.php +++ b/tests/ImporterTest.php @@ -23,14 +23,15 @@ use App\Services\ImportExport\FlightExporter; use App\Services\ImportService; use Illuminate\Support\Facades\Storage; +use League\Csv\CannotInsertRecord; -class ImporterTest extends TestCase +final class ImporterTest extends TestCase { - private $importBaseClass; - private $importSvc; - private $fareSvc; + private ImportExport $importBaseClass; + private ImportService $importSvc; + private FareService $fareSvc; - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->importBaseClass = new ImportExport(); @@ -45,7 +46,7 @@ public function setUp(): void * * @return mixed */ - protected function insertFlightsScaffoldData() + protected function insertFlightsScaffoldData(): array { $fare_svc = app(FareService::class); @@ -255,6 +256,7 @@ public function testConvertObjectToString(): void * Test exporting all the flights to a file * * @throws \Illuminate\Validation\ValidationException + * @throws CannotInsertRecord */ public function testAircraftExporter(): void { @@ -282,6 +284,8 @@ public function testAircraftExporter(): void /** * Test exporting all the flights to a file + * + * @throws CannotInsertRecord */ public function testAirportExporter(): void { @@ -309,6 +313,8 @@ public function testAirportExporter(): void /** * Test exporting all the flights to a file + * + * @throws CannotInsertRecord */ public function testFlightExporter(): void { @@ -428,21 +434,21 @@ public function testExpenseImporter(): void $expenses = Expense::all(); - $on_airline = $expenses->where('name', 'Per-Flight (multiplier, on airline)')->first(); + $on_airline = $expenses->firstWhere('name', 'Per-Flight (multiplier, on airline)'); $this->assertEquals(200, $on_airline->amount); $this->assertEquals($airline->id, $on_airline->airline_id); - $pf = $expenses->where('name', 'Per-Flight (no muliplier)')->first(); + $pf = $expenses->firstWhere('name', 'Per-Flight (no muliplier)'); $this->assertEquals(100, $pf->amount); $this->assertEquals(ExpenseType::FLIGHT, $pf->type); - $catering = $expenses->where('name', 'Catering Staff')->first(); + $catering = $expenses->firstWhere('name', 'Catering Staff'); $this->assertEquals(1000, $catering->amount); $this->assertEquals(ExpenseType::DAILY, $catering->type); $this->assertEquals(Subfleet::class, $catering->ref_model); $this->assertEquals($subfleet->id, $catering->ref_model_id); - $mnt = $expenses->where('name', 'Maintenance')->first(); + $mnt = $expenses->firstWhere('name', 'Maintenance'); $this->assertEquals(Aircraft::class, $mnt->ref_model); $this->assertEquals($aircraft->id, $mnt->ref_model_id); } @@ -460,29 +466,29 @@ public function testFareImporter(): void $fares = Fare::all(); - $y_class = $fares->where('code', 'Y')->first(); + $y_class = $fares->firstWhere('code', 'Y'); $this->assertEquals('Economy', $y_class->name); $this->assertEquals(100, $y_class->price); $this->assertEquals(0, $y_class->cost); $this->assertEquals(200, $y_class->capacity); - $this->assertEquals(true, $y_class->active); + $this->assertTrue($y_class->active); $this->assertEquals('This is the economy class', $y_class->notes); - $b_class = $fares->where('code', 'B')->first(); + $b_class = $fares->firstWhere('code', 'B'); $this->assertEquals('Business', $b_class->name); $this->assertEquals(500, $b_class->price); $this->assertEquals(250, $b_class->cost); $this->assertEquals(10, $b_class->capacity); $this->assertEquals('This is business class', $b_class->notes); - $this->assertEquals(false, $b_class->active); + $this->assertFalse($b_class->active); - $f_class = $fares->where('code', 'F')->first(); + $f_class = $fares->firstWhere('code', 'F'); $this->assertEquals('First-Class', $f_class->name); $this->assertEquals(800, $f_class->price); $this->assertEquals(350, $f_class->cost); $this->assertEquals(5, $f_class->capacity); $this->assertEquals('', $f_class->notes); - $this->assertEquals(true, $f_class->active); + $this->assertTrue($f_class->active); } /** @@ -520,7 +526,7 @@ public function testFlightImporter(): void $this->assertEquals(FlightType::SCHED_PAX, $flight->flight_type); $this->assertEquals('ILEXY2 ZENZI LFK ELD J29 MEM Q29 JHW J70 STENT J70 MAGIO J70 LVZ LENDY6', $flight->route); $this->assertEquals('Just a flight', $flight->notes); - $this->assertEquals(true, $flight->active); + $this->assertTrue($flight->active); // Test that the days were set properly $this->assertTrue($flight->on_day(Days::MONDAY)); @@ -533,22 +539,22 @@ public function testFlightImporter(): void ])->get(); $this->assertCount(2, $fields); - $dep_gate = $fields->where('name', 'Departure Gate')->first(); + $dep_gate = $fields->firstWhere('name', 'Departure Gate'); $this->assertEquals('4', $dep_gate['value']); - $dep_gate = $fields->where('name', 'Arrival Gate')->first(); + $dep_gate = $fields->firstWhere('name', 'Arrival Gate'); $this->assertEquals('C41', $dep_gate['value']); // Check the fare class $fares = $this->fareSvc->getFareWithOverrides(null, $flight->fares); $this->assertCount(3, $fares); - $first = $fares->where('code', 'Y')->first(); + $first = $fares->firstWhere('code', 'Y'); $this->assertEquals(300, $first->price); $this->assertEquals(100, $first->cost); $this->assertEquals(130, $first->capacity); - $first = $fares->where('code', 'F')->first(); + $first = $fares->firstWhere('code', 'F'); $this->assertEquals(600, $first->price); $this->assertEquals(400, $first->cost); $this->assertEquals(10, $first->capacity); @@ -668,7 +674,7 @@ public function testAirportImporter(): void $this->assertEquals('Texas', $airport->region); $this->assertEquals('US', $airport->country); $this->assertEquals('America/Chicago', $airport->timezone); - $this->assertEquals(true, $airport->hub); + $this->assertTrue($airport->hub); $this->assertEquals('30.1945', $airport->lat); $this->assertEquals('-97.6699', $airport->lon); $this->assertEquals(0.0, $airport->ground_handling_cost); @@ -681,7 +687,7 @@ public function testAirportImporter(): void ])->first(); $this->assertNotNull($airport); - $this->assertEquals(true, $airport->hub); + $this->assertTrue($airport->hub); $this->assertEquals(0.9, $airport->fuel_jeta_cost); $this->assertEquals(setting('airports.default_ground_handling_cost'), $airport->ground_handling_cost); } @@ -741,7 +747,7 @@ public function testSubfleetImporter(): void // get the fares and check the pivot tables and the main tables $fares = $subfleet->fares()->get(); - $eco = $fares->where('code', 'Y')->first(); + $eco = $fares->firstWhere('code', 'Y'); $this->assertEquals(null, $eco->pivot->price); $this->assertEquals(null, $eco->pivot->capacity); $this->assertEquals(null, $eco->pivot->cost); @@ -750,7 +756,7 @@ public function testSubfleetImporter(): void $this->assertEquals($fare_economy->capacity, $eco->capacity); $this->assertEquals($fare_economy->cost, $eco->cost); - $busi = $fares->where('code', 'B')->first(); + $busi = $fares->firstWhere('code', 'B'); $this->assertEquals($fare_business->price, $busi->price); $this->assertEquals($fare_business->capacity, $busi->capacity); $this->assertEquals($fare_business->cost, $busi->cost); @@ -761,14 +767,14 @@ public function testSubfleetImporter(): void // get the ranks and check the pivot tables and the main tables $ranks = $subfleet->ranks()->get(); - $cpt = $ranks->where('name', 'cpt')->first(); + $cpt = $ranks->firstWhere('name', 'cpt'); $this->assertEquals(null, $cpt->pivot->acars_pay); $this->assertEquals(null, $cpt->pivot->manual_pay); $this->assertEquals($rank_cpt->acars_pay, $cpt->acars_pay); $this->assertEquals($rank_cpt->manual_pay, $cpt->manual_pay); - $fo = $ranks->where('name', 'fo')->first(); + $fo = $ranks->firstWhere('name', 'fo'); $this->assertEquals(200, $fo->pivot->acars_pay); $this->assertEquals(100, $fo->pivot->manual_pay); diff --git a/tests/MathTest.php b/tests/MathTest.php index 1863523c2..d68139812 100644 --- a/tests/MathTest.php +++ b/tests/MathTest.php @@ -4,13 +4,15 @@ use App\Support\Math; use App\Support\Units\Distance; +use PhpUnitsOfMeasure\Exception\NonNumericValue; +use PhpUnitsOfMeasure\Exception\NonStringUnitName; -class MathTest extends TestCase +final class MathTest extends TestCase { /** * Test adding/subtracting a percentage */ - public function testAddPercent() + public function testAddPercent(): void { $tests = [ ['expected' => 112, 'fn' => Math::getPercent(100, 112)], @@ -30,7 +32,11 @@ public function testAddPercent() } } - public function testDistanceMeasurement() + /** + * @throws NonNumericValue + * @throws NonStringUnitName + */ + public function testDistanceMeasurement(): void { $dist = new Distance(1, 'mi'); $this->assertEqualsWithDelta(1609.34, $dist['m'], 0.1); diff --git a/tests/MetarTest.php b/tests/MetarTest.php index aee901f61..e585af463 100644 --- a/tests/MetarTest.php +++ b/tests/MetarTest.php @@ -9,12 +9,12 @@ /** * Test the parsing/support class of the metar */ -class MetarTest extends TestCase +final class MetarTest extends TestCase { /** @var SettingRepository */ - private $settingsRepo; + private SettingRepository $settingsRepo; - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->settingsRepo = app(SettingRepository::class); @@ -23,7 +23,7 @@ public function setUp(): void /** * Make sure a blank metar doesn't give problems */ - public function testBlankMetar() + public function testBlankMetar(): void { $metar = ''; $parsed = Metar::parse($metar); @@ -33,7 +33,7 @@ public function testBlankMetar() /** * Test adding/subtracting a percentage */ - public function testMetar1() + public function testMetar1(): void { $metar = 'KJFK 042151Z 28026G39KT 10SM FEW055 SCT095 BKN110 BKN230 12/M04 A2958 RMK AO2 PK WND 27045/2128 PRESRR SLP018 T01221044'; @@ -58,7 +58,7 @@ public function testMetar1() $this->assertEquals(39, $parsed['wind_gust_speed']['knots']); $this->assertEquals(280, $parsed['wind_direction']); $this->assertEquals('W', $parsed['wind_direction_label']); - $this->assertEquals(false, $parsed['wind_direction_varies']); + $this->assertFalse($parsed['wind_direction_varies']); $this->assertEquals(16093.44, $parsed['visibility']['m']); $this->assertEquals('Dry', $parsed['present_weather_report']); @@ -68,7 +68,7 @@ public function testMetar1() $parsed['clouds_report'] ); $this->assertEquals(1676.4, $parsed['cloud_height']['m']); - $this->assertEquals(false, $parsed['cavok']); + $this->assertFalse($parsed['cavok']); $this->assertEquals(12, $parsed['temperature']['c']); $this->assertEquals(53.6, $parsed['temperature']['f']); @@ -82,7 +82,7 @@ public function testMetar1() $this->assertEquals('AO2 PK WND 27045/2128 PRESRR SLP018 T01221044', $parsed['remarks']); } - public function testMetar2() + public function testMetar2(): void { $metar = 'EGLL 261250Z AUTO 17014KT 8000 -RA BKN010/// ' .'BKN016/// OVC040/// //////TCU 13/12 Q1008 TEMPO 4000 RA'; @@ -96,7 +96,7 @@ public function testMetar2() $this->assertNull($parsed['clouds'][3]['height']); } - public function testMetar3() + public function testMetar3(): void { $metar = 'LEBL 310337Z 24006G18KT 210V320 1000 ' .'R25R/P2000 R07L/1900N R07R/1700D R25L/1900N ' @@ -105,7 +105,7 @@ public function testMetar3() $parsed = Metar::parse($metar); } - public function testMetarTrends() + public function testMetarTrends(): void { $metar = 'KJFK 070151Z 20005KT 10SM BKN100 08/07 A2970 RMK AO2 SLP056 T00780067'; @@ -119,7 +119,7 @@ public function testMetarTrends() $parsed = Metar::parse($metar); } - public function testMetarTrends2() + public function testMetarTrends2(): void { $metar = 'KAUS 092135Z 26018G25KT 8SM -TSRA BR SCT045CB BKN060 OVC080 30/21 A2992 RMK FQT LTGICCCCG OHD-W MOVG E RAB25 TSB32 CB ALQDS SLP132 P0035 T03020210 ='; $parsed = Metar::parse($metar); @@ -133,7 +133,7 @@ public function testMetarTrends2() ); } - public function testMetarTrends3() + public function testMetarTrends3(): void { $metar = 'EHAM 041455Z 13012KT 9999 FEW034CB BKN040 05/01 Q1007 TEMPO 14017G28K 4000 SHRA ='; $metar = Metar::parse($metar); @@ -141,12 +141,12 @@ public function testMetarTrends3() $this->assertEquals('VFR', $metar['category']); } - public function testMetar4Clouds() + public function testMetar4Clouds(): void { $metar = 'KAUS 171153Z 18006KT 9SM FEW015 FEW250 26/24 A3003 RMK AO2 SLP156 T02560244 10267 20239 $'; $metar = Metar::parse($metar); - $this->assertEquals(2, count($metar['clouds'])); + $this->assertCount(2, $metar['clouds']); $this->assertEquals('Few at 457 meters; few at 7620 meters', $metar['clouds_report']); $this->assertEquals('Few at 1500 feet; few at 25000 feet', $metar['clouds_report_ft']); } @@ -154,7 +154,7 @@ public function testMetar4Clouds() /** * https://github.com/nabeelio/phpvms/issues/1071 */ - public function testMetarWindSpeedChill() + public function testMetarWindSpeedChill(): void { $metar = 'EKYT 091020Z /////KT CAVOK 02/M03 Q1019'; $metar = Metar::parse($metar); @@ -169,7 +169,7 @@ public function testMetarWindSpeedChill() * * https://github.com/nabeelio/phpvms/issues/680 */ - public function testMetar5() + public function testMetar5(): void { $metar = 'NZOH 031300Z 04004KT 38KM SCT075 BKN090 15/14 Q1002 RMK AUTO NZPM VATSIM USE ONL'; $metar = Metar::parse($metar); @@ -178,7 +178,7 @@ public function testMetar5() $this->assertEquals('38 km', $metar['visibility_report']); } - public function testLGKL() + public function testLGKL(): void { $metar = 'LGKL 160320Z AUTO VRB02KT //// -RA ////// 07/04 Q1008 RE//'; $metar = Metar::parse($metar); @@ -187,7 +187,7 @@ public function testLGKL() $this->assertEquals('Light rain', $metar['present_weather_report']); } - public function testLBBG() + public function testLBBG(): void { $metar = 'LBBG 041600Z 12003MPS 310V290 1400 R04/1000D R22/P1500U +SN BKN022 OVC050 M04/M07 Q1020 NOSIG 9949//91='; $metar = Metar::parse($metar); @@ -195,7 +195,7 @@ public function testLBBG() $this->assertEquals('1000m and decreasing', $metar['runways_visual_range'][0]['report']); } - public function testHttpCallSuccess() + public function testHttpCallSuccess(): void { $this->mockPlainTextResponse('aviationweather/kjfk.txt'); @@ -209,7 +209,7 @@ public function testHttpCallSuccess() * TEMPO and trend causing issue with values being overwritten * https://github.com/nabeelio/phpvms/issues/861 */ - public function testLFRSCall() + public function testLFRSCall(): void { $this->mockPlainTextResponse('aviationweather/lfrs.txt'); @@ -221,7 +221,7 @@ public function testLFRSCall() $this->assertTrue($metar['cavok']); } - public function testHttpCallSuccessFullResponse() + public function testHttpCallSuccessFullResponse(): void { $this->mockPlainTextResponse('aviationweather/kphx.txt'); $airportSvc = app(AirportService::class); @@ -229,7 +229,7 @@ public function testHttpCallSuccessFullResponse() $this->assertInstanceOf(Metar::class, $airportSvc->getMetar('kphx')); } - public function testHttpCallEmpty() + public function testHttpCallEmpty(): void { $this->mockPlainTextResponse('aviationweather/empty.txt'); $airportSvc = app(AirportService::class); diff --git a/tests/MoneyTest.php b/tests/MoneyTest.php index 66a405456..46c7e8b84 100644 --- a/tests/MoneyTest.php +++ b/tests/MoneyTest.php @@ -4,12 +4,12 @@ use App\Support\Money; -class MoneyTest extends TestCase +final class MoneyTest extends TestCase { /** * Test adding/subtracting a percentage */ - public function testMoney() + public function testMoney(): void { $money = Money::create(100); $this->assertEquals('$1.00', $money->render()); diff --git a/tests/NewsTest.php b/tests/NewsTest.php index 987ed25d5..e6f8d3ad8 100644 --- a/tests/NewsTest.php +++ b/tests/NewsTest.php @@ -7,12 +7,12 @@ use App\Services\NewsService; use Illuminate\Support\Facades\Notification; -class NewsTest extends TestCase +final class NewsTest extends TestCase { /** @var NewsService */ - private $newsSvc; + private NewsService $newsSvc; - public function setUp(): void + protected function setUp(): void { parent::setUp(); @@ -24,7 +24,7 @@ public function setUp(): void * * @throws \Prettus\Validator\Exceptions\ValidatorException */ - public function testNewsNotifications() + public function testNewsNotifications(): void { /** @var User[] $users */ $users_opt_in = User::factory()->count(5)->create(['opt_in' => true]); diff --git a/tests/OAuthTest.php b/tests/OAuthTest.php index 17b5e56c6..8ae24edf4 100644 --- a/tests/OAuthTest.php +++ b/tests/OAuthTest.php @@ -12,12 +12,12 @@ use Mockery\MockInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -class OAuthTest extends TestCase +final class OAuthTest extends TestCase { /** @var array|string[] The drivers we want to test */ protected array $drivers = ['discord']; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/PIREPTest.php b/tests/PIREPTest.php index 856bc6f65..5540095cb 100644 --- a/tests/PIREPTest.php +++ b/tests/PIREPTest.php @@ -29,15 +29,15 @@ use Carbon\Carbon; use Illuminate\Support\Facades\Notification; -class PIREPTest extends TestCase +final class PIREPTest extends TestCase { /** @var PirepService */ - protected $pirepSvc; + protected PirepService $pirepSvc; /** @var SettingRepository */ - protected $settingsRepo; + protected SettingRepository $settingsRepo; - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->addData('base'); @@ -47,7 +47,7 @@ public function setUp(): void $this->settingsRepo = app(SettingRepository::class); } - protected function createNewRoute() + protected function createNewRoute(): array { $route = []; $navpoints = Navdata::factory()->count(5)->create(); @@ -58,7 +58,7 @@ protected function createNewRoute() return $route; } - protected function getAcarsRoute($pirep) + protected function getAcarsRoute(Pirep $pirep): array { $saved_route = []; $route_points = Acars::where( @@ -73,9 +73,9 @@ protected function getAcarsRoute($pirep) } /** - * @throws Exception + * @throws \Exception */ - public function testAddPirep() + public function testAddPirep(): void { $user = User::factory()->create(); @@ -89,14 +89,14 @@ public function testAddPirep() try { $this->pirepSvc->saveRoute($pirep); - } catch (Exception $e) { + } catch (\Exception $e) { throw $e; } /* * Check the initial state info */ - $this->assertEquals($pirep->state, PirepState::PENDING); + $this->assertEquals(PirepState::PENDING, $pirep->state); /** * Now set the PIREP state to ACCEPTED @@ -165,8 +165,10 @@ public function testAddPirep() /** * Make sure the unit conversions look to be proper + * + * @throws \Exception */ - public function testUnitFields() + public function testUnitFields(): void { /** @var Pirep $pirep */ $pirep = $this->createPirep(); @@ -234,7 +236,7 @@ public function testUnitFields() ); } - public function testGetUserPireps() + public function testGetUserPireps(): void { $this->user = User::factory()->create(); $pirep_done = Pirep::factory()->create([ @@ -278,7 +280,7 @@ public function testGetUserPireps() * * @throws \Exception */ - public function testPirepNotifications() + public function testPirepNotifications(): void { /** @var User $user */ $user = User::factory()->create([ @@ -305,8 +307,10 @@ public function testPirepNotifications() /** * check the stats/ranks, etc have incremented properly + * + * @throws \Exception */ - public function testPilotStatsIncr() + public function testPilotStatsIncr(): void { $this->updateSetting('pilots.count_transfer_hours', false); @@ -382,7 +386,7 @@ public function testPilotStatsIncr() * * @throws \Exception */ - public function testPilotDontChangeRank() + public function testPilotDontChangeRank(): void { /** @var Rank $rank */ $rank = Rank::factory()->create([ @@ -418,8 +422,10 @@ public function testPilotDontChangeRank() /** * check the stats/ranks, etc have incremented properly + * + * @throws \Exception */ - public function testPilotStatsIncrWithTransferHours() + public function testPilotStatsIncrWithTransferHours(): void { $this->updateSetting('pilots.count_transfer_hours', true); @@ -472,7 +478,7 @@ public function testPilotStatsIncrWithTransferHours() * When a PIREP is filed by a user on leave, make sure they flip from leave to active * It doesn't matter if the PIREP is accepted or rejected */ - public function testPilotStatusChange() + public function testPilotStatusChange(): void { /** @var \App\Models\User $user */ $user = User::factory()->create([ @@ -498,7 +504,7 @@ public function testPilotStatusChange() /** * Find and check for any duplicate PIREPs by a user */ - public function testDuplicatePireps() + public function testDuplicatePireps(): void { $user = User::factory()->create(); $pirep = Pirep::factory()->create([ @@ -523,7 +529,10 @@ public function testDuplicatePireps() $this->assertFalse($dupe_pirep); } - public function testCancelViaAPI() + /** + * @throws \Exception + */ + public function testCancelViaAPI(): void { $pirep = $this->createPirep()->toArray(); @@ -554,8 +563,10 @@ public function testCancelViaAPI() /** * When a PIREP is accepted, ensure that the bid is removed + * + * @throws \Exception */ - public function testPirepBidRemoved() + public function testPirepBidRemoved(): void { $bidSvc = app(BidService::class); $flightSvc = app(FlightService::class); @@ -589,7 +600,7 @@ public function testPirepBidRemoved() $this->assertNull($user_bid); } - public function testPirepProgressPercent() + public function testPirepProgressPercent(): void { $this->updateSetting('units.distance', 'km'); @@ -620,7 +631,7 @@ public function testPirepProgressPercent() /** * See that the notifications are properly formatted */ - public function testNotificationFormatting() + public function testNotificationFormatting(): void { $this->updateSetting('units.distance', 'km'); @@ -652,7 +663,10 @@ public function testNotificationFormatting() $this->assertEquals('185.2 km', $fields['Distance']); } - public function testDiversionHandler() + /** + * @throws \Exception + */ + public function testDiversionHandler(): void { $this->updateSetting('pireps.handle_diversion', true); $this->updateSetting('notifications.discord_pirep_diverted', true); diff --git a/tests/RegistrationTest.php b/tests/RegistrationTest.php index 13b8263bf..e24ac00e2 100644 --- a/tests/RegistrationTest.php +++ b/tests/RegistrationTest.php @@ -14,7 +14,7 @@ use Illuminate\Support\Facades\Notification; use Symfony\Component\HttpKernel\Exception\HttpException; -class RegistrationTest extends TestCase +final class RegistrationTest extends TestCase { /** * A basic test example. @@ -23,7 +23,7 @@ class RegistrationTest extends TestCase * * @return void */ - public function testRegistration() + public function testRegistration(): void { $admin = $this->createAdminUser(['name' => 'testRegistration Admin']); @@ -178,7 +178,7 @@ public function testAccessWithInvalidInvite(): void ->assertForbidden(); } - public function testWithInvalidEmail() + public function testWithInvalidEmail(): void { $this->updateSetting('general.disable_registrations', false); $this->updateSetting('general.invite_only_registrations', true); diff --git a/tests/SimBriefTest.php b/tests/SimBriefTest.php index 43a6e6233..fc26b47e2 100644 --- a/tests/SimBriefTest.php +++ b/tests/SimBriefTest.php @@ -15,9 +15,9 @@ use App\Support\Utils; use Carbon\Carbon; -class SimBriefTest extends TestCase +final class SimBriefTest extends TestCase { - private static $simbrief_flight_id = 'simbriefflightid'; + private static string $simbrief_flight_id = 'simbriefflightid'; /** * @param array $attrs Additional user attributes @@ -48,20 +48,20 @@ public function createUserData(array $attrs = []): array /** * Load SimBrief * - * @param \App\Models\User $user - * @param \App\Models\Aircraft|null $aircraft - * @param array $fares - * @param string|null $flight_id + * @param User $user + * @param Aircraft $aircraft + * @param array $fares + * @param string|null $flight_id * - * @return \App\Models\SimBrief + * @return SimBrief */ - protected function loadSimBrief(User $user, Aircraft $aircraft, $fares = [], $flight_id = null): SimBrief + protected function loadSimBrief(User $user, Aircraft $aircraft, array $fares = [], ?string $flight_id = null): SimBrief { if (empty($flight_id)) { $flight_id = self::$simbrief_flight_id; } - /** @var \App\Models\Flight $flight */ + /** @var Flight $flight */ $flight = Flight::factory()->create([ 'id' => $flight_id, 'dpt_airport_id' => 'OMAA', @@ -79,9 +79,9 @@ protected function loadSimBrief(User $user, Aircraft $aircraft, $fares = [], $fl * @param $aircraft * @param $fares * - * @return \App\Models\SimBrief|null + * @return SimBrief|null */ - protected function downloadOfp($user, $flight, $aircraft, $fares) + protected function downloadOfp($user, $flight, $aircraft, $fares): ?SimBrief { $this->mockXmlResponse([ 'simbrief/briefing.xml', @@ -96,8 +96,10 @@ protected function downloadOfp($user, $flight, $aircraft, $fares) /** * Read from the SimBrief URL + * + * @throws \Exception */ - public function testReadSimbrief() + public function testReadSimbrief(): void { $userinfo = $this->createUserData(); $this->user = $userinfo['user']; @@ -136,8 +138,10 @@ public function testReadSimbrief() /** * Check that the API calls are working (simbrief in the response, can retrieve the briefing) + * + * @throws \Exception */ - public function testApiCalls() + public function testApiCalls(): void { $userinfo = $this->createUserData(); $this->user = $userinfo['user']; @@ -181,8 +185,10 @@ public function testApiCalls() /** * Make sure the user's bids have the Simbrief data show up + * + * @throws \Exception */ - public function testUserBidSimbrief() + public function testUserBidSimbrief(): void { $fares = [ [ @@ -229,7 +235,7 @@ public function testUserBidSimbrief() * * @throws \Exception */ - public function testUserBidSimbriefDoesntLeak() + public function testUserBidSimbriefDoesntLeak(): void { $this->updateSetting('bids.disable_flight_on_bid', false); $fares = [ @@ -243,7 +249,7 @@ public function testUserBidSimbriefDoesntLeak() ], ]; - /** @var \App\Models\Flight $flight */ + /** @var Flight $flight */ $flight = Flight::factory()->create(); // Create two briefings and make sure it doesn't leak @@ -279,7 +285,10 @@ public function testUserBidSimbriefDoesntLeak() $this->assertEquals($fares[0]['count'], $subfleet['fares'][0]['count']); } - public function testAttachToPirep() + /** + * @throws \Exception + */ + public function testAttachToPirep(): void { $userinfo = $this->createUserData(); $this->user = $userinfo['user']; @@ -313,10 +322,10 @@ public function testAttachToPirep() $this->assertEquals(12, $acars->count()); $fix = $acars->firstWhere('name', 'BOMUP'); - $this->assertEquals($fix['name'], 'BOMUP'); - $this->assertEquals($fix['lat'], 24.484639); - $this->assertEquals($fix['lon'], 54.578444); - $this->assertEquals($fix['order'], 1); + $this->assertEquals('BOMUP', $fix['name']); + $this->assertEquals(24.484639, $fix['lat']); + $this->assertEquals(54.578444, $fix['lon']); + $this->assertEquals(1, $fix['order']); $briefing->refresh(); @@ -326,8 +335,10 @@ public function testAttachToPirep() /** * Test clearing expired briefs + * + * @throws \Exception */ - public function testClearExpiredBriefs() + public function testClearExpiredBriefs(): void { $userinfo = $this->createUserData(); $user = $userinfo['user']; diff --git a/tests/SubfleetTest.php b/tests/SubfleetTest.php index e3afb020a..79cfaca50 100644 --- a/tests/SubfleetTest.php +++ b/tests/SubfleetTest.php @@ -3,30 +3,31 @@ namespace Tests; use App\Models\Fare; +use App\Models\Subfleet; use App\Services\FareService; -class SubfleetTest extends TestCase +final class SubfleetTest extends TestCase { - protected $ac_svc; - protected $ICAO = 'B777'; - - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->addData('base'); } - public function testSubfleetFaresNoOverride() + /** + * @throws \Exception + */ + public function testSubfleetFaresNoOverride(): void { /** @var FareService $fare_svc */ $fare_svc = app(FareService::class); $subfleet_aircraft = $this->createSubfleetWithAircraft(1); - /** @var \App\Models\Subfleet $subfleet */ + /** @var Subfleet $subfleet */ $subfleet = $subfleet_aircraft['subfleet']; - /** @var \App\Models\Fare $fare */ + /** @var Fare $fare */ $fare = Fare::factory()->create(); $fare_svc->setForSubfleet($subfleet, $fare); diff --git a/tests/TestCase.php b/tests/TestCase.php index 905b40490..7e627532b 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -54,7 +54,7 @@ abstract class TestCase extends \Illuminate\Foundation\Testing\TestCase /** * @throws Exception */ - public function setUp(): void + protected function setUp(): void { parent::setUp(); @@ -88,7 +88,7 @@ public function setUp(): void * https://stackoverflow.com/a/41945739 * https://gist.github.com/adamwathan/c9752f61102dc056d157 */ - protected function disableExceptionHandling() + protected function disableExceptionHandling(): void { $this->app->instance(ExceptionHandler::class, new class() extends Handler { /** @noinspection PhpMissingParentConstructorInspection */ @@ -109,9 +109,9 @@ public function render($request, \Throwable $e) } /** - * @param $mocks + * @param callable|null $mocks */ - protected function addMocks($mocks) + protected function addMocks(?callable $mocks): void { $handler = HandlerStack::create($mocks); $client = new Client(['handler' => $handler]); @@ -119,12 +119,12 @@ protected function addMocks($mocks) } /** - * @param $user - * @param array $headers + * @param User|null $user + * @param array $headers * * @return array */ - public function headers($user = null, array $headers = []): array + public function headers(?User $user = null, array $headers = []): array { if ($user !== null) { $headers['x-api-key'] = $user->api_key; @@ -141,9 +141,9 @@ public function headers($user = null, array $headers = []): array /** * Import data from a YML file * - * @param $file + * @param string $file */ - public function addData($file) + public function addData(string $file): void { $svc = app(DatabaseService::class); $file_path = base_path('tests/data/'.$file.'.yml'); @@ -157,10 +157,10 @@ public function addData($file) /** * Make sure an object has the list of keys * - * @param $obj + * @param array $obj * @param array $keys */ - public function assertHasKeys($obj, array $keys = []): void + public function assertHasKeys(array $obj, array $keys = []): void { foreach ($keys as $key) { $this->assertArrayHasKey($key, $obj); @@ -170,11 +170,11 @@ public function assertHasKeys($obj, array $keys = []): void /** * Read a file from the data directory * - * @param $filename + * @param string $filename * * @return false|string */ - public function readDataFile($filename) + public function readDataFile(string $filename): bool|string { $paths = [ 'data/'.$filename, @@ -195,7 +195,7 @@ public function readDataFile($filename) * * @param array|string $files */ - public function mockGuzzleClient($files): void + public function mockGuzzleClient(array|string $files): void { if (!is_array($files)) { $files = [$files]; @@ -218,7 +218,7 @@ public function mockGuzzleClient($files): void /** * @param array|string $files The filename or files to respond with */ - public function mockXmlResponse($files) + public function mockXmlResponse(array|string $files): void { if (!is_array($files)) { $files = [$files]; @@ -264,10 +264,10 @@ public function mockPlainTextResponse(array|string $files): void /** * Update a setting * - * @param $key - * @param $value + * @param string $key + * @param string $value */ - public function updateSetting($key, $value) + public function updateSetting(string $key, string $value): void { $settingsRepo = app(SettingRepository::class); $settingsRepo->store($key, $value); @@ -277,15 +277,15 @@ public function updateSetting($key, $value) * So we can test private/protected methods * http://bit.ly/1mr5hMq * - * @param $object - * @param $methodName - * @param array $parameters + * @param $object + * @param string $methodName + * @param array $parameters * * @throws \ReflectionException * * @return mixed */ - public function invokeMethod(&$object, $methodName, array $parameters = []) + public function invokeMethod(&$object, string $methodName, array $parameters = []): mixed { $reflection = new ReflectionClass(get_class($object)); $method = $reflection->getMethod($methodName); @@ -302,7 +302,7 @@ public function invokeMethod(&$object, $methodName, array $parameters = []) * * @return array */ - protected function transformData(&$data) + protected function transformData(array &$data): array { foreach ($data as $key => &$value) { if (is_array($value)) { @@ -332,7 +332,7 @@ protected function transformData(&$data) * @param array $headers * @param null $user * - * @return \Illuminate\Testing\TestResponse + * @return TestResponse */ public function get($uri, array $headers = [], $user = null): TestResponse { diff --git a/tests/TestData.php b/tests/TestData.php index a05a39208..63309f009 100644 --- a/tests/TestData.php +++ b/tests/TestData.php @@ -6,11 +6,13 @@ use App\Models\Enums\UserState; use App\Models\Flight; use App\Models\Pirep; +use App\Models\Rank; use App\Models\Role; use App\Models\Subfleet; use App\Models\User; use App\Services\UserService; use Exception; +use Illuminate\Database\Eloquent\Collection; trait TestData { @@ -63,7 +65,7 @@ public function createAdminUser(array $attrs = []): User * * @return \App\Models\Pirep */ - protected function createPirep(array $user_attrs = [], array $pirep_attrs = []) + protected function createPirep(array $user_attrs = [], array $pirep_attrs = []): Pirep { $subfleet = $this->createSubfleetWithAircraft(2); $rank = $this->createRank(10, [$subfleet['subfleet']->id]); @@ -88,15 +90,11 @@ protected function createPirep(array $user_attrs = [], array $pirep_attrs = []) * * @return mixed */ - public function createRank(int $hours, array $subfleet_ids) + public function createRank(int $hours, array $subfleet_ids): Rank { $attrs = []; - if ($hours === null) { - $attrs['hours'] = $hours; - } - - $rank = \App\Models\Rank::factory()->create($attrs); + $rank = Rank::factory()->create($attrs); if (!empty($subfleet_ids)) { $rank->subfleets()->syncWithoutDetaching($subfleet_ids); } @@ -107,12 +105,12 @@ public function createRank(int $hours, array $subfleet_ids) /** * Add a single flight * - * @param $user + * @param User $user * @param array $flight_properties * * @return mixed */ - public function addFlight($user, $flight_properties = []) + public function addFlight(User $user, array $flight_properties = [], ?int $subfleet_id = null): Flight { $opts = array_merge([ 'airline_id' => $user->airline_id, @@ -120,11 +118,14 @@ public function addFlight($user, $flight_properties = []) $flight = Flight::factory()->create($opts); - $flight->subfleets()->syncWithoutDetaching([ - Subfleet::factory()->create([ + if ($subfleet_id === null) { + /** @var Subfleet $subfleet */ + $subfleet_id = Subfleet::factory()->create([ 'airline_id' => $user->airline_id, - ])->id, - ]); + ])->id; + } + + $flight->subfleets()->syncWithoutDetaching([$subfleet_id]); return $flight; } @@ -135,9 +136,9 @@ public function addFlight($user, $flight_properties = []) * @param $subfleet * @param $num_flights * - * @return \App\Models\Flight[] + * @return Collection */ - public function addFlightsForSubfleet($subfleet, $num_flights) + public function addFlightsForSubfleet($subfleet, $num_flights): Collection { return Flight::factory()->count($num_flights)->create([ 'airline_id' => $subfleet->airline->id, @@ -150,14 +151,12 @@ public function addFlightsForSubfleet($subfleet, $num_flights) /** * Create a subfleet with a number of aircraft assigned * - * @param null $aircraft_count - * @param null $airport_id - * - * @throws Exception + * @param int|null $aircraft_count + * @param string|null $airport_id * - * @return mixed + * @return array */ - public function createSubfleetWithAircraft($aircraft_count = null, $airport_id = null) + public function createSubfleetWithAircraft(?int $aircraft_count = null, ?string $airport_id = null): array { /** @var Subfleet $subfleet */ $subfleet = Subfleet::factory()->create([ diff --git a/tests/UserTest.php b/tests/UserTest.php index 4bc5ebaa7..46700fba1 100644 --- a/tests/UserTest.php +++ b/tests/UserTest.php @@ -17,15 +17,15 @@ use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Hash; -class UserTest extends TestCase +final class UserTest extends TestCase { /** @var SettingRepository */ - protected $settingsRepo; + protected SettingRepository $settingsRepo; /** @var UserService */ - protected $userSvc; + protected UserService $userSvc; - public function setUp(): void + protected function setUp(): void { parent::setUp(); $this->userSvc = app(UserService::class); @@ -36,7 +36,7 @@ public function setUp(): void * Makes sure that the subfleet/aircraft returned are allowable * by the users rank. */ - public function testRankSubfleets() + public function testRankSubfleets(): void { // Add subfleets and aircraft, but also add another // set of subfleets @@ -93,7 +93,7 @@ public function testRankSubfleets() * * @throws \Exception */ - public function testGetAllAircraft() + public function testGetAllAircraft(): void { $fare_svc = app(FareService::class); diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index 9aa5ef593..1875cd52e 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php @@ -8,20 +8,22 @@ use App\Support\Units\Time; use App\Support\Utils; use Carbon\Carbon; +use PhpUnitsOfMeasure\Exception\NonNumericValue; +use PhpUnitsOfMeasure\Exception\NonStringUnitName; -class UtilsTest extends TestCase +final class UtilsTest extends TestCase { - public function testDates() + public function testDates(): void { $carbon = new Carbon('2018-04-28T12:55:40Z'); $this->assertNotNull($carbon); } /** - * @throws \PhpUnitsOfMeasure\Exception\NonNumericValue - * @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName + * @throws NonNumericValue + * @throws NonStringUnitName */ - public function testUnitRounding() + public function testUnitRounding(): void { $this->updateSetting('units.distance', 'km'); @@ -65,7 +67,7 @@ public function testUnitRounding() /** * Simple test for KVP */ - public function testKvp() + public function testKvp(): void { /** @var KvpRepository $kvpRepo */ $kvpRepo = app(KvpRepository::class); @@ -83,7 +85,7 @@ public function testKvp() /** * @throws \Exception */ - public function testSecondsToTimeParts() + public function testSecondsToTimeParts(): void { $t = Time::secondsToTimeParts(3600); $this->assertEquals(['h' => 1, 'm' => 0, 's' => 0], $t); @@ -104,7 +106,7 @@ public function testSecondsToTimeParts() /** * @throws \Exception */ - public function testSecondsToTime() + public function testSecondsToTime(): void { $t = Time::secondsToTimeString(3600); $this->assertEquals('1h 0m', $t); @@ -119,7 +121,7 @@ public function testSecondsToTime() $this->assertEquals('1h 2m 2s', $t); } - public function testMinutesToTime() + public function testMinutesToTime(): void { $t = Time::minutesToTimeParts(65); $this->assertEquals(['h' => 1, 'm' => 5], $t); @@ -131,7 +133,7 @@ public function testMinutesToTime() $this->assertEquals('720h 0m', $t); } - public function testApiKey() + public function testApiKey(): void { $api_key = Utils::generateApiKey(); $this->assertNotNull($api_key); @@ -140,13 +142,13 @@ public function testApiKey() /** * @throws \Exception */ - public function testHexCode() + public function testHexCode(): void { $hex_code = ICAO::createHexCode(); $this->assertNotNull($hex_code); } - public function testGetDomain() + public function testGetDomain(): void { $tests = [ 'http://phpvms.net', diff --git a/tests/VersionTest.php b/tests/VersionTest.php index e6c3cbc26..b6fd0c34c 100644 --- a/tests/VersionTest.php +++ b/tests/VersionTest.php @@ -5,11 +5,11 @@ use App\Repositories\KvpRepository; use App\Services\VersionService; -class VersionTest extends TestCase +final class VersionTest extends TestCase { - private $kvpRepo; + private KvpRepository $kvpRepo; - public function setUp(): void + protected function setUp(): void { parent::setUp(); From 4b936ada93cbb187fb133f47db88d70daac5c557 Mon Sep 17 00:00:00 2001 From: "B.Fatih KOZ" Date: Wed, 21 Feb 2024 22:54:34 +0300 Subject: [PATCH 4/7] Update backup.php (#1757) Co-authored-by: Nabeel S --- config/backup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/backup.php b/config/backup.php index c57f5b3a9..3bcd47341 100644 --- a/config/backup.php +++ b/config/backup.php @@ -141,7 +141,7 @@ /* * The filename prefix used for the backup zip file. */ - 'filename_prefix' => '', + 'filename_prefix' => env('BACKUP_FILENAME_PREFIX', ''), /* * The disk names on which the backups will be stored. From b831bb20bf0ec57064f7758663ced165c2874c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Parient=C3=A9?= <41431456+arthurpar06@users.noreply.github.com> Date: Wed, 28 Feb 2024 17:55:18 +0100 Subject: [PATCH 5/7] Add setting for Discord PirepFiled Notifications (#1781) --- app/Database/seeds/settings.yml | 7 +++++++ app/Notifications/NotificationEventsHandler.php | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Database/seeds/settings.yml b/app/Database/seeds/settings.yml index 98377e266..fbac5d46f 100644 --- a/app/Database/seeds/settings.yml +++ b/app/Database/seeds/settings.yml @@ -542,3 +542,10 @@ options: '' type: boolean description: Send out a discord notification when a pirep is diverted +- key: notifications.discord_pirep_filed + name: Discord Pirep Filed Message (Public) + group: notifications + value: true + options: '' + type: boolean + description: Send out a discord notification when a pirep is filed diff --git a/app/Notifications/NotificationEventsHandler.php b/app/Notifications/NotificationEventsHandler.php index a932e6bae..260340985 100644 --- a/app/Notifications/NotificationEventsHandler.php +++ b/app/Notifications/NotificationEventsHandler.php @@ -219,7 +219,9 @@ public function onPirepFile(PirepFiled $event): void /* * Broadcast notifications */ - Notification::send([$event->pirep], new Messages\Broadcast\PirepFiled($event->pirep)); + if (setting('notifications.discord_pirep_filed', true)) { + Notification::send([$event->pirep], new Messages\Broadcast\PirepFiled($event->pirep)); + } } /** From 6f352ebe29967a1be3c54f174e755663ce818c4e Mon Sep 17 00:00:00 2001 From: Taylor Broad Date: Thu, 29 Feb 2024 02:02:30 +0900 Subject: [PATCH 6/7] Add env config option to set default theme (#1777) Co-authored-by: Nabeel S --- config/themes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/themes.php b/config/themes.php index 1bac82d8d..9d5b3a6bc 100644 --- a/config/themes.php +++ b/config/themes.php @@ -3,7 +3,7 @@ return [ 'themes_path' => resource_path('views/layouts'), // eg: base_path('resources/themes') 'asset_not_found' => 'LOG_ERROR', - 'default' => 'default', + 'default' => env('DEFAULT_THEME', 'default'), 'cache' => true, /* From 143d927e6e5cc9b61f8d6ed80bff853c76e70172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Parient=C3=A9?= <41431456+arthurpar06@users.noreply.github.com> Date: Wed, 28 Feb 2024 18:32:16 +0100 Subject: [PATCH 7/7] Add support for PHP83 (#1763) * Add PHP83 to build * Upgrade minimum laravel version * Use PHP83 in sail * Fix drop_user_oauth_tokens_foreign_keys with sqlite (tests) * Add themeEngine to ThemeViewFinder * Fix deprecated null value for first parameter of str_contains in Rank * Upgrade jmikola/geojson to fix deprecated warnings * Fix null parameter to DateTimeImmutable deprecated * Upgrade santigarcor/laratrust to fix deprecation warnings * Update composer.lock * Fix warning in CommaDelimitedCast.php * Update composer.lock --------- Co-authored-by: Nabeel S --- .github/workflows/build.yml | 2 +- ...30_drop_user_oauth_tokens_foreign_keys.php | 19 ++++---- app/Models/Casts/CommaDelimitedCast.php | 2 +- app/Models/Rank.php | 12 ++++- app/Support/ThemeViewFinder.php | 2 + app/Support/Timezonelist.php | 2 +- composer.json | 6 +-- composer.lock | 46 ++++++++++--------- docker-compose.yml | 4 +- 9 files changed, 56 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0969105b5..d846e64c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: true matrix: - php-versions: ['8.1', '8.2'] + php-versions: ['8.1', '8.2', '8.3'] name: PHP ${{ matrix.php-versions }} env: extensions: intl, pcov, mbstring diff --git a/app/Database/migrations/2023_12_24_091030_drop_user_oauth_tokens_foreign_keys.php b/app/Database/migrations/2023_12_24_091030_drop_user_oauth_tokens_foreign_keys.php index 97008e341..ee3e51941 100644 --- a/app/Database/migrations/2023_12_24_091030_drop_user_oauth_tokens_foreign_keys.php +++ b/app/Database/migrations/2023_12_24_091030_drop_user_oauth_tokens_foreign_keys.php @@ -2,21 +2,24 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class() extends Migration { public function up(): void { - Schema::table('user_oauth_tokens', function (Blueprint $table) { - $foreignKeys = Schema::getForeignKeys('user_oauth_tokens'); + if (DB::getDriverName() !== 'sqlite') { + Schema::table('user_oauth_tokens', function (Blueprint $table) { + $foreignKeys = Schema::getForeignKeys('user_oauth_tokens'); - foreach ($foreignKeys as $foreignKey) { - if (in_array('user_id', $foreignKey['columns'], true)) { - $table->dropForeign(['user_id']); - break; + foreach ($foreignKeys as $foreignKey) { + if (in_array('user_id', $foreignKey['columns'], true)) { + $table->dropForeign(['user_id']); + break; + } } - } - }); + }); + } } public function down(): void diff --git a/app/Models/Casts/CommaDelimitedCast.php b/app/Models/Casts/CommaDelimitedCast.php index 5f8eec7b2..5d04e5c2e 100644 --- a/app/Models/Casts/CommaDelimitedCast.php +++ b/app/Models/Casts/CommaDelimitedCast.php @@ -18,7 +18,7 @@ class CommaDelimitedCast implements CastsAttributes */ public function get($model, string $key, $value, array $attributes) { - if (empty(trim($value))) { + if (empty($value) || empty(trim($value))) { return []; } diff --git a/app/Models/Rank.php b/app/Models/Rank.php index d33729822..7f530cb2d 100644 --- a/app/Models/Rank.php +++ b/app/Models/Rank.php @@ -68,7 +68,17 @@ class Rank extends Model public function imageUrl(): Attribute { return Attribute::make( - get: fn ($value) => str_contains($value, 'http') ? $value : (filled($value) ? public_url($value) : null), + get: function ($value) { + if (!filled($value)) { + return null; + } + + if (str_contains($value, 'http')) { + return $value; + } + + return public_url($value); + }, ); } diff --git a/app/Support/ThemeViewFinder.php b/app/Support/ThemeViewFinder.php index e95eeb90b..229934aff 100644 --- a/app/Support/ThemeViewFinder.php +++ b/app/Support/ThemeViewFinder.php @@ -8,6 +8,8 @@ class ThemeViewFinder extends \Igaster\LaravelTheme\themeViewFinder { + protected $themeEngine; + public function __construct(Filesystem $files, array $paths, array $extensions = null) { //$this->themeEngine = \App::make('igaster.themes'); diff --git a/app/Support/Timezonelist.php b/app/Support/Timezonelist.php index 6443d2fa2..9819913d9 100644 --- a/app/Support/Timezonelist.php +++ b/app/Support/Timezonelist.php @@ -76,7 +76,7 @@ class Timezonelist public static function formatTimezone($timezone, $continent, $htmlencode = true) { try { - $time = new \DateTimeImmutable(null, new DateTimeZone($timezone)); + $time = new \DateTimeImmutable('now', new DateTimeZone($timezone)); } catch (\Exception $e) { Log::error($e->getMessage()); return ''; diff --git a/composer.json b/composer.json index d645ef41f..1df702c43 100644 --- a/composer.json +++ b/composer.json @@ -39,14 +39,14 @@ "psr/container": "1.1.1", "composer/composer": "~2.6.5", "composer/installers": "~1.12.0", - "laravel/framework": "~v10.0", + "laravel/framework": "~v10.22", "arrilot/laravel-widgets": "~3.13.0", "doctrine/dbal": "^3.0", "guzzlehttp/guzzle": "~7.4.1", "hashids/hashids": "~4.1.0", "igaster/laravel-theme": "dev-master", "intervention/image": "~2.4", - "jmikola/geojson": "1.0.*", + "jmikola/geojson": "^1.2.0", "joshbrw/laravel-module-installer": "~2.0.1", "laracasts/flash": "~3.2.2", "laravel/helpers": "~v1.6.0", @@ -63,7 +63,7 @@ "php-units-of-measure/php-units-of-measure": "~2.1.0", "phpvms/sample-module": "~1.0", "prettus/l5-repository": "~2.9.0", - "santigarcor/laratrust": "^8.0", + "santigarcor/laratrust": "^8.2.2", "semver/semver": "~1.1.0", "spatie/valuestore": "~1.3.2", "tivie/php-os-detector": "~1.1.0", diff --git a/composer.lock b/composer.lock index 3ba4f9511..c517b16f4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3bc446adf838589e9ad97baa9dc4e65f", + "content-hash": "6277e708db3cbb945c624a2e3d2f08aa", "packages": [ { "name": "akaunting/laravel-money", @@ -3265,37 +3265,39 @@ }, { "name": "jmikola/geojson", - "version": "1.0.3", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/jmikola/geojson.git", - "reference": "f5b122e15c804fabc5881da214c57d52ea0c5715" + "reference": "e28f3855bb61a91aab32b74c176d76dd0b5658d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jmikola/geojson/zipball/f5b122e15c804fabc5881da214c57d52ea0c5715", - "reference": "f5b122e15c804fabc5881da214c57d52ea0c5715", + "url": "https://api.github.com/repos/jmikola/geojson/zipball/e28f3855bb61a91aab32b74c176d76dd0b5658d7", + "reference": "e28f3855bb61a91aab32b74c176d76dd0b5658d7", "shasum": "" }, "require": { - "php": ">=5.3.3" + "ext-json": "*", + "php": "^7.4 || ^8.0", + "symfony/polyfill-php80": "^1.25" }, "require-dev": { - "phpunit/phpunit": "~3.7" + "phpunit/phpunit": "^9.5", + "scrutinizer/ocular": "^1.8.1", + "slevomat/coding-standard": "^8.0", + "squizlabs/php_codesniffer": "^3.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.1-dev" } }, "autoload": { - "psr-0": { - "GeoJson\\": "src/" - }, - "classmap": [ - "stubs/" - ] + "psr-4": { + "GeoJson\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3316,9 +3318,9 @@ ], "support": { "issues": "https://github.com/jmikola/geojson/issues", - "source": "https://github.com/jmikola/geojson/tree/1.0.3" + "source": "https://github.com/jmikola/geojson/tree/1.2.0" }, - "time": "2022-01-21T04:20:33+00:00" + "time": "2023-12-04T17:19:43+00:00" }, { "name": "joshbrw/laravel-module-installer", @@ -7574,16 +7576,16 @@ }, { "name": "santigarcor/laratrust", - "version": "8.2.1", + "version": "8.2.2", "source": { "type": "git", "url": "https://github.com/santigarcor/laratrust.git", - "reference": "58d75e531de46f162d61f91f17e771a9ecb1132e" + "reference": "c95c52079d522c6707bc0b48dd46506a2faebe76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/santigarcor/laratrust/zipball/58d75e531de46f162d61f91f17e771a9ecb1132e", - "reference": "58d75e531de46f162d61f91f17e771a9ecb1132e", + "url": "https://api.github.com/repos/santigarcor/laratrust/zipball/c95c52079d522c6707bc0b48dd46506a2faebe76", + "reference": "c95c52079d522c6707bc0b48dd46506a2faebe76", "shasum": "" }, "require": { @@ -7637,7 +7639,7 @@ ], "support": { "issues": "https://github.com/santigarcor/laratrust/issues", - "source": "https://github.com/santigarcor/laratrust/tree/8.2.1" + "source": "https://github.com/santigarcor/laratrust/tree/8.2.2" }, "funding": [ { @@ -7645,7 +7647,7 @@ "type": "github" } ], - "time": "2023-04-24T20:19:58+00:00" + "time": "2024-01-18T23:02:24+00:00" }, { "name": "seld/jsonlint", diff --git a/docker-compose.yml b/docker-compose.yml index 97d804bec..8fab215e7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,11 @@ services: laravel.test: build: - context: ./vendor/laravel/sail/runtimes/8.2 + context: ./vendor/laravel/sail/runtimes/8.3 dockerfile: Dockerfile args: WWWGROUP: '${WWWGROUP}' - image: sail-8.2/app + image: sail-8.3/app extra_hosts: - 'host.docker.internal:host-gateway' ports: