diff --git a/Makefile b/Makefile index 0d83227a..fea20e43 100644 --- a/Makefile +++ b/Makefile @@ -74,9 +74,9 @@ reload-db: tests: test .PHONY: test -test: phpcs - #php artisan database:create --reset - vendor/bin/phpunit --debug --verbose +test: + @#php artisan database:create --reset + @vendor/bin/phpunit --verbose --debug .PHONY: phpcs phpcs: diff --git a/app/Database/factories/AircraftFactory.php b/app/Database/factories/AircraftFactory.php index 17062581..19c6d7e7 100644 --- a/app/Database/factories/AircraftFactory.php +++ b/app/Database/factories/AircraftFactory.php @@ -6,10 +6,10 @@ $factory->define(App\Models\Aircraft::class, function (Faker $faker) { return [ 'id' => null, 'subfleet_id' => function () { - return factory(App\Models\Subfleet::class)->create()->id; + return factory(\App\Models\Subfleet::class)->create()->id; }, 'airport_id' => function () { - return factory(App\Models\Airport::class)->create()->id; + return factory(\App\Models\Airport::class)->create()->id; }, 'iata' => $faker->unique()->text(5), 'icao' => $faker->unique()->text(5), diff --git a/app/Database/factories/FlightFactory.php b/app/Database/factories/FlightFactory.php index 3d117dd3..c8b5aaed 100644 --- a/app/Database/factories/FlightFactory.php +++ b/app/Database/factories/FlightFactory.php @@ -8,19 +8,19 @@ $factory->define(App\Models\Flight::class, function (Faker $faker) { return [ 'id' => $faker->unique()->numberBetween(10, 10000000), 'airline_id' => function () { - return factory(App\Models\Airline::class)->create()->id; + return factory(\App\Models\Airline::class)->create()->id; }, 'flight_number' => $faker->unique()->numberBetween(10, 1000000), 'route_code' => $faker->randomElement(['', $faker->text(5)]), 'route_leg' => $faker->randomElement(['', $faker->numberBetween(0, 1000)]), 'dpt_airport_id' => function () { - return factory(App\Models\Airport::class)->create()->id; + return factory(\App\Models\Airport::class)->create()->id; }, 'arr_airport_id' => function () { - return factory(App\Models\Airport::class)->create()->id; + return factory(\App\Models\Airport::class)->create()->id; }, 'alt_airport_id' => function () { - return factory(App\Models\Airport::class)->create()->id; + return factory(\App\Models\Airport::class)->create()->id; }, 'distance' => $faker->numberBetween(1, 1000), 'route' => null, diff --git a/app/Database/factories/JournalTransactionsFactory.php b/app/Database/factories/JournalTransactionsFactory.php index 55c80b9b..39bc18d8 100644 --- a/app/Database/factories/JournalTransactionsFactory.php +++ b/app/Database/factories/JournalTransactionsFactory.php @@ -6,7 +6,7 @@ $factory->define(App\Models\JournalTransactions::class, function (Faker $faker) return [ 'transaction_group' => \Ramsey\Uuid\Uuid::uuid4()->toString(), 'journal_id' => function () { - return factory(App\Models\Journal::class)->create()->id; + return factory(\App\Models\Journal::class)->create()->id; }, 'credit' => $faker->numberBetween(100, 10000), 'debit' => $faker->numberBetween(100, 10000), diff --git a/app/Database/factories/NewsFactory.php b/app/Database/factories/NewsFactory.php index 1e0c6adb..2ddfaca9 100644 --- a/app/Database/factories/NewsFactory.php +++ b/app/Database/factories/NewsFactory.php @@ -6,7 +6,7 @@ $factory->define(App\Models\News::class, function (Faker $faker) { return [ 'id' => null, 'user_id' => function () { - return factory(App\Models\User::class)->create()->id; + return factory(\App\Models\User::class)->create()->id; }, 'subject' => $faker->text(), 'body' => $faker->sentence, diff --git a/app/Database/factories/PirepFactory.php b/app/Database/factories/PirepFactory.php index b4f8cfe5..27dfb786 100644 --- a/app/Database/factories/PirepFactory.php +++ b/app/Database/factories/PirepFactory.php @@ -10,8 +10,8 @@ use Faker\Generator as Faker; * Create a new PIREP */ $factory->define(App\Models\Pirep::class, function (Faker $faker) { - $airline = factory(App\Models\Airline::class)->create(); - $flight = factory(App\Models\Flight::class)->create([ + $airline = factory(\App\Models\Airline::class)->create(); + $flight = factory(\App\Models\Flight::class)->create([ 'airline_id' => $airline->id, ]); @@ -21,10 +21,10 @@ $factory->define(App\Models\Pirep::class, function (Faker $faker) { return $airline->id; }, 'user_id' => function () { - return factory(App\Models\User::class)->create()->id; + return factory(\App\Models\User::class)->create()->id; }, 'aircraft_id' => function () { - return factory(App\Models\Aircraft::class)->create()->id; + return factory(\App\Models\Aircraft::class)->create()->id; }, 'flight_id' => function () use ($flight) { return $flight->id; diff --git a/app/Database/factories/SubfleetFactory.php b/app/Database/factories/SubfleetFactory.php index d4e24459..a721be90 100644 --- a/app/Database/factories/SubfleetFactory.php +++ b/app/Database/factories/SubfleetFactory.php @@ -6,7 +6,7 @@ $factory->define(App\Models\Subfleet::class, function (Faker $faker) { return [ 'id' => null, 'airline_id' => function () { - return factory(App\Models\Airline::class)->create()->id; + return factory(\App\Models\Airline::class)->create()->id; }, 'name' => $faker->unique()->text(50), 'type' => $faker->unique()->text(7), diff --git a/app/Database/factories/UserFactory.php b/app/Database/factories/UserFactory.php index 85ab8cbf..c75bf814 100644 --- a/app/Database/factories/UserFactory.php +++ b/app/Database/factories/UserFactory.php @@ -14,7 +14,7 @@ $factory->define(App\Models\User::class, function (Faker $faker) { 'password' => $password ?: $password = Hash::make('secret'), 'api_key' => $faker->sha1, 'airline_id' => function () { - return factory(App\Models\Airline::class)->create()->id; + return factory(\App\Models\Airline::class)->create()->id; }, 'rank_id' => 1, 'flights' => $faker->numberBetween(0, 1000), diff --git a/app/Database/seeds/dev/base.yml b/app/Database/seeds/dev/base.yml index d3c05f9c..89a960e6 100644 --- a/app/Database/seeds/dev/base.yml +++ b/app/Database/seeds/dev/base.yml @@ -12,3 +12,11 @@ airlines: active: 1 created_at: now updated_at: now + - id: 2 + icao: XXX + iata: XX + name: inactive airline + country: us + active: 0 + created_at: now + updated_at: now diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index cbdb9618..40633176 100755 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -6,8 +6,6 @@ use App\Exceptions\Converters\GenericExceptionAbstract; use App\Exceptions\Converters\SymfonyException; use App\Exceptions\Converters\ValidationException; use App\Http\Middleware\SetActiveTheme; -use Exception; -use Illuminate\Auth\Access\AuthorizationException; use Illuminate\Auth\AuthenticationException; use Illuminate\Contracts\Container\BindingResolutionException; use Illuminate\Database\Eloquent\ModelNotFoundException; @@ -16,7 +14,6 @@ use Illuminate\Http\Request; use Illuminate\Session\TokenMismatchException; use Illuminate\Support\Facades\Log; use Illuminate\Validation\ValidationException as IlluminateValidationException; -use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException as SymfonyHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Throwable; diff --git a/app/Http/Controllers/Api/FlightController.php b/app/Http/Controllers/Api/FlightController.php index 17664f7a..7826ab0f 100644 --- a/app/Http/Controllers/Api/FlightController.php +++ b/app/Http/Controllers/Api/FlightController.php @@ -78,29 +78,32 @@ class FlightController extends Controller */ public function search(Request $request) { + /** @var \App\Models\User $user */ $user = Auth::user(); + $where = [ 'active' => true, 'visible' => true, ]; // Allow the option to bypass some of these restrictions for the searches - if (!$request->filled('ignore_restrictions') - || $request->get('ignore_restrictions') === '0' - ) { + if (!$request->filled('ignore_restrictions') || $request->get('ignore_restrictions') === '0') { if (setting('pilots.restrict_to_company')) { - $where['airline_id'] = Auth::user()->airline_id; + $where['airline_id'] = $user->airline_id; } if (setting('pilots.only_flights_from_current')) { - $where['dpt_airport_id'] = Auth::user()->curr_airport_id; + $where['dpt_airport_id'] = $user->curr_airport_id; } } try { $this->flightRepo->resetCriteria(); $this->flightRepo->searchCriteria($request); - $this->flightRepo->pushCriteria(new WhereCriteria($request, $where)); + $this->flightRepo->pushCriteria(new WhereCriteria($request, $where, [ + 'airline' => ['active' => true], + ])); + $this->flightRepo->pushCriteria(new RequestCriteria($request)); $flights = $this->flightRepo diff --git a/app/Http/Controllers/Frontend/FlightController.php b/app/Http/Controllers/Frontend/FlightController.php index b0c3bb4a..853d454a 100644 --- a/app/Http/Controllers/Frontend/FlightController.php +++ b/app/Http/Controllers/Frontend/FlightController.php @@ -75,8 +75,9 @@ class FlightController extends Controller public function search(Request $request) { $where = [ - 'active' => true, - 'visible' => true, + 'active' => true, + 'visible' => true, + 'airlines.active' => true, ]; if (setting('pilots.restrict_to_company')) { diff --git a/app/Repositories/AirlineRepository.php b/app/Repositories/AirlineRepository.php index 16c7bb1a..a397d794 100644 --- a/app/Repositories/AirlineRepository.php +++ b/app/Repositories/AirlineRepository.php @@ -27,14 +27,19 @@ class AirlineRepository extends Repository implements CacheableInterface /** * Return the list of airline formatted for a select box * - * @param mixed $add_blank + * @param bool $add_blank + * @param bool $only_active * * @return array */ - public function selectBoxList($add_blank = false): array + public function selectBoxList($add_blank = false, $only_active = true): array { $retval = []; - $items = $this->all(); + $where = [ + 'active' => $only_active, + ]; + + $items = $this->findWhere($where); if ($add_blank) { $retval[''] = ''; diff --git a/composer.json b/composer.json index a7e7b220..b35b4660 100755 --- a/composer.json +++ b/composer.json @@ -69,7 +69,7 @@ "friendsofphp/php-cs-fixer": "^2.16", "mockery/mockery": "0.9.*", "nunomaduro/collision": "^4.0", - "phpunit/phpunit": "~8.3", + "phpunit/phpunit": "~9.0", "squizlabs/php_codesniffer": "3.*", "sempro/phpunit-pretty-print": "^1.2" }, @@ -88,10 +88,7 @@ "autoload-dev": { "psr-4": { "Tests\\": "tests/" - }, - "classmap": [ - "tests/TestCase.php" - ] + } }, "extra": { "installer-types": ["phpvms-module"], diff --git a/composer.lock b/composer.lock index 4ed32c0e..53aaf4ef 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": "68243702e511968171e9effc136ba005", + "content-hash": "088f9565d77e5da71d022828d816ef2b", "packages": [ { "name": "akaunting/money", @@ -548,16 +548,16 @@ }, { "name": "codedge/laravel-selfupdater", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/codedge/laravel-selfupdater.git", - "reference": "ebfe102bdde09d28e3188663fbb667c8d38768f8" + "reference": "b19c86a9eda1b0b67e8041592b52715735f387a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/codedge/laravel-selfupdater/zipball/ebfe102bdde09d28e3188663fbb667c8d38768f8", - "reference": "ebfe102bdde09d28e3188663fbb667c8d38768f8", + "url": "https://api.github.com/repos/codedge/laravel-selfupdater/zipball/b19c86a9eda1b0b67e8041592b52715735f387a4", + "reference": "b19c86a9eda1b0b67e8041592b52715735f387a4", "shasum": "" }, "require": { @@ -622,7 +622,7 @@ "type": "github" } ], - "time": "2020-04-20T15:59:08+00:00" + "time": "2020-05-20T07:10:30+00:00" }, { "name": "composer/ca-bundle", @@ -1624,16 +1624,16 @@ }, { "name": "facade/ignition", - "version": "2.0.2", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/facade/ignition.git", - "reference": "67f1677954ad33ca6b77f2c41cf43a58624f27fc" + "reference": "749fba7bf560fe2600ea55bf8734a7c9b8c30cfd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/ignition/zipball/67f1677954ad33ca6b77f2c41cf43a58624f27fc", - "reference": "67f1677954ad33ca6b77f2c41cf43a58624f27fc", + "url": "https://api.github.com/repos/facade/ignition/zipball/749fba7bf560fe2600ea55bf8734a7c9b8c30cfd", + "reference": "749fba7bf560fe2600ea55bf8734a7c9b8c30cfd", "shasum": "" }, "require": { @@ -1642,7 +1642,7 @@ "facade/flare-client-php": "^1.0", "facade/ignition-contracts": "^1.0", "filp/whoops": "^2.4", - "illuminate/support": "^7.0", + "illuminate/support": "^7.0|^8.0", "monolog/monolog": "^2.0", "php": "^7.2.5", "scrivo/highlight.php": "^9.15", @@ -1691,7 +1691,7 @@ "laravel", "page" ], - "time": "2020-03-18T19:20:44+00:00" + "time": "2020-05-18T15:20:13+00:00" }, { "name": "facade/ignition-contracts", @@ -2558,16 +2558,16 @@ }, { "name": "laravel/framework", - "version": "v7.11.0", + "version": "v7.12.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "f4563bd2e0875c59a1f7967abdbe5cef7f240117" + "reference": "c2fff1e9879494a6f853593b3c517dc9922bbb51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/f4563bd2e0875c59a1f7967abdbe5cef7f240117", - "reference": "f4563bd2e0875c59a1f7967abdbe5cef7f240117", + "url": "https://api.github.com/repos/laravel/framework/zipball/c2fff1e9879494a6f853593b3c517dc9922bbb51", + "reference": "c2fff1e9879494a6f853593b3c517dc9922bbb51", "shasum": "" }, "require": { @@ -2593,6 +2593,7 @@ "symfony/http-foundation": "^5.0", "symfony/http-kernel": "^5.0", "symfony/mime": "^5.0", + "symfony/polyfill-php73": "^1.17", "symfony/process": "^5.0", "symfony/routing": "^5.0", "symfony/var-dumper": "^5.0", @@ -2706,7 +2707,7 @@ "framework", "laravel" ], - "time": "2020-05-12T14:42:24+00:00" + "time": "2020-05-19T17:09:00+00:00" }, { "name": "laravel/helpers", @@ -2818,16 +2819,16 @@ }, { "name": "laravelcollective/html", - "version": "v6.1.0", + "version": "v6.1.2", "source": { "type": "git", "url": "https://github.com/LaravelCollective/html.git", - "reference": "64f2268bf41bf02b3a9dd3c30f102e934d721664" + "reference": "5ef9a3c9ae2423fe5618996f3cde375d461a3fc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/LaravelCollective/html/zipball/64f2268bf41bf02b3a9dd3c30f102e934d721664", - "reference": "64f2268bf41bf02b3a9dd3c30f102e934d721664", + "url": "https://api.github.com/repos/LaravelCollective/html/zipball/5ef9a3c9ae2423fe5618996f3cde375d461a3fc6", + "reference": "5ef9a3c9ae2423fe5618996f3cde375d461a3fc6", "shasum": "" }, "require": { @@ -2882,7 +2883,7 @@ ], "description": "HTML and Form Builders for the Laravel Framework", "homepage": "https://laravelcollective.com", - "time": "2020-03-02T16:41:28+00:00" + "time": "2020-05-19T18:02:16+00:00" }, { "name": "layershifter/tld-database", @@ -3200,16 +3201,16 @@ }, { "name": "league/flysystem", - "version": "1.0.68", + "version": "1.0.69", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "3e4198372276ec99ac3409a21d7c9d1ced9026e4" + "reference": "7106f78428a344bc4f643c233a94e48795f10967" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/3e4198372276ec99ac3409a21d7c9d1ced9026e4", - "reference": "3e4198372276ec99ac3409a21d7c9d1ced9026e4", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/7106f78428a344bc4f643c233a94e48795f10967", + "reference": "7106f78428a344bc4f643c233a94e48795f10967", "shasum": "" }, "require": { @@ -3286,7 +3287,7 @@ "type": "other" } ], - "time": "2020-05-12T20:33:44+00:00" + "time": "2020-05-18T15:13:39+00:00" }, { "name": "league/geotools", @@ -3488,20 +3489,20 @@ }, { "name": "monolog/monolog", - "version": "2.0.2", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "c861fcba2ca29404dc9e617eedd9eff4616986b8" + "reference": "38914429aac460e8e4616c8cb486ecb40ec90bb1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c861fcba2ca29404dc9e617eedd9eff4616986b8", - "reference": "c861fcba2ca29404dc9e617eedd9eff4616986b8", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/38914429aac460e8e4616c8cb486ecb40ec90bb1", + "reference": "38914429aac460e8e4616c8cb486ecb40ec90bb1", "shasum": "" }, "require": { - "php": "^7.2", + "php": ">=7.2", "psr/log": "^1.0.1" }, "provide": { @@ -3512,11 +3513,11 @@ "doctrine/couchdb": "~1.0@dev", "elasticsearch/elasticsearch": "^6.0", "graylog2/gelf-php": "^1.4.2", - "jakub-onderka/php-parallel-lint": "^0.9", "php-amqplib/php-amqplib": "~2.4", "php-console/php-console": "^3.1.3", + "php-parallel-lint/php-parallel-lint": "^1.0", "phpspec/prophecy": "^1.6.1", - "phpunit/phpunit": "^8.3", + "phpunit/phpunit": "^8.5", "predis/predis": "^1.1", "rollbar/rollbar": "^1.3", "ruflin/elastica": ">=0.90 <3.0", @@ -3565,7 +3566,17 @@ "logging", "psr-3" ], - "time": "2019-12-20T14:22:59+00:00" + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], + "time": "2020-05-22T08:12:19+00:00" }, { "name": "myclabs/deep-copy", @@ -3654,16 +3665,16 @@ }, { "name": "nesbot/carbon", - "version": "2.34.0", + "version": "2.34.2", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "52ea68aebbad8a3b27b5d24e4c66ebe1933f8399" + "reference": "3e87404329b8072295ea11d548b47a1eefe5a162" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/52ea68aebbad8a3b27b5d24e4c66ebe1933f8399", - "reference": "52ea68aebbad8a3b27b5d24e4c66ebe1933f8399", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/3e87404329b8072295ea11d548b47a1eefe5a162", + "reference": "3e87404329b8072295ea11d548b47a1eefe5a162", "shasum": "" }, "require": { @@ -3733,7 +3744,7 @@ "type": "tidelift" } ], - "time": "2020-05-12T19:53:34+00:00" + "time": "2020-05-19T22:14:16+00:00" }, { "name": "nikic/php-parser", @@ -3908,16 +3919,16 @@ }, { "name": "opis/closure", - "version": "3.5.1", + "version": "3.5.2", "source": { "type": "git", "url": "https://github.com/opis/closure.git", - "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969" + "reference": "2e3299cea6f485ca64d19c540f46d7896c512ace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opis/closure/zipball/93ebc5712cdad8d5f489b500c59d122df2e53969", - "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969", + "url": "https://api.github.com/repos/opis/closure/zipball/2e3299cea6f485ca64d19c540f46d7896c512ace", + "reference": "2e3299cea6f485ca64d19c540f46d7896c512ace", "shasum": "" }, "require": { @@ -3965,7 +3976,7 @@ "serialization", "serialize" ], - "time": "2019-11-29T22:36:02+00:00" + "time": "2020-05-21T20:09:36+00:00" }, { "name": "php-http/discovery", @@ -4236,16 +4247,16 @@ }, { "name": "pragmarx/yaml", - "version": "v1.0.0", + "version": "v1.2.1", "source": { "type": "git", "url": "https://github.com/antonioribeiro/yaml.git", - "reference": "73c7152dc9e2415faaa2ecd3e56279c1c26612c2" + "reference": "9f2b44c4a31f8a71bab77169205aee7184ae3ef4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/antonioribeiro/yaml/zipball/73c7152dc9e2415faaa2ecd3e56279c1c26612c2", - "reference": "73c7152dc9e2415faaa2ecd3e56279c1c26612c2", + "url": "https://api.github.com/repos/antonioribeiro/yaml/zipball/9f2b44c4a31f8a71bab77169205aee7184ae3ef4", + "reference": "9f2b44c4a31f8a71bab77169205aee7184ae3ef4", "shasum": "" }, "require": { @@ -4257,6 +4268,9 @@ "orchestra/testbench": "3.5|^3.6|^4.0|^5.0", "phpunit/phpunit": "^4.0|^6.4|^7.0|^8.0|^9.0" }, + "suggest": { + "ext-yaml": "Required to use the PECL YAML." + }, "type": "library", "extra": { "component": "package", @@ -4292,20 +4306,20 @@ "laravel", "yaml" ], - "time": "2020-04-22T18:06:36+00:00" + "time": "2020-05-21T19:46:28+00:00" }, { "name": "prettus/l5-repository", - "version": "2.6.44", + "version": "2.6.45", "source": { "type": "git", "url": "https://github.com/andersao/l5-repository.git", - "reference": "8c8db9895745dc35eb471a8f048ff9c000a3ccdd" + "reference": "c4d9d5834445e13d9ea0f00bfa23c67a0202aab1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/andersao/l5-repository/zipball/8c8db9895745dc35eb471a8f048ff9c000a3ccdd", - "reference": "8c8db9895745dc35eb471a8f048ff9c000a3ccdd", + "url": "https://api.github.com/repos/andersao/l5-repository/zipball/c4d9d5834445e13d9ea0f00bfa23c67a0202aab1", + "reference": "c4d9d5834445e13d9ea0f00bfa23c67a0202aab1", "shasum": "" }, "require": { @@ -4358,7 +4372,7 @@ "model", "repository" ], - "time": "2020-05-15T08:22:53+00:00" + "time": "2020-05-22T06:32:04+00:00" }, { "name": "prettus/laravel-validation", @@ -9057,40 +9071,41 @@ }, { "name": "phpunit/php-code-coverage", - "version": "7.0.10", + "version": "8.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf" + "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f1884187926fbb755a9aaf0b3836ad3165b478bf", - "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca6647ffddd2add025ab3f21644a441d7c146cdc", + "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.2", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.1.1", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^4.2.2", - "sebastian/version": "^2.0.1", + "php": "^7.3", + "phpunit/php-file-iterator": "^3.0", + "phpunit/php-text-template": "^2.0", + "phpunit/php-token-stream": "^4.0", + "sebastian/code-unit-reverse-lookup": "^2.0", + "sebastian/environment": "^5.0", + "sebastian/version": "^3.0", "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "phpunit/phpunit": "^8.2.2" + "phpunit/phpunit": "^9.0" }, "suggest": { - "ext-xdebug": "^2.7.2" + "ext-pcov": "*", + "ext-xdebug": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "7.0-dev" + "dev-master": "8.0-dev" } }, "autoload": { @@ -9116,32 +9131,38 @@ "testing", "xunit" ], - "time": "2019-11-20T13:55:58+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-05-23T08:02:54+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.2", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" + "reference": "4ac5b3e13df14829daa60a2eb4fdd2f2b7d33cf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/4ac5b3e13df14829daa60a2eb4fdd2f2b7d33cf4", + "reference": "4ac5b3e13df14829daa60a2eb4fdd2f2b7d33cf4", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -9166,26 +9187,90 @@ "filesystem", "iterator" ], - "time": "2018-09-13T20:33:42+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-04-18T05:02:12+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "phpunit/php-invoker", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "7579d5a1ba7f3ac11c80004d205877911315ae7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/7579d5a1ba7f3ac11c80004d205877911315ae7a", + "reference": "7579d5a1ba7f3ac11c80004d205877911315ae7a", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-pcntl": "*" }, "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", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "time": "2020-02-07T06:06:11+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "526dc996cc0ebdfa428cd2dfccd79b7b53fee346" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/526dc996cc0ebdfa428cd2dfccd79b7b53fee346", + "reference": "526dc996cc0ebdfa428cd2dfccd79b7b53fee346", + "shasum": "" + }, + "require": { + "php": "^7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -9207,32 +9292,32 @@ "keywords": [ "template" ], - "time": "2015-06-21T13:50:34+00:00" + "time": "2020-02-01T07:43:44+00:00" }, { "name": "phpunit/php-timer", - "version": "2.1.2", + "version": "3.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + "reference": "dc9368fae6ef2ffa57eba80a7410bcef81df6258" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/dc9368fae6ef2ffa57eba80a7410bcef81df6258", + "reference": "dc9368fae6ef2ffa57eba80a7410bcef81df6258", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -9256,33 +9341,39 @@ "keywords": [ "timer" ], - "time": "2019-06-07T04:22:29+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-04-20T06:00:37+00:00" }, { "name": "phpunit/php-token-stream", - "version": "3.1.1", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" + "reference": "cdc0db5aed8fbfaf475fbd95bfd7bab83c7a779c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/cdc0db5aed8fbfaf475fbd95bfd7bab83c7a779c", + "reference": "cdc0db5aed8fbfaf475fbd95bfd7bab83c7a779c", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.1" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -9305,20 +9396,26 @@ "keywords": [ "tokenizer" ], - "time": "2019-09-17T06:23:10+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-05-06T09:56:31+00:00" }, { "name": "phpunit/phpunit", - "version": "8.5.4", + "version": "9.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "8474e22d7d642f665084ba5ec780626cbd1efd23" + "reference": "1b570cd7edbe136055bf5f651857dc8af6b829d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8474e22d7d642f665084ba5ec780626cbd1efd23", - "reference": "8474e22d7d642f665084ba5ec780626cbd1efd23", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1b570cd7edbe136055bf5f651857dc8af6b829d2", + "reference": "1b570cd7edbe136055bf5f651857dc8af6b829d2", "shasum": "" }, "require": { @@ -9332,29 +9429,31 @@ "myclabs/deep-copy": "^1.9.1", "phar-io/manifest": "^1.0.3", "phar-io/version": "^2.0.1", - "php": "^7.2", + "php": "^7.3", "phpspec/prophecy": "^1.8.1", - "phpunit/php-code-coverage": "^7.0.7", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1.2", - "sebastian/comparator": "^3.0.2", - "sebastian/diff": "^3.0.2", - "sebastian/environment": "^4.2.2", - "sebastian/exporter": "^3.1.1", - "sebastian/global-state": "^3.0.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0.1", - "sebastian/type": "^1.1.3", - "sebastian/version": "^2.0.1" + "phpunit/php-code-coverage": "^8.0.1", + "phpunit/php-file-iterator": "^3.0", + "phpunit/php-invoker": "^3.0", + "phpunit/php-text-template": "^2.0", + "phpunit/php-timer": "^3.1.4", + "sebastian/code-unit": "^1.0.2", + "sebastian/comparator": "^4.0", + "sebastian/diff": "^4.0", + "sebastian/environment": "^5.0.1", + "sebastian/exporter": "^4.0", + "sebastian/global-state": "^4.0", + "sebastian/object-enumerator": "^4.0", + "sebastian/resource-operations": "^3.0", + "sebastian/type": "^2.0", + "sebastian/version": "^3.0" }, "require-dev": { - "ext-pdo": "*" + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0" }, "suggest": { "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0.0" + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -9362,12 +9461,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "8.5-dev" + "dev-master": "9.1-dev" } }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -9398,32 +9500,84 @@ "type": "github" } ], - "time": "2020-04-23T04:39:42+00:00" + "time": "2020-05-22T13:54:05+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "name": "sebastian/code-unit", + "version": "1.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "ac958085bc19fcd1d36425c781ef4cbb5b06e2a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/ac958085bc19fcd1d36425c781ef4cbb5b06e2a5", + "reference": "ac958085bc19fcd1d36425c781ef4cbb5b06e2a5", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-04-30T05:58:10+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "5b5dbe0044085ac41df47e79d34911a15b96d82e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5b5dbe0044085ac41df47e79d34911a15b96d82e", + "reference": "5b5dbe0044085ac41df47e79d34911a15b96d82e", + "shasum": "" + }, + "require": { + "php": "^7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" } }, "autoload": { @@ -9443,34 +9597,34 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "time": "2020-02-07T06:20:13+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.2", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + "reference": "85b3435da967696ed618ff745f32be3ff4a2b8e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/85b3435da967696ed618ff745f32be3ff4a2b8e8", + "reference": "85b3435da967696ed618ff745f32be3ff4a2b8e8", "shasum": "" }, "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" + "php": "^7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -9483,6 +9637,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -9494,10 +9652,6 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -9507,33 +9661,33 @@ "compare", "equality" ], - "time": "2018-07-12T15:12:46+00:00" + "time": "2020-02-07T06:08:51+00:00" }, { "name": "sebastian/diff", - "version": "3.0.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + "reference": "3e523c576f29dacecff309f35e4cc5a5c168e78a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3e523c576f29dacecff309f35e4cc5a5c168e78a", + "reference": "3e523c576f29dacecff309f35e4cc5a5c168e78a", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" + "phpunit/phpunit": "^9.0", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -9546,13 +9700,13 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", @@ -9563,27 +9717,33 @@ "unidiff", "unified diff" ], - "time": "2019-02-04T06:01:07+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-05-08T05:01:12+00:00" }, { "name": "sebastian/environment", - "version": "4.2.3", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + "reference": "c753f04d68cd489b6973cf9b4e505e191af3b05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/c753f04d68cd489b6973cf9b4e505e191af3b05c", + "reference": "c753f04d68cd489b6973cf9b4e505e191af3b05c", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5" + "phpunit/phpunit": "^9.0" }, "suggest": { "ext-posix": "*" @@ -9591,7 +9751,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -9616,34 +9776,40 @@ "environment", "hhvm" ], - "time": "2019-11-20T08:46:58+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-04-14T13:36:52+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.2", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + "reference": "80c26562e964016538f832f305b2286e1ec29566" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/80c26562e964016538f832f305b2286e1ec29566", + "reference": "80c26562e964016538f832f305b2286e1ec29566", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" + "php": "^7.3", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -9683,30 +9849,30 @@ "export", "exporter" ], - "time": "2019-09-14T09:02:43+00:00" + "time": "2020-02-07T06:10:52+00:00" }, { "name": "sebastian/global-state", - "version": "3.0.0", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" + "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bdb1e7c79e592b8c82cb1699be3c8743119b8a72", + "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72", "shasum": "" }, "require": { - "php": "^7.2", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": "^7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^9.0" }, "suggest": { "ext-uopz": "*" @@ -9714,7 +9880,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -9737,34 +9903,34 @@ "keywords": [ "global state" ], - "time": "2019-02-01T05:30:01+00:00" + "time": "2020-02-07T06:11:37+00:00" }, { "name": "sebastian/object-enumerator", - "version": "3.0.3", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + "reference": "e67516b175550abad905dc952f43285957ef4363" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67516b175550abad905dc952f43285957ef4363", + "reference": "e67516b175550abad905dc952f43285957ef4363", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": "^7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -9784,122 +9950,27 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" + "time": "2020-02-07T06:12:23+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "reference": "f4fd0835cabb0d4a6546d9fe291e5740037aa1e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/f4fd0835cabb0d4a6546d9fe291e5740037aa1e7", + "reference": "f4fd0835cabb0d4a6546d9fe291e5740037aa1e7", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "shasum": "" - }, - "require": { - "php": "^7.1" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { @@ -9922,34 +9993,132 @@ "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", - "time": "2018-10-04T04:07:39+00:00" + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2020-02-07T06:19:40+00:00" }, { - "name": "sebastian/type", - "version": "1.1.3", + "name": "sebastian/recursion-context", + "version": "4.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3" + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "cdd86616411fc3062368b720b0425de10bd3d579" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3", - "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cdd86616411fc3062368b720b0425de10bd3d579", + "reference": "cdd86616411fc3062368b720b0425de10bd3d579", "shasum": "" }, "require": { - "php": "^7.2" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^8.2" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2020-02-07T06:18:20+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "8c98bf0dfa1f9256d0468b9803a1e1df31b6fa98" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/8c98bf0dfa1f9256d0468b9803a1e1df31b6fa98", + "reference": "8c98bf0dfa1f9256d0468b9803a1e1df31b6fa98", + "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", + "time": "2020-02-07T06:13:02+00:00" + }, + { + "name": "sebastian/type", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "9e8f42f740afdea51f5f4e8cec2035580e797ee1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/9e8f42f740afdea51f5f4e8cec2035580e797ee1", + "reference": "9e8f42f740afdea51f5f4e8cec2035580e797ee1", + "shasum": "" + }, + "require": { + "php": "^7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" } }, "autoload": { @@ -9970,29 +10139,29 @@ ], "description": "Collection of value objects that represent the types of the PHP type system", "homepage": "https://github.com/sebastianbergmann/type", - "time": "2019-07-02T08:10:15+00:00" + "time": "2020-02-07T06:13:43+00:00" }, { "name": "sebastian/version", - "version": "2.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "reference": "0411bde656dce64202b39c2f4473993a9081d39e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/0411bde656dce64202b39c2f4473993a9081d39e", + "reference": "0411bde656dce64202b39c2f4473993a9081d39e", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^7.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -10013,25 +10182,25 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "time": "2020-01-21T06:36:37+00:00" }, { "name": "sempro/phpunit-pretty-print", - "version": "1.2.2", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sempro/phpunit-pretty-print.git", - "reference": "6f0e99d06677dc3e518198e44263f4ddeed84a28" + "reference": "9a9e14c95a5a6527c25c71aa55c8295882c6fcb1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sempro/phpunit-pretty-print/zipball/6f0e99d06677dc3e518198e44263f4ddeed84a28", - "reference": "6f0e99d06677dc3e518198e44263f4ddeed84a28", + "url": "https://api.github.com/repos/sempro/phpunit-pretty-print/zipball/9a9e14c95a5a6527c25c71aa55c8295882c6fcb1", + "reference": "9a9e14c95a5a6527c25c71aa55c8295882c6fcb1", "shasum": "" }, "require": { "php": ">=7.1.0", - "phpunit/phpunit": ">=7.0.0 <9.0.0" + "phpunit/phpunit": ">=7.0.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.15" @@ -10047,7 +10216,7 @@ "MIT" ], "description": "Prettify PHPUnit output", - "time": "2020-04-08T06:32:58+00:00" + "time": "2019-11-21T19:36:58+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -10428,7 +10597,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=7.2", + "php": ">=7.3", "ext-json": "*", "ext-mbstring": "*", "ext-simplexml": "*", diff --git a/phpunit.xml b/phpunit.xml index 5dcf01a2..b7b5913c 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -7,8 +7,7 @@ convertNoticesToExceptions="false" convertWarningsToExceptions="false" beStrictAboutOutputDuringTests="false" - beStrictAboutTestsThatDoNotTestAnything="false" - printerClass="Sempro\PHPUnitPrettyPrinter\PrettyPrinter"> + beStrictAboutTestsThatDoNotTestAnything="false"> ./tests @@ -34,11 +33,14 @@ - + - - + + + + + diff --git a/tests/AcarsTest.php b/tests/AcarsTest.php index 8dee7278..bf18058e 100644 --- a/tests/AcarsTest.php +++ b/tests/AcarsTest.php @@ -1,11 +1,24 @@ assertCount(\count($route), $points); + $this->assertCount(count($route), $points); foreach ($route as $idx => $point) { $this->assertHasKeys($points[$idx], $fields); foreach ($fields as $f) { @@ -69,11 +82,11 @@ class AcarsTest extends TestCase */ public function testPrefileErrors() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); - $airport = factory(App\Models\Airport::class)->create(); - $airline = factory(App\Models\Airline::class)->create(); - $aircraft = factory(App\Models\Aircraft::class)->create(); + $airport = factory(Airport::class)->create(); + $airline = factory(Airline::class)->create(); + $aircraft = factory(Aircraft::class)->create(); /** * INVALID AIRLINE_ID FIELD @@ -96,10 +109,10 @@ class AcarsTest extends TestCase public function testBlankAirport() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); - $airline = factory(App\Models\Airline::class)->create(); - $aircraft = factory(App\Models\Aircraft::class)->create(); + $airline = factory(Airline::class)->create(); + $aircraft = factory(Aircraft::class)->create(); /** * INVALID AIRLINE_ID FIELD @@ -134,13 +147,13 @@ class AcarsTest extends TestCase $this->settingsRepo->store('pilots.only_flights_from_current', true); $this->settingsRepo->store('pireps.restrict_aircraft_to_rank', false); - $this->user = factory(App\Models\User::class)->create([ + $this->user = factory(User::class)->create([ 'curr_airport_id' => 'KJFK', ]); - $airport = factory(App\Models\Airport::class)->create(); - $airline = factory(App\Models\Airline::class)->create(); - $aircraft = factory(App\Models\Aircraft::class)->create(); + $airport = factory(Airport::class)->create(); + $airline = factory(Airline::class)->create(); + $aircraft = factory(Aircraft::class)->create(); /** * INVALID AIRLINE_ID FIELD @@ -161,7 +174,7 @@ class AcarsTest extends TestCase $response = $this->post($uri, $pirep); $response->assertStatus(400); $body = $response->json(); - $this->assertEquals(\App\Exceptions\UserNotAtAirport::MESSAGE, $body['error']['message']); + $this->assertEquals(UserNotAtAirport::MESSAGE, $body['error']['message']); } /** @@ -173,13 +186,13 @@ class AcarsTest extends TestCase $this->settingsRepo->store('pireps.restrict_aircraft_to_rank', false); $this->settingsRepo->store('pireps.restrict_aircraft_to_rank', false); - $this->user = factory(App\Models\User::class)->create([ + $this->user = factory(User::class)->create([ 'curr_airport_id' => 'KJFK', ]); - $airport = factory(App\Models\Airport::class)->create(); - $airline = factory(App\Models\Airline::class)->create(); - $aircraft = factory(App\Models\Aircraft::class)->create([ + $airport = factory(Airport::class)->create(); + $airline = factory(Airline::class)->create(); + $aircraft = factory(Aircraft::class)->create([ 'airport_id' => 'KAUS', ]); @@ -202,7 +215,7 @@ class AcarsTest extends TestCase $response = $this->post($uri, $pirep); $response->assertStatus(400); $body = $response->json(); - $this->assertEquals(\App\Exceptions\AircraftNotAtAirport::MESSAGE, $body['error']['message']); + $this->assertEquals(AircraftNotAtAirport::MESSAGE, $body['error']['message']); } /** @@ -212,16 +225,16 @@ class AcarsTest extends TestCase { $subfleet = $this->createSubfleetWithAircraft(2); $rank = $this->createRank(10, [$subfleet['subfleet']->id]); - $fare = factory(App\Models\Fare::class)->create(); + $fare = factory(Fare::class)->create(); - $this->user = factory(App\Models\User::class)->create( + $this->user = factory(User::class)->create( [ 'rank_id' => $rank->id, ] ); - $airport = factory(App\Models\Airport::class)->create(); - $airline = factory(App\Models\Airline::class)->create(); + $airport = factory(Airport::class)->create(); + $airline = factory(Airline::class)->create(); $aircraft = $subfleet['aircraft']->random(); $uri = '/api/pireps/prefile'; @@ -312,12 +325,12 @@ class AcarsTest extends TestCase $subfleet = $this->createSubfleetWithAircraft(2); $rank = $this->createRank(10, [$subfleet['subfleet']->id]); - $this->user = factory(App\Models\User::class)->create([ + $this->user = factory(User::class)->create([ 'rank_id' => $rank->id, ]); - $airport = factory(App\Models\Airport::class)->create(); - $airline = factory(App\Models\Airline::class)->create(); + $airport = factory(Airport::class)->create(); + $airline = factory(Airline::class)->create(); $aircraft = $subfleet['aircraft']->random(); $uri = '/api/pireps/prefile'; @@ -361,14 +374,14 @@ class AcarsTest extends TestCase $subfleet = $this->createSubfleetWithAircraft(2); $rank = $this->createRank(10, [$subfleet['subfleet']->id]); - $this->user = factory(App\Models\User::class)->create( + $this->user = factory(User::class)->create( [ 'rank_id' => $rank->id, ] ); - $airport = factory(App\Models\Airport::class)->create(); - $airline = factory(App\Models\Airline::class)->create(); + $airport = factory(Airport::class)->create(); + $airline = factory(Airline::class)->create(); $aircraft = $subfleet['aircraft']->random(); $uri = '/api/pireps/prefile'; @@ -438,7 +451,7 @@ class AcarsTest extends TestCase $response->assertStatus(400); // Post an ACARS update - $acars = factory(App\Models\Acars::class)->make(['pirep_id' => $pirep_id])->toArray(); + $acars = factory(Acars::class)->make(['pirep_id' => $pirep_id])->toArray(); $acars = $this->transformData($acars); @@ -531,12 +544,12 @@ class AcarsTest extends TestCase $subfleet = $this->createSubfleetWithAircraft(2); $rank = $this->createRank(10, [$subfleet['subfleet']->id]); - $this->user = factory(App\Models\User::class)->create([ + $this->user = factory(User::class)->create([ 'rank_id' => $rank->id, ]); - $airport = factory(App\Models\Airport::class)->create(); - $airline = factory(App\Models\Airline::class)->create(); + $airport = factory(Airport::class)->create(); + $airline = factory(Airline::class)->create(); $aircraft = $subfleet['aircraft']->random(); $uri = '/api/pireps/prefile'; @@ -581,8 +594,8 @@ class AcarsTest extends TestCase { $this->settingsRepo->store('pireps.restrict_aircraft_to_rank', true); - $airport = factory(App\Models\Airport::class)->create(); - $airline = factory(App\Models\Airline::class)->create(); + $airport = factory(Airport::class)->create(); + $airline = factory(Airline::class)->create(); // Add subfleets and aircraft, but also add another set of subfleets $subfleetA = $this->createSubfleetWithAircraft(1); @@ -592,7 +605,7 @@ class AcarsTest extends TestCase $rank = $this->createRank(10, [$subfleetA['subfleet']->id]); - $this->user = factory(App\Models\User::class)->create( + $this->user = factory(User::class)->create( [ 'rank_id' => $rank->id, ] @@ -627,8 +640,8 @@ class AcarsTest extends TestCase { $this->settingsRepo->store('pireps.restrict_aircraft_to_rank', false); - $airport = factory(App\Models\Airport::class)->create(); - $airline = factory(App\Models\Airline::class)->create(); + $airport = factory(Airport::class)->create(); + $airline = factory(Airline::class)->create(); // Add subfleets and aircraft, but also add another set of subfleets $subfleetA = $this->createSubfleetWithAircraft(1); @@ -638,7 +651,7 @@ class AcarsTest extends TestCase $rank = $this->createRank(10, [$subfleetA['subfleet']->id]); - $this->user = factory(App\Models\User::class)->create( + $this->user = factory(User::class)->create( [ 'rank_id' => $rank->id, ] @@ -679,8 +692,8 @@ class AcarsTest extends TestCase $uri = '/api/pireps/'.$pirep_id.'/acars/position'; // Post an ACARS update - $acars_count = \random_int(5, 10); - $acars = factory(App\Models\Acars::class, $acars_count)->make(['id' => '']) + $acars_count = random_int(5, 10); + $acars = factory(Acars::class, $acars_count)->make(['id' => '']) ->map(function ($point) { $point['id'] = Utils::generateNewId(); return $point; @@ -701,7 +714,7 @@ class AcarsTest extends TestCase public function testNonExistentPirepGet() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); $uri = '/api/pireps/DOESNTEXIST/acars'; $response = $this->get($uri); @@ -710,10 +723,10 @@ class AcarsTest extends TestCase public function testNonExistentPirepStore() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); $uri = '/api/pireps/DOESNTEXIST/acars/position'; - $acars = factory(App\Models\Acars::class)->make()->toArray(); + $acars = factory(Acars::class)->make()->toArray(); $response = $this->post($uri, $acars); $response->assertStatus(404); } @@ -728,7 +741,7 @@ class AcarsTest extends TestCase $dt = date('c'); $uri = '/api/pireps/'.$pirep_id.'/acars/position'; - $acars = factory(App\Models\Acars::class)->make([ + $acars = factory(Acars::class)->make([ 'sim_time' => $dt, ])->toArray(); @@ -777,7 +790,7 @@ class AcarsTest extends TestCase $response = $this->post($uri, $pirep); $pirep_id = $response->json()['data']['id']; - $acars = factory(App\Models\Acars::class)->make(); + $acars = factory(Acars::class)->make(); $post_log = [ 'logs' => [ ['log' => $acars->log], @@ -791,7 +804,7 @@ class AcarsTest extends TestCase $this->assertEquals(1, $body['count']); - $acars = factory(App\Models\Acars::class)->make(); + $acars = factory(Acars::class)->make(); $post_log = [ 'events' => [ ['event' => $acars->log], @@ -816,9 +829,9 @@ class AcarsTest extends TestCase $order = 1; $post_route = []; - $route_count = \random_int(2, 10); + $route_count = random_int(2, 10); - $route = factory(App\Models\Navdata::class, $route_count)->create(); + $route = factory(Navdata::class, $route_count)->create(); foreach ($route as $position) { $post_route[] = [ 'order' => $order, diff --git a/tests/AirlineTest.php b/tests/AirlineTest.php index 50977a64..29739d3c 100644 --- a/tests/AirlineTest.php +++ b/tests/AirlineTest.php @@ -1,5 +1,7 @@ make([ + $attrs = factory(\App\Models\Airline::class)->make([ 'iata' => '', ])->toArray(); @@ -25,7 +27,7 @@ class AirlineTest extends TestCase $this->assertNotNull($airline); // Add another airline, also blank IATA - $attrs = factory(App\Models\Airline::class)->make([ + $attrs = factory(\App\Models\Airline::class)->make([ 'iata' => '', ])->toArray(); $airline = $this->airlineSvc->createAirline($attrs); @@ -37,8 +39,8 @@ class AirlineTest extends TestCase */ public function testDeleteAirlineWithFlight() { - $airline = factory(App\Models\Airline::class)->create(); - factory(App\Models\Flight::class)->create([ + $airline = factory(\App\Models\Airline::class)->create(); + factory(\App\Models\Flight::class)->create([ 'airline_id' => $airline->id, ]); @@ -50,8 +52,8 @@ class AirlineTest extends TestCase */ public function testDeleteAirlineWithPirep() { - $airline = factory(App\Models\Airline::class)->create(); - factory(App\Models\Pirep::class)->create([ + $airline = factory(\App\Models\Airline::class)->create(); + factory(\App\Models\Pirep::class)->create([ 'airline_id' => $airline->id, ]); diff --git a/tests/ApiTest.php b/tests/ApiTest.php index 16aa3253..ef8f9030 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -1,8 +1,19 @@ create(); + factory(News::class)->create(); $response = $this->get('/api/news')->json(); $this->assertCount(1, $response['data']); - $this->assertTrue(array_key_exists('user', $response['data'][0])); + $this->assertArrayHasKey('user', $response['data'][0]); } /** @@ -76,12 +87,12 @@ class ApiTest extends TestCase */ public function testGetAirlines() { - $size = \random_int(5, 10); - $this->user = factory(App\Models\User::class)->create([ + $size = random_int(5, 10); + $this->user = factory(User::class)->create([ 'airline_id' => 0, ]); - $airlines = factory(App\Models\Airline::class, $size)->create(); + $airlines = factory(Airline::class, $size)->create(); $res = $this->get('/api/airlines'); $this->assertTrue($res->isOk()); @@ -96,12 +107,12 @@ class ApiTest extends TestCase */ public function testPagination() { - $size = \random_int(5, 10); - $this->user = factory(App\Models\User::class)->create([ + $size = random_int(5, 10); + $this->user = factory(User::class)->create([ 'airline_id' => 0, ]); - factory(App\Models\Airline::class, $size)->create(); + factory(Airline::class, $size)->create(); /* * Page 0 and page 1 should return the same thing @@ -142,8 +153,8 @@ class ApiTest extends TestCase */ public function testAirportRequest() { - $this->user = factory(App\Models\User::class)->create(); - $airport = factory(App\Models\Airport::class)->create(); + $this->user = factory(User::class)->create(); + $airport = factory(Airport::class)->create(); $response = $this->get('/api/airports/'.$airport->icao); @@ -158,8 +169,8 @@ class ApiTest extends TestCase */ public function testGetAllAirports() { - $this->user = factory(App\Models\User::class)->create(); - factory(App\Models\Airport::class, 70)->create(); + $this->user = factory(User::class)->create(); + factory(Airport::class, 70)->create(); $response = $this->get('/api/airports/') ->assertStatus(200); @@ -170,9 +181,9 @@ class ApiTest extends TestCase public function testGetAllAirportsHubs() { - $this->user = factory(App\Models\User::class)->create(); - factory(App\Models\Airport::class, 10)->create(); - factory(App\Models\Airport::class)->create(['hub' => 1]); + $this->user = factory(User::class)->create(); + factory(Airport::class, 10)->create(); + factory(Airport::class)->create(['hub' => 1]); $this->get('/api/airports/hubs') ->assertStatus(200) @@ -186,23 +197,23 @@ class ApiTest extends TestCase */ public function testGetSubfleets() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); - $subfleetA = factory(App\Models\Subfleet::class)->create([ + $subfleetA = factory(Subfleet::class)->create([ 'airline_id' => $this->user->airline_id, ]); - $subfleetB = factory(App\Models\Subfleet::class)->create([ + $subfleetB = factory(Subfleet::class)->create([ 'airline_id' => $this->user->airline_id, ]); - $subfleetA_size = \random_int(2, 10); - $subfleetB_size = \random_int(2, 10); - factory(App\Models\Aircraft::class, $subfleetA_size)->create([ + $subfleetA_size = random_int(2, 10); + $subfleetB_size = random_int(2, 10); + factory(Aircraft::class, $subfleetA_size)->create([ 'subfleet_id' => $subfleetA->id, ]); - factory(App\Models\Aircraft::class, $subfleetB_size)->create([ + factory(Aircraft::class, $subfleetB_size)->create([ 'subfleet_id' => $subfleetB->id, ]); @@ -226,18 +237,18 @@ class ApiTest extends TestCase */ public function testGetAircraft() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); $fare_svc = app(FareService::class); - $subfleet = factory(App\Models\Subfleet::class)->create([ + $subfleet = factory(Subfleet::class)->create([ 'airline_id' => $this->user->airline_id, ]); - $fare = factory(App\Models\Fare::class)->create(); + $fare = factory(Fare::class)->create(); $fare_svc->setForSubfleet($subfleet, $fare); - $aircraft = factory(App\Models\Aircraft::class)->create([ + $aircraft = factory(Aircraft::class)->create([ 'subfleet_id' => $subfleet->id, ]); @@ -259,14 +270,14 @@ class ApiTest extends TestCase public function testGetAllSettings() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); $res = $this->get('/api/settings')->assertStatus(200); $settings = $res->json(); } public function testGetUser() { - $this->user = factory(App\Models\User::class)->create([ + $this->user = factory(User::class)->create([ 'avatar' => '/assets/avatar.jpg', ]); @@ -277,7 +288,7 @@ class ApiTest extends TestCase // Should go to gravatar - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); $res = $this->get('/api/user')->assertStatus(200); $user = $res->json('data'); diff --git a/tests/AwardsTest.php b/tests/AwardsTest.php index 2efbd8ff..f6356dd1 100644 --- a/tests/AwardsTest.php +++ b/tests/AwardsTest.php @@ -1,8 +1,14 @@ create([ - 'ref_model' => Modules\Awards\Awards\PilotFlightAwards::class, + $award = factory(Award::class)->create([ + 'ref_model' => PilotFlightAwards::class, 'ref_model_params' => 1, ]); - $user = factory(App\Models\User::class)->create([ + $user = factory(User::class)->create([ 'flights' => 0, ]); - $pirep = factory(App\Models\Pirep::class)->create([ + $pirep = factory(Pirep::class)->create([ 'airline_id' => $user->airline->id, 'user_id' => $user->id, ]); diff --git a/tests/BidTest.php b/tests/BidTest.php index bc07ea3f..15a6512e 100644 --- a/tests/BidTest.php +++ b/tests/BidTest.php @@ -1,8 +1,11 @@ create([ + $flight = factory(Flight::class)->create([ 'airline_id' => $user->airline_id, ]); $flight->subfleets()->syncWithoutDetaching([ - factory(App\Models\Subfleet::class)->create([ + factory(Subfleet::class)->create([ 'airline_id' => $user->airline_id, ])->id, ]); diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index a47bd567..51f79bbb 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -27,6 +27,7 @@ class Bootstrap implements BeforeFirstTestHook, AfterLastTestHook 'config:cache', 'event:cache', ]; + foreach ($commands as $command) { $console->call($command); } diff --git a/tests/FinanceTest.php b/tests/FinanceTest.php index e6abeaba..9731f7a2 100644 --- a/tests/FinanceTest.php +++ b/tests/FinanceTest.php @@ -1,9 +1,19 @@ fleetSvc->addSubfleetToRank($subfleet['subfleet'], $rank); - $dpt_apt = factory(App\Models\Airport::class)->create([ + $dpt_apt = factory(Airport::class)->create([ 'ground_handling_cost' => 10, 'fuel_jeta_cost' => 10, ]); - $arr_apt = factory(App\Models\Airport::class)->create([ + $arr_apt = factory(Airport::class)->create([ 'ground_handling_cost' => 10, 'fuel_jeta_cost' => 10, ]); - $user = factory(App\Models\User::class)->create([ + /** @var \App\Models\User $user */ + $user = factory(User::class)->create([ 'rank_id' => $rank->id, ]); - $flight = factory(App\Models\Flight::class)->create([ + /** @var \App\Models\Flight $flight */ + $flight = factory(Flight::class)->create([ 'airline_id' => $user->airline_id, 'dpt_airport_id' => $dpt_apt->icao, 'arr_airport_id' => $arr_apt->icao, ]); - $pirep = factory(App\Models\Pirep::class)->create([ + $pirep = factory(Pirep::class)->create([ 'flight_number' => $flight->flight_number, 'flight_type' => FlightType::SCHED_PAX, 'route_code' => $flight->route_code, @@ -101,7 +114,7 @@ class FinanceTest extends TestCase * Add fares to the subfleet, and then add the fares * to the PIREP when it's saved, and set the capacity */ - $fares = factory(App\Models\Fare::class, 3)->create([ + $fares = factory(Fare::class, 3)->create([ 'price' => 100, 'cost' => 50, 'capacity' => 10, @@ -112,13 +125,13 @@ class FinanceTest extends TestCase } // Add an expense - factory(App\Models\Expense::class)->create([ + factory(Expense::class)->create([ 'airline_id' => null, 'amount' => 100, ]); // Add a subfleet expense - factory(App\Models\Expense::class)->create([ + factory(Expense::class)->create([ 'ref_model' => Subfleet::class, 'ref_model_id' => $subfleet['subfleet']->id, 'amount' => 200, @@ -131,8 +144,8 @@ class FinanceTest extends TestCase public function testFlightFaresNoOverride() { - $flight = factory(App\Models\Flight::class)->create(); - $fare = factory(App\Models\Fare::class)->create(); + $flight = factory(Flight::class)->create(); + $fare = factory(Fare::class)->create(); $this->fareSvc->setForFlight($flight, $fare); $subfleet_fares = $this->fareSvc->getForFlight($flight); @@ -165,8 +178,8 @@ class FinanceTest extends TestCase */ public function testFlightFareOverrideAsPercent() { - $flight = factory(App\Models\Flight::class)->create(); - $fare = factory(App\Models\Fare::class)->create(); + $flight = factory(Flight::class)->create(); + $fare = factory(Fare::class)->create(); $percent_incr = '20%'; $percent_decr = '-20%'; @@ -192,8 +205,8 @@ class FinanceTest extends TestCase public function testSubfleetFaresNoOverride() { - $subfleet = factory(App\Models\Subfleet::class)->create(); - $fare = factory(App\Models\Fare::class)->create(); + $subfleet = factory(Subfleet::class)->create(); + $fare = factory(Fare::class)->create(); $this->fareSvc->setForSubfleet($subfleet, $fare); $subfleet_fares = $this->fareSvc->getForSubfleet($subfleet); @@ -223,8 +236,8 @@ class FinanceTest extends TestCase public function testSubfleetFaresOverride() { - $subfleet = factory(App\Models\Subfleet::class)->create(); - $fare = factory(App\Models\Fare::class)->create(); + $subfleet = factory(Subfleet::class)->create(); + $fare = factory(Fare::class)->create(); $this->fareSvc->setForSubfleet($subfleet, $fare, [ 'price' => 50, 'capacity' => 400, @@ -260,8 +273,8 @@ class FinanceTest extends TestCase */ public function testSubfleetFareOverrideAsPercent() { - $subfleet = factory(App\Models\Subfleet::class)->create(); - $fare = factory(App\Models\Fare::class)->create(); + $subfleet = factory(Subfleet::class)->create(); + $fare = factory(Fare::class)->create(); $percent_incr = '20%'; $percent_decr = '-20%'; @@ -291,9 +304,9 @@ class FinanceTest extends TestCase */ public function testGetFaresWithOverrides() { - $flight = factory(App\Models\Flight::class)->create(); - $subfleet = factory(App\Models\Subfleet::class)->create(); - [$fare1, $fare2, $fare3, $fare4] = factory(App\Models\Fare::class, 4)->create(); + $flight = factory(Flight::class)->create(); + $subfleet = factory(Subfleet::class)->create(); + [$fare1, $fare2, $fare3, $fare4] = factory(Fare::class, 4)->create(); // add to the subfleet, and just override one of them $this->fareSvc->setForSubfleet($subfleet, $fare1); @@ -345,8 +358,8 @@ class FinanceTest extends TestCase public function testGetFaresNoFlightOverrides() { - $subfleet = factory(App\Models\Subfleet::class)->create(); - [$fare1, $fare2, $fare3] = factory(App\Models\Fare::class, 3)->create(); + $subfleet = factory(Subfleet::class)->create(); + [$fare1, $fare2, $fare3] = factory(Fare::class, 3)->create(); // add to the subfleet, and just override one of them $this->fareSvc->setForSubfleet($subfleet, $fare1); @@ -393,11 +406,11 @@ class FinanceTest extends TestCase $rank = $this->createRank(10, [$subfleet['subfleet']->id]); $this->fleetSvc->addSubfleetToRank($subfleet['subfleet'], $rank); - $this->user = factory(App\Models\User::class)->create([ + $this->user = factory(User::class)->create([ 'rank_id' => $rank->id, ]); - $pirep = factory(App\Models\Pirep::class)->create([ + $pirep = factory(Pirep::class)->create([ 'user_id' => $this->user->id, 'aircraft_id' => $subfleet['aircraft']->random(), 'source' => PirepSource::ACARS, @@ -420,11 +433,11 @@ class FinanceTest extends TestCase 'acars_pay' => $acars_pay_rate, ]); - $this->user = factory(App\Models\User::class)->create([ + $this->user = factory(User::class)->create([ 'rank_id' => $rank->id, ]); - $pirep_acars = factory(App\Models\Pirep::class)->create([ + $pirep_acars = factory(Pirep::class)->create([ 'user_id' => $this->user->id, 'aircraft_id' => $subfleet['aircraft']->random(), 'source' => PirepSource::ACARS, @@ -444,7 +457,7 @@ class FinanceTest extends TestCase 'manual_pay' => $manual_pay_rate, ]); - $pirep_manual = factory(App\Models\Pirep::class)->create([ + $pirep_manual = factory(Pirep::class)->create([ 'user_id' => $this->user->id, 'aircraft_id' => $subfleet['aircraft']->random(), 'source' => PirepSource::MANUAL, @@ -471,11 +484,11 @@ class FinanceTest extends TestCase 'acars_pay' => $acars_pay_rate, ]); - $this->user = factory(App\Models\User::class)->create([ + $this->user = factory(User::class)->create([ 'rank_id' => $rank->id, ]); - $pirep_acars = factory(App\Models\Pirep::class)->create([ + $pirep_acars = factory(Pirep::class)->create([ 'user_id' => $this->user->id, 'aircraft_id' => $subfleet['aircraft']->random(), 'source' => PirepSource::ACARS, @@ -485,7 +498,7 @@ class FinanceTest extends TestCase $payment = $this->financeSvc->getPilotPay($pirep_acars); $this->assertEquals(100, $payment->getValue()); - $pirep_acars = factory(App\Models\Pirep::class)->create([ + $pirep_acars = factory(Pirep::class)->create([ 'user_id' => $this->user->id, 'aircraft_id' => $subfleet['aircraft']->random(), 'source' => PirepSource::ACARS, @@ -506,16 +519,16 @@ class FinanceTest extends TestCase 'acars_pay' => $acars_pay_rate, ]); - $this->user = factory(App\Models\User::class)->create([ + $this->user = factory(User::class)->create([ 'rank_id' => $rank->id, ]); - $flight = factory(App\Models\Flight::class)->create([ + $flight = factory(Flight::class)->create([ 'airline_id' => $this->user->airline_id, 'pilot_pay' => 1000, ]); - $pirep_acars = factory(App\Models\Pirep::class)->create([ + $pirep_acars = factory(Pirep::class)->create([ 'user_id' => $this->user->id, 'aircraft_id' => $subfleet['aircraft']->random(), 'source' => PirepSource::ACARS, @@ -526,7 +539,7 @@ class FinanceTest extends TestCase $payment = $this->financeSvc->getPilotPay($pirep_acars); $this->assertEquals(1000, $payment->getValue()); - $pirep_acars = factory(App\Models\Pirep::class)->create([ + $pirep_acars = factory(Pirep::class)->create([ 'user_id' => $this->user->id, 'aircraft_id' => $subfleet['aircraft']->random(), 'source' => PirepSource::ACARS, @@ -544,8 +557,8 @@ class FinanceTest extends TestCase { $journalRepo = app(JournalRepository::class); - $user = factory(App\Models\User::class)->create(); - $journal = factory(App\Models\Journal::class)->create(); + $user = factory(User::class)->create(); + $journal = factory(Journal::class)->create(); $journalRepo->post( $journal, @@ -624,18 +637,18 @@ class FinanceTest extends TestCase */ public function testPirepExpenses() { - $airline = factory(App\Models\Airline::class)->create(); - $airline2 = factory(App\Models\Airline::class)->create(); + $airline = factory(Airline::class)->create(); + $airline2 = factory(Airline::class)->create(); - factory(App\Models\Expense::class)->create([ + factory(Expense::class)->create([ 'airline_id' => $airline->id, ]); - factory(App\Models\Expense::class)->create([ + factory(Expense::class)->create([ 'airline_id' => $airline2->id, ]); - factory(App\Models\Expense::class)->create([ + factory(Expense::class)->create([ 'airline_id' => null, ]); @@ -660,8 +673,8 @@ class FinanceTest extends TestCase * Test the subfleet class */ - $subfleet = factory(App\Models\Subfleet::class)->create(); - factory(App\Models\Expense::class)->create([ + $subfleet = factory(Subfleet::class)->create(); + factory(Expense::class)->create([ 'airline_id' => null, 'ref_model' => Subfleet::class, 'ref_model_id' => $subfleet->id, @@ -737,7 +750,7 @@ class FinanceTest extends TestCase $journalRepo = app(JournalRepository::class); // Add an expense that's only for a cargo flight - factory(App\Models\Expense::class)->create([ + factory(Expense::class)->create([ 'airline_id' => null, 'amount' => 100, 'flight_type' => FlightType::SCHED_CARGO, @@ -784,7 +797,7 @@ class FinanceTest extends TestCase } // Add a new PIREP; - $pirep2 = factory(App\Models\Pirep::class)->create([ + $pirep2 = factory(Pirep::class)->create([ 'flight_number' => 100, 'flight_type' => FlightType::SCHED_CARGO, 'dpt_airport_id' => $pirep->dpt_airport_id, diff --git a/tests/FlightTest.php b/tests/FlightTest.php index 2f805834..f7f544b8 100644 --- a/tests/FlightTest.php +++ b/tests/FlightTest.php @@ -1,14 +1,23 @@ $user->airline_id, ], $flight_properties); - $flight = factory(App\Models\Flight::class)->create($opts); + $flight = factory(Flight::class)->create($opts); $flight->subfleets()->syncWithoutDetaching([ - factory(App\Models\Subfleet::class)->create([ + factory(Subfleet::class)->create([ 'airline_id' => $user->airline_id, ])->id, ]); @@ -59,7 +68,7 @@ class FlightTest extends TestCase */ public function addFlightsForSubfleet($subfleet, $num_flights) { - return factory(App\Models\Flight::class, $num_flights)->create([ + return factory(Flight::class, $num_flights)->create([ 'airline_id' => $subfleet->airline->id, ])->each(function (Flight $f) use ($subfleet) { $f->subfleets()->syncWithoutDetaching([ @@ -73,7 +82,7 @@ class FlightTest extends TestCase */ public function testDuplicateFlight() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); $flight = $this->addFlight($this->user); // first flight shouldn't be a duplicate @@ -89,7 +98,7 @@ class FlightTest extends TestCase $this->assertTrue($this->flightSvc->isFlightDuplicate($flight_dupe)); // same flight but diff airline shouldn't be a dupe - $new_airline = factory(App\Models\Airline::class)->create(); + $new_airline = factory(Airline::class)->create(); $flight_dupe = new Flight([ 'airline_id' => $new_airline->airline_id, 'flight_number' => $flight->flight_number, @@ -100,7 +109,7 @@ class FlightTest extends TestCase $this->assertFalse($this->flightSvc->isFlightDuplicate($flight_dupe)); // add another flight with a code - $flight_leg = factory(App\Models\Flight::class)->create([ + $flight_leg = factory(Flight::class)->create([ 'airline_id' => $flight->airline_id, 'flight_number' => $flight->flight_number, 'route_code' => 'A', @@ -109,7 +118,7 @@ class FlightTest extends TestCase $this->assertFalse($this->flightSvc->isFlightDuplicate($flight_leg)); // Add both a route and leg - $flight_leg = factory(App\Models\Flight::class)->create([ + $flight_leg = factory(Flight::class)->create([ 'airline_id' => $flight->airline_id, 'flight_number' => $flight->flight_number, 'route_code' => 'A', @@ -121,7 +130,7 @@ class FlightTest extends TestCase public function testGetFlight() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); $flight = $this->addFlight($this->user, [ 'load_factor' => '', 'load_factor_variance' => '', @@ -148,7 +157,7 @@ class FlightTest extends TestCase */ public function testSearchFlight() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); $flight = $this->addFlight($this->user); // search specifically for a flight ID @@ -157,6 +166,29 @@ class FlightTest extends TestCase $req->assertStatus(200); } + public function testSearchFlightInactiveAirline() + { + /** @var \App\Models\Airline $airline_inactive */ + $airline_inactive = factory(Airline::class)->create(['active' => 0]); + + /** @var \App\Models\Airline $airline_active */ + $airline_active = factory(Airline::class)->create(['active' => 1]); + $this->user = factory(User::class)->create([ + 'airline_id' => $airline_inactive->id, + ]); + + $this->addFlight($this->user, ['airline_id' => $airline_inactive->id]); + $this->addFlight($this->user, ['airline_id' => $airline_active->id]); + + // search specifically for a flight ID + $req = $this->get('/api/flights/search?ignore_restrictions=1'); + $req->assertStatus(200); + $body = $req->json('data'); + + $this->assertEquals(1, count($body)); + $this->assertEquals($airline_active->id, $body[0]['airline_id']); + } + /** * Get the flight's route * @@ -164,11 +196,11 @@ class FlightTest extends TestCase */ public function testFlightRoute() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); $flight = $this->addFlight($this->user); $route_count = random_int(4, 6); - $route = factory(App\Models\Navdata::class, $route_count)->create(); + $route = factory(Navdata::class, $route_count)->create(); $route_text = implode(' ', $route->pluck('id')->toArray()); $flight->route = $route_text; @@ -198,8 +230,8 @@ class FlightTest extends TestCase */ public function testFindAllFlights() { - $this->user = factory(App\Models\User::class)->create(); - factory(App\Models\Flight::class, 20)->create([ + $this->user = factory(User::class)->create(); + factory(Flight::class, 20)->create([ 'airline_id' => $this->user->airline_id, ]); @@ -217,12 +249,12 @@ class FlightTest extends TestCase */ public function testSearchFlightBySubfleet() { - $airline = factory(App\Models\Airline::class)->create(); - $subfleetA = factory(App\Models\Subfleet::class)->create(['airline_id' => $airline->id]); - $subfleetB = factory(App\Models\Subfleet::class)->create(['airline_id' => $airline->id]); + $airline = factory(Airline::class)->create(); + $subfleetA = factory(Subfleet::class)->create(['airline_id' => $airline->id]); + $subfleetB = factory(Subfleet::class)->create(['airline_id' => $airline->id]); $rank = $this->createRank(0, [$subfleetB->id]); - $this->user = factory(App\Models\User::class)->create([ + $this->user = factory(User::class)->create([ 'airline_id' => $airline->id, 'rank_id' => $rank->id, ]); @@ -250,12 +282,12 @@ class FlightTest extends TestCase */ public function testFindDaysOfWeek(): void { - $this->user = factory(App\Models\User::class)->create(); - factory(App\Models\Flight::class, 20)->create([ + $this->user = factory(User::class)->create(); + factory(Flight::class, 20)->create([ 'airline_id' => $this->user->airline_id, ]); - $saved_flight = factory(App\Models\Flight::class)->create([ + $saved_flight = factory(Flight::class)->create([ 'airline_id' => $this->user->airline_id, 'days' => Days::getDaysMask([ Days::SUNDAY, @@ -283,7 +315,7 @@ class FlightTest extends TestCase */ public function testDayOfWeekActive(): void { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); // Set it to Monday or Tuesday, depending on what today is if (date('N') === '1') { // today is a monday @@ -292,8 +324,8 @@ class FlightTest extends TestCase $days = Days::getDaysMask([Days::MONDAY]); } - factory(App\Models\Flight::class, 5)->create(); - $flight = factory(App\Models\Flight::class)->create([ + factory(Flight::class, 5)->create(); + $flight = factory(Flight::class)->create([ 'days' => $days, ]); @@ -331,17 +363,17 @@ class FlightTest extends TestCase public function testStartEndDate(): void { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); - factory(App\Models\Flight::class, 5)->create(); - $flight = factory(App\Models\Flight::class)->create([ - 'start_date' => Carbon\Carbon::now('UTC')->subDays(1), - 'end_date' => Carbon\Carbon::now('UTC')->addDays(1), + factory(Flight::class, 5)->create(); + $flight = factory(Flight::class)->create([ + 'start_date' => Carbon::now('UTC')->subDays(1), + 'end_date' => Carbon::now('UTC')->addDays(1), ]); - $flight_not_active = factory(App\Models\Flight::class)->create([ - 'start_date' => Carbon\Carbon::now('UTC')->subDays(10), - 'end_date' => Carbon\Carbon::now('UTC')->subDays(2), + $flight_not_active = factory(Flight::class)->create([ + 'start_date' => Carbon::now('UTC')->subDays(10), + 'end_date' => Carbon::now('UTC')->subDays(2), ]); // Run the event that will enable/disable flights @@ -360,7 +392,7 @@ class FlightTest extends TestCase public function testStartEndDateDayOfWeek(): void { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); // Set it to Monday or Tuesday, depending on what today is if (date('N') === '1') { // today is a monday @@ -369,17 +401,17 @@ class FlightTest extends TestCase $days = Days::getDaysMask([Days::MONDAY]); } - factory(App\Models\Flight::class, 5)->create(); - $flight = factory(App\Models\Flight::class)->create([ - 'start_date' => Carbon\Carbon::now('UTC')->subDays(1), - 'end_date' => Carbon\Carbon::now('UTC')->addDays(1), + factory(Flight::class, 5)->create(); + $flight = factory(Flight::class)->create([ + 'start_date' => Carbon::now('UTC')->subDays(1), + 'end_date' => Carbon::now('UTC')->addDays(1), 'days' => Days::$isoDayMap[date('N')], ]); // Not active because of days of week not today - $flight_not_active = factory(App\Models\Flight::class)->create([ - 'start_date' => Carbon\Carbon::now('UTC')->subDays(1), - 'end_date' => Carbon\Carbon::now('UTC')->addDays(1), + $flight_not_active = factory(Flight::class)->create([ + 'start_date' => Carbon::now('UTC')->subDays(1), + 'end_date' => Carbon::now('UTC')->addDays(1), 'days' => $days, ]); @@ -399,8 +431,8 @@ class FlightTest extends TestCase public function testFlightSearchApi() { - $this->user = factory(App\Models\User::class)->create(); - $flights = factory(App\Models\Flight::class, 10)->create([ + $this->user = factory(User::class)->create(); + $flights = factory(Flight::class, 10)->create([ 'airline_id' => $this->user->airline_id, ]); @@ -415,12 +447,12 @@ class FlightTest extends TestCase public function testFlightSearchApiDepartureAirport() { - $this->user = factory(App\Models\User::class)->create(); - factory(App\Models\Flight::class, 10)->create([ + $this->user = factory(User::class)->create(); + factory(Flight::class, 10)->create([ 'airline_id' => $this->user->airline_id, ]); - $flight = factory(App\Models\Flight::class)->create([ + $flight = factory(Flight::class)->create([ 'airline_id' => $this->user->airline_id, 'dpt_airport_id' => 'KAUS', ]); @@ -436,8 +468,8 @@ class FlightTest extends TestCase public function testFlightSearchApiDistance() { $total_flights = 10; - $this->user = factory(App\Models\User::class)->create(); - $flights = factory(App\Models\Flight::class, $total_flights)->create([ + $this->user = factory(User::class)->create(); + $flights = factory(Flight::class, $total_flights)->create([ 'airline_id' => $this->user->airline_id, ]); @@ -474,10 +506,10 @@ class FlightTest extends TestCase public function testAddSubfleet() { - $subfleet = factory(App\Models\Subfleet::class)->create(); - $flight = factory(App\Models\Flight::class)->create(); + $subfleet = factory(Subfleet::class)->create(); + $flight = factory(Flight::class)->create(); - $fleetSvc = app(App\Services\FleetService::class); + $fleetSvc = app(FleetService::class); $fleetSvc->addSubfleetToFlight($subfleet, $flight); $flight->refresh(); @@ -508,13 +540,13 @@ class FlightTest extends TestCase public function testAirportDistance() { // KJFK - $fromIcao = factory(App\Models\Airport::class)->create([ + $fromIcao = factory(Airport::class)->create([ 'lat' => 40.6399257, 'lon' => -73.7786950, ]); // KSFO - $toIcao = factory(App\Models\Airport::class)->create([ + $toIcao = factory(Airport::class)->create([ 'lat' => 37.6188056, 'lon' => -122.3754167, ]); @@ -531,13 +563,13 @@ class FlightTest extends TestCase $headers = $this->headers($user); // KJFK - $fromIcao = factory(App\Models\Airport::class)->create([ + $fromIcao = factory(Airport::class)->create([ 'lat' => 40.6399257, 'lon' => -73.7786950, ]); // KSFO - $toIcao = factory(App\Models\Airport::class)->create([ + $toIcao = factory(Airport::class)->create([ 'lat' => 37.6188056, 'lon' => -122.3754167, ]); diff --git a/tests/GeoTest.php b/tests/GeoTest.php index ce585f91..79e36604 100644 --- a/tests/GeoTest.php +++ b/tests/GeoTest.php @@ -1,5 +1,9 @@ create(); + $navpoints = factory(Navdata::class, $nav_count)->create(); foreach ($navpoints as $point) { $route[] = $point->id; } diff --git a/tests/ImporterTest.php b/tests/ImporterTest.php index e7e5ff3c..7c416dcd 100644 --- a/tests/ImporterTest.php +++ b/tests/ImporterTest.php @@ -1,7 +1,10 @@ 'phpVMS Airlines', ]; - $airline = factory(App\Models\Airline::class)->create($al); - $subfleet = factory(App\Models\Subfleet::class)->create(['type' => 'A32X']); + $airline = factory(Airline::class)->create($al); + $subfleet = factory(Subfleet::class)->create(['type' => 'A32X']); // Add the economy class - $fare_economy = factory(App\Models\Fare::class)->create(['code' => 'Y', 'capacity' => 150]); + $fare_economy = factory(Fare::class)->create(['code' => 'Y', 'capacity' => 150]); $fare_svc->setForSubfleet($subfleet, $fare_economy); - $fare_business = factory(App\Models\Fare::class)->create(['code' => 'B', 'capacity' => 20]); + $fare_business = factory(Fare::class)->create(['code' => 'B', 'capacity' => 20]); $fare_svc->setForSubfleet($subfleet, $fare_business); // Add first class - $fare_first = factory(App\Models\Fare::class)->create(['code' => 'F', 'capacity' => 10]); + $fare_first = factory(Fare::class)->create(['code' => 'F', 'capacity' => 10]); $fare_svc->setForSubfleet($subfleet, $fare_first); return [$airline, $subfleet]; @@ -247,7 +251,7 @@ class ImporterTest extends TestCase */ public function testAircraftExporter(): void { - $aircraft = factory(App\Models\Aircraft::class)->create(); + $aircraft = factory(Aircraft::class)->create(); $exporter = new AircraftExporter(); $exported = $exporter->export($aircraft); @@ -273,7 +277,7 @@ class ImporterTest extends TestCase { $airport_name = 'Adolfo Suárez Madrid–Barajas Airport'; - $airport = factory(App\Models\Airport::class)->create([ + $airport = factory(Airport::class)->create([ 'name' => $airport_name, ]); @@ -301,12 +305,12 @@ class ImporterTest extends TestCase $fareSvc = app(FareService::class); [$airline, $subfleet] = $this->insertFlightsScaffoldData(); - $subfleet2 = factory(App\Models\Subfleet::class)->create(['type' => 'B74X']); + $subfleet2 = factory(Subfleet::class)->create(['type' => 'B74X']); $fareY = Fare::where('code', 'Y')->first(); $fareF = Fare::where('code', 'F')->first(); - $flight = factory(App\Models\Flight::class)->create([ + $flight = factory(Flight::class)->create([ 'airline_id' => $airline->id, 'flight_type' => 'J', 'days' => Days::getDaysMask([ @@ -384,9 +388,9 @@ class ImporterTest extends TestCase */ public function testExpenseImporter(): void { - $airline = factory(App\Models\Airline::class)->create(['icao' => 'VMS']); - $subfleet = factory(App\Models\Subfleet::class)->create(['type' => '744-3X-RB211']); - $aircraft = factory(App\Models\Aircraft::class)->create([ + $airline = factory(Airline::class)->create(['icao' => 'VMS']); + $subfleet = factory(Subfleet::class)->create(['type' => '744-3X-RB211']); + $aircraft = factory(Aircraft::class)->create([ 'subfleet_id' => $subfleet->id, 'registration' => '001Z', ]); @@ -564,8 +568,8 @@ class ImporterTest extends TestCase */ public function testAircraftImporter(): void { - factory(App\Models\Airline::class)->create(); - // $subfleet = factory(App\Models\Subfleet::class)->create(['type' => 'A32X']); + factory(Airline::class)->create(); + // $subfleet = factory(\App\Models\Subfleet::class)->create(['type' => 'A32X']); $file_path = base_path('tests/data/aircraft.csv'); $status = $this->importSvc->importAircraft($file_path); @@ -646,9 +650,9 @@ class ImporterTest extends TestCase */ public function testSubfleetImporter(): void { - $fare_economy = factory(App\Models\Fare::class)->create(['code' => 'Y', 'capacity' => 150]); - $fare_business = factory(App\Models\Fare::class)->create(['code' => 'B', 'capacity' => 20]); - $airline = factory(App\Models\Airline::class)->create(['icao' => 'VMS']); + $fare_economy = factory(Fare::class)->create(['code' => 'Y', 'capacity' => 150]); + $fare_business = factory(Fare::class)->create(['code' => 'B', 'capacity' => 20]); + $airline = factory(Airline::class)->create(['icao' => 'VMS']); $file_path = base_path('tests/data/subfleets.csv'); $status = $this->importSvc->importSubfleets($file_path); diff --git a/tests/MathTest.php b/tests/MathTest.php index 9188c789..033306ad 100644 --- a/tests/MathTest.php +++ b/tests/MathTest.php @@ -1,5 +1,7 @@ create(); + $navpoints = factory(Navdata::class, 5)->create(); foreach ($navpoints as $point) { $route[] = $point->id; } @@ -65,10 +69,10 @@ class PIREPTest extends TestCase */ public function testAddPirep() { - $user = factory(App\Models\User::class)->create(); + $user = factory(User::class)->create(); $route = $this->createNewRoute(); - $pirep = factory(App\Models\Pirep::class)->create([ + $pirep = factory(Pirep::class)->create([ 'user_id' => $user->id, 'route' => implode(' ', $route), ]); @@ -171,18 +175,18 @@ class PIREPTest extends TestCase public function testGetUserPireps() { - $this->user = factory(App\Models\User::class)->create(); - $pirep_done = factory(App\Models\Pirep::class)->create([ + $this->user = factory(User::class)->create(); + $pirep_done = factory(Pirep::class)->create([ 'user_id' => $this->user->id, 'state' => PirepState::ACCEPTED, ]); - $pirep_in_progress = factory(App\Models\Pirep::class)->create([ + $pirep_in_progress = factory(Pirep::class)->create([ 'user_id' => $this->user->id, 'state' => PirepState::IN_PROGRESS, ]); - $pirep_cancelled = factory(App\Models\Pirep::class)->create([ + $pirep_cancelled = factory(Pirep::class)->create([ 'user_id' => $this->user->id, 'state' => PirepState::CANCELLED, ]); @@ -360,7 +364,7 @@ class PIREPTest extends TestCase */ public function testDuplicatePireps() { - $user = factory(App\Models\User::class)->create(); + $user = factory(User::class)->create(); $pirep = factory(Pirep::class)->create([ 'user_id' => $user->id, ]); @@ -392,7 +396,7 @@ class PIREPTest extends TestCase $pirep_id = $response->json()['data']['id']; $uri = '/api/pireps/'.$pirep_id.'/acars/position'; - $acars = factory(App\Models\Acars::class)->make()->toArray(); + $acars = factory(Acars::class)->make()->toArray(); $response = $this->post($uri, [ 'positions' => [$acars], ]); @@ -406,7 +410,7 @@ class PIREPTest extends TestCase // Should get a 400 when posting an ACARS update $uri = '/api/pireps/'.$pirep_id.'/acars/position'; - $acars = factory(App\Models\Acars::class)->make()->toArray(); + $acars = factory(Acars::class)->make()->toArray(); $response = $this->post($uri, $acars); $response->assertStatus(400); @@ -421,18 +425,18 @@ class PIREPTest extends TestCase $flightSvc = app(FlightService::class); $this->settingsRepo->store('pireps.remove_bid_on_accept', true); - $user = factory(App\Models\User::class)->create([ + $user = factory(User::class)->create([ 'flight_time' => 0, ]); - $flight = factory(App\Models\Flight::class)->create([ + $flight = factory(Flight::class)->create([ 'route_code' => null, 'route_leg' => null, ]); $bidSvc->addBid($flight, $user); - $pirep = factory(App\Models\Pirep::class)->create([ + $pirep = factory(Pirep::class)->create([ 'user_id' => $user->id, 'airline_id' => $flight->airline_id, 'flight_id' => $flight->id, diff --git a/tests/RegistrationTest.php b/tests/RegistrationTest.php index a57c1777..bd238009 100644 --- a/tests/RegistrationTest.php +++ b/tests/RegistrationTest.php @@ -1,5 +1,7 @@ make()->toArray(); + $attrs = factory(\App\Models\User::class)->make()->toArray(); $attrs['password'] = Hash::make('secret'); $user = $userSvc->createUser($attrs); diff --git a/tests/SimBriefTest.php b/tests/SimBriefTest.php index a4a34531..3b0c9e99 100644 --- a/tests/SimBriefTest.php +++ b/tests/SimBriefTest.php @@ -1,8 +1,13 @@ create([ + $flight = factory(Flight::class)->create([ 'id' => self::$simbrief_flight_id, 'dpt_airport_id' => 'OMAA', 'arr_airport_id' => 'OMDB', @@ -42,7 +47,7 @@ class SimBriefTest extends TestCase */ public function testReadSimbrief() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); $briefing = $this->loadSimBrief($this->user); $this->assertNotEmpty($briefing->ofp_xml); @@ -81,7 +86,7 @@ class SimBriefTest extends TestCase */ public function testApiCalls() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); $briefing = $this->loadSimBrief($this->user); // Check the flight API response @@ -115,7 +120,7 @@ class SimBriefTest extends TestCase */ public function testUserBidSimbrief() { - $this->user = factory(App\Models\User::class)->create(); + $this->user = factory(User::class)->create(); $this->loadSimBrief($this->user); // Find the flight @@ -131,8 +136,8 @@ class SimBriefTest extends TestCase public function testAttachToPirep() { - $user = factory(App\Models\User::class)->create(); - $pirep = factory(App\Models\Pirep::class)->create([ + $user = factory(User::class)->create(); + $pirep = factory(Pirep::class)->create([ 'user_id' => $user->id, 'dpt_airport_id' => 'OMAA', 'arr_airport_id' => 'OMDB', @@ -167,7 +172,7 @@ class SimBriefTest extends TestCase */ public function testClearExpiredBriefs() { - $user = factory(App\Models\User::class)->create(); + $user = factory(User::class)->create(); $sb_ignored = factory(SimBrief::class)->create([ 'user_id' => $user->id, 'flight_id' => 'a_flight_id', diff --git a/tests/SubfleetTest.php b/tests/SubfleetTest.php index 9abcaf6e..84f39869 100644 --- a/tests/SubfleetTest.php +++ b/tests/SubfleetTest.php @@ -1,5 +1,11 @@ create(); - $fare = factory(App\Models\Fare::class)->create(); + $subfleet = factory(Subfleet::class)->create(); + $fare = factory(Fare::class)->create(); $fare_svc->setForSubfleet($subfleet, $fare); $subfleet_fares = $fare_svc->getForSubfleet($subfleet); @@ -46,10 +52,10 @@ class SubfleetTest extends TestCase public function testSubfleetFaresOverride() { - $fare_svc = app('App\Services\FareService'); + $fare_svc = app(FareService::class); - $subfleet = factory(App\Models\Subfleet::class)->create(); - $fare = factory(App\Models\Fare::class)->create(); + $subfleet = factory(Subfleet::class)->create(); + $fare = factory(Fare::class)->create(); $fare_svc->setForSubfleet($subfleet, $fare, [ 'price' => 50, 'capacity' => 400, diff --git a/tests/TestCase.php b/tests/TestCase.php index a1b559be..916a9dfd 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,29 +1,36 @@ true]); Artisan::call('migrate:refresh', ['--env' => 'testing']); + + // $this->disableExceptionHandling(); } - public function tearDown(): void + /** + * https://stackoverflow.com/a/41945739 + * https://gist.github.com/adamwathan/c9752f61102dc056d157 + */ + protected function disableExceptionHandling() { - parent::tearDown(); + $this->app->instance(ExceptionHandler::class, new class() extends Handler { + public function __construct() + { + } + + public function report(\Throwable $e) + { + // no-op + } + + public function render($request, \Throwable $e) + { + throw $e; + } + }); } /** @@ -200,13 +228,13 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase * @param $methodName * @param array $parameters * - * @throws ReflectionException + * @throws \ReflectionException * * @return mixed */ public function invokeMethod(&$object, $methodName, array $parameters = []) { - $reflection = new \ReflectionClass(get_class($object)); + $reflection = new ReflectionClass(get_class($object)); $method = $reflection->getMethod($methodName); $method->setAccessible(true); @@ -228,7 +256,7 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase $this->transformData($value); } - if (is_subclass_of($value, App\Contracts\Unit::class)) { + if (is_subclass_of($value, Unit::class)) { $data[$key] = $value->__toString(); } @@ -249,9 +277,9 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase * @param array $headers * @param null $user * - * @return Illuminate\Testing\TestResponse + * @return \Illuminate\Testing\TestResponse */ - public function get($uri, array $headers = [], $user = null): Illuminate\Testing\TestResponse + public function get($uri, array $headers = [], $user = null): TestResponse { $req = parent::get($uri, $this->headers($user, $headers)); if ($req->isClientError() || $req->isServerError()) { diff --git a/tests/UserTest.php b/tests/UserTest.php index be0d218e..84d624fc 100644 --- a/tests/UserTest.php +++ b/tests/UserTest.php @@ -1,5 +1,7 @@ createRank(10, [$subfleetA['subfleet']->id]); - $user = factory(App\Models\User::class)->create([ + $user = factory(\App\Models\User::class)->create([ 'rank_id' => $rank->id, ]); @@ -95,7 +97,7 @@ class UserTest extends TestCase $rank = $this->createRank(10, [$subfleetA['subfleet']->id]); - $user = factory(App\Models\User::class)->create([ + $user = factory(\App\Models\User::class)->create([ 'rank_id' => $rank->id, ]); @@ -136,17 +138,17 @@ class UserTest extends TestCase { // Add subfleets and aircraft, but also add another // set of subfleets - $airport = factory(App\Models\Airport::class)->create(); + $airport = factory(\App\Models\Airport::class)->create(); $subfleetA = $this->createSubfleetWithAircraft(2, $airport->id); $subfleetB = $this->createSubfleetWithAircraft(2); $rank = $this->createRank(10, [$subfleetA['subfleet']->id]); - $user = factory(App\Models\User::class)->create([ + $user = factory(\App\Models\User::class)->create([ 'curr_airport_id' => $airport->id, 'rank_id' => $rank->id, ]); - $flight = factory(App\Models\Flight::class)->create([ + $flight = factory(\App\Models\Flight::class)->create([ 'airline_id' => $user->airline_id, 'dpt_airport_id' => $airport->id, ]); @@ -201,8 +203,8 @@ class UserTest extends TestCase public function testUserPilotIdChangeAlreadyExists() { $this->expectException(UserPilotIdExists::class); - $user1 = factory(App\Models\User::class)->create(['id' => 1]); - $user2 = factory(App\Models\User::class)->create(['id' => 2]); + $user1 = factory(\App\Models\User::class)->create(['id' => 1]); + $user2 = factory(\App\Models\User::class)->create(['id' => 2]); // Now try to change the original user's pilot_id to 2 (should conflict) $this->userSvc->changePilotId($user1, 2); @@ -214,7 +216,7 @@ class UserTest extends TestCase public function testUserPilotIdSplit(): void { /** @var \App\Models\User $user */ - $user = factory(App\Models\User::class)->create(); + $user = factory(\App\Models\User::class)->create(); $found_user = $this->userSvc->findUserByPilotId($user->ident); $this->assertEquals($user->id, $found_user->id); @@ -229,7 +231,7 @@ class UserTest extends TestCase public function testUserPilotIdSplitInvalidId(): void { /** @var \App\Models\User $user */ - $user = factory(App\Models\User::class)->create(); + $user = factory(\App\Models\User::class)->create(); $this->expectException(PilotIdNotFound::class); $this->userSvc->findUserByPilotId($user->airline->iata); @@ -240,13 +242,13 @@ class UserTest extends TestCase */ public function testUserPilotIdAdded() { - $new_user = factory(App\Models\User::class)->make()->toArray(); + $new_user = factory(\App\Models\User::class)->make()->toArray(); $new_user['password'] = Hash::make('secret'); $user = $this->userSvc->createUser($new_user); $this->assertEquals($user->id, $user->pilot_id); // Add a second user - $new_user = factory(App\Models\User::class)->make()->toArray(); + $new_user = factory(\App\Models\User::class)->make()->toArray(); $new_user['password'] = Hash::make('secret'); $user2 = $this->userSvc->createUser($new_user); $this->assertEquals($user2->id, $user2->pilot_id); @@ -256,7 +258,7 @@ class UserTest extends TestCase $this->assertEquals(3, $user->pilot_id); // Create a new user and the pilot_id should be 4 - $user3 = factory(App\Models\User::class)->create(); + $user3 = factory(\App\Models\User::class)->create(); $this->assertEquals(4, $user3->pilot_id); } diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index c9d3269e..2ac01c3f 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php @@ -1,5 +1,7 @@