Update to Laravel 8 (#1058)

* Update Laravel and other dependencies

* Composer version in CI

* Remove the PHP exit from env file

* Add PHP 8 to testing matrix

* Update doctrine

* Update doctrine

* Update faker lib

* Rewrite TLD check to remove deprecated library

* Update version lib

* Remove PHP 8 for now

* Style fixes
This commit is contained in:
Nabeel S 2021-03-04 17:08:51 -05:00 committed by GitHub
parent 922e754c9e
commit 3800c01d94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 15491 additions and 900 deletions

View File

@ -1,7 +1,3 @@
<?php
exit();
?>
APP_ENV="dev" APP_ENV="dev"
APP_KEY="base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY=" APP_KEY="base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY="
APP_URL="http://localhost" APP_URL="http://localhost"

View File

@ -71,7 +71,6 @@ jobs:
php --version php --version
mysql --version mysql --version
# Downgrade composer version to 1.x # Downgrade composer version to 1.x
composer self-update --1
composer install --dev --no-interaction --verbose composer install --dev --no-interaction --verbose
cp .github/scripts/env.php env.php cp .github/scripts/env.php env.php
cp .github/scripts/phpunit.xml phpunit.xml cp .github/scripts/phpunit.xml phpunit.xml

View File

@ -36,7 +36,7 @@ A full development environment can be brought up using Docker:
```bash ```bash
composer install composer install
yarn install npm install
docker-compose build docker-compose build
docker-compose up docker-compose up
``` ```

View File

@ -4,6 +4,7 @@ namespace App\Providers;
use App\Services\ModuleService; use App\Services\ModuleService;
use App\Support\Utils; use App\Support\Utils;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\View; use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
@ -13,6 +14,7 @@ class AppServiceProvider extends ServiceProvider
public function boot(): void public function boot(): void
{ {
Schema::defaultStringLength(191); Schema::defaultStringLength(191);
Paginator::useBootstrap();
View::share('moduleSvc', app(ModuleService::class)); View::share('moduleSvc', app(ModuleService::class));
} }

View File

@ -5,9 +5,8 @@ namespace App\Support;
use App\Contracts\Model; use App\Contracts\Model;
use Hashids\Hashids; use Hashids\Hashids;
use Illuminate\Contracts\Container\BindingResolutionException; use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Support\Str;
use LayerShifter\TLDExtract\Extract;
use Nwidart\Modules\Facades\Module; use Nwidart\Modules\Facades\Module;
use Pdp\Rules;
/** /**
* Global utilities * Global utilities
@ -110,26 +109,36 @@ class Utils
*/ */
public static function getRootDomain(string $url): string public static function getRootDomain(string $url): string
{ {
if (Str::contains($url, ['https://', 'http://'])) { if (!str_starts_with($url, 'http')) {
$url = str_replace('https://', '', $url); $url = 'http://'.$url;
$url = str_replace('http://', '', $url);
} }
$extract = new Extract(); $parsed_url = parse_url($url, PHP_URL_HOST);
$result = $extract->parse($url); if (empty($parsed_url)) {
return '';
}
$val = $result->getRegistrableDomain(); if (str_ends_with($parsed_url, 'localhost')) {
return 'localhost';
}
if (str_ends_with($parsed_url, '/')) {
$parsed_url = substr($parsed_url, 0, strlen($parsed_url) - 1);
}
$rules = Rules::createFromPath(resource_path('tld/public_suffix_list.dat'));
$domain = $rules->resolve($parsed_url);
$val = $domain->getRegistrableDomain();
if (!empty($val)) { if (!empty($val)) {
return $val; return $val;
} }
if ($result->hostname === 'localhost') { // Couldn't validate a domain, see if this is an IP address?
return 'localhost'; if (filter_var($parsed_url, FILTER_VALIDATE_IP)) {
return $parsed_url;
} }
// Couldn't validate a domain, see if this is an IP address? return '';
if (filter_var($url, FILTER_VALIDATE_IP)) {
return $url;
}
} }
} }

View File

@ -14,64 +14,65 @@
"ext-simplexml": "*", "ext-simplexml": "*",
"ext-bcmath": "*", "ext-bcmath": "*",
"ext-pdo": "*", "ext-pdo": "*",
"ext-intl": "*",
"composer/composer": "~1.0", "composer/composer": "~1.0",
"composer/installers": "~1.0", "composer/installers": "~1.0",
"laravel/framework": "~7.0", "laravel/framework": "~8.0",
"akaunting/money": "^1.0", "akaunting/money": "^1.0",
"anhskohbo/no-captcha": "^3.0", "anhskohbo/no-captcha": "^3.0",
"appstract/laravel-opcache": "^4.0", "appstract/laravel-opcache": "^4.0",
"arrilot/laravel-widgets": "~3.13.0", "arrilot/laravel-widgets": "~3.13.0",
"codedge/laravel-selfupdater": "~3.0.0", "codedge/laravel-selfupdater": "~3.2.0",
"doctrine/dbal": "~2.9.2", "doctrine/dbal": "^3.0.0",
"facade/ignition": "^2.0", "facade/ignition": "^2.5",
"fideloper/proxy": "^4.3", "fideloper/proxy": "^4.4",
"guzzlehttp/guzzle": "~6.5", "guzzlehttp/guzzle": "~6.5",
"hashids/hashids": "^2.0.0", "hashids/hashids": "^4.1.0",
"igaster/laravel-theme": "^2.0", "igaster/laravel-theme": "^2.0",
"intervention/image": "2.4.*", "intervention/image": "2.4.*",
"irazasyed/laravel-gamp": "^1.6", "irazasyed/laravel-gamp": "^1.8",
"jmikola/geojson": "1.0.*", "jmikola/geojson": "1.0.*",
"joshbrw/laravel-module-installer": "0.1.*", "joshbrw/laravel-module-installer": "^2.0",
"laracasts/flash": "^3.1", "laracasts/flash": "^3.1",
"laravel/helpers": "^1.2", "laravel/helpers": "^1.4",
"laravelcollective/html": "~6.2.0", "laravelcollective/html": "~6.2.0",
"layershifter/tld-extract": "^2.0", "jeremykendall/php-domain-parser": "~5.7.2",
"league/csv": "9.2.*", "league/csv": "9.2.*",
"league/geotools": "0.8.*", "league/geotools": "0.8.*",
"league/iso3166": "2.1.*", "league/iso3166": "^3.0.0",
"markrogoyski/math-php": "^0.38.0", "markrogoyski/math-php": "^1.10",
"myclabs/deep-copy": "~1.9.0", "myclabs/deep-copy": "~1.10.0",
"nabeel/vacentral": "~2.0", "nabeel/vacentral": "~2.0",
"nwidart/laravel-modules": "^8.0", "nwidart/laravel-modules": "^8.2",
"php-units-of-measure/php-units-of-measure": "~2.1.0", "php-units-of-measure/php-units-of-measure": "~2.1.0",
"phpvms/sample-module": "^1.0", "phpvms/sample-module": "^1.0",
"pragmarx/version": "^1.2.2", "pragmarx/version": ">=v1.2.3",
"prettus/l5-repository": "~2.6.0", "prettus/l5-repository": "~2.7.0",
"santigarcor/laratrust": "~6.0", "santigarcor/laratrust": "~6.3",
"sebastiaanluca/laravel-helpers": "~5.0", "sebastiaanluca/laravel-helpers": "~6.0",
"semver/semver": "~1.1.0", "semver/semver": "~1.1.0",
"spatie/laravel-backup": "~6.9.0", "spatie/laravel-backup": "~6.15.0",
"spatie/valuestore": "~1.2.3", "spatie/valuestore": "~1.2",
"symfony/polyfill-iconv": "~1.17.0", "symfony/polyfill-iconv": "~1.22.0",
"tivie/php-os-detector": "~1.1.0", "tivie/php-os-detector": "~1.1.0",
"vlucas/phpdotenv": "v4.0", "vlucas/phpdotenv": "^5.3.0",
"webpatser/laravel-uuid": "~3.0", "webpatser/laravel-uuid": "~4.0",
"oomphinc/composer-installers-extender": "^1.1", "oomphinc/composer-installers-extender": "^2.0",
"laravel/ui": "^2.0", "laravel/ui": "^3.2.0",
"madnest/madzipper": "^1.0", "madnest/madzipper": "^1.1.0",
"elcobvg/laravel-opcache": "^0.4.1" "elcobvg/laravel-opcache": "^0.4.1",
"laravel/legacy-factories": "^1.1",
"fakerphp/faker": "^1.13"
}, },
"require-dev": { "require-dev": {
"barryvdh/laravel-debugbar": "^3.0", "barryvdh/laravel-debugbar": "^3.5",
"barryvdh/laravel-ide-helper": "^2.6", "barryvdh/laravel-ide-helper": "^2.9",
"bpocallaghan/generators": "~6.0", "bpocallaghan/generators": "~7.0",
"filp/whoops": "~2.0", "filp/whoops": "~2.0",
"fzaninotto/faker": "~1.9.0",
"friendsofphp/php-cs-fixer": "^2.16", "friendsofphp/php-cs-fixer": "^2.16",
"mockery/mockery": "0.9.*", "mockery/mockery": "^1.4.0",
"nunomaduro/collision": "^4.0", "nunomaduro/collision": "^5.3.0",
"phpunit/phpunit": "~9.0", "phpunit/phpunit": "~9.0",
"squizlabs/php_codesniffer": "3.*",
"sempro/phpunit-pretty-print": "^1.2" "sempro/phpunit-pretty-print": "^1.2"
}, },
"autoload": { "autoload": {

2559
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,7 @@ return [
'fileinfo', 'fileinfo',
'openssl', 'openssl',
'pdo', 'pdo',
'intl',
'mbstring', 'mbstring',
'tokenizer', 'tokenizer',
'json', 'json',

View File

@ -1,50 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="bootstrap/autoload.php" <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="bootstrap/autoload.php" colors="true" processIsolation="false" stopOnFailure="true" convertErrorsToExceptions="false" convertNoticesToExceptions="false" convertWarningsToExceptions="false" beStrictAboutOutputDuringTests="false" beStrictAboutTestsThatDoNotTestAnything="false"
colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
processIsolation="false" <coverage processUncoveredFiles="true">
stopOnFailure="true" <include>
convertErrorsToExceptions="false" <directory suffix=".php">./app</directory>
convertNoticesToExceptions="false" </include>
convertWarningsToExceptions="false" </coverage>
beStrictAboutOutputDuringTests="false" <testsuites>
beStrictAboutTestsThatDoNotTestAnything="false"> <testsuite name="Application Test Suite">
<testsuites> <directory suffix="Test.php">./tests</directory>
<testsuite name="Application Test Suite"> </testsuite>
<directory suffix="Test.php">./tests</directory> </testsuites>
</testsuite> <extensions>
</testsuites> <extension class="Tests\Bootstrap"/>
<extensions> </extensions>
<extension class="Tests\Bootstrap"/> <!--<listeners>
</extensions>
<!--<listeners>
<listener class="NunoMaduro\Collision\Adapters\Phpunit\Listener"/> <listener class="NunoMaduro\Collision\Adapters\Phpunit\Listener"/>
</listeners>--> </listeners>-->
<filter> <php>
<whitelist processUncoveredFilesFromWhitelist="true"> <env name="PHPUNIT_PRETTY_PRINT_PROGRESS" value="true"/>
<directory suffix=".php">./app</directory> <ini name="error_reporting" value="E_ALL"/>
</whitelist> <ini name="display_errors" value="On"/>
</filter> <ini name="display_startup_errors" value="On"/>
<php> <server name="APP_ENV" value="testing"/>
<env name="PHPUNIT_PRETTY_PRINT_PROGRESS" value="true" /> <server name="APP_KEY" value="base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI="/>
<ini name="error_reporting" value="E_ALL"/> <server name="APP_DEBUG" value="true"/>
<ini name="display_errors" value="On"/> <server name="APP_LOG_LEVEL" value="error"/>
<ini name="display_startup_errors" value="On"/> <server name="APP_URL" value="http://localhost"/>
<server name="APP_ENV" value="testing"/> <server name="BCRYPT_ROUNDS" value="4"/>
<server name="APP_KEY" value="base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI="/> <server name="CACHE_DRIVER" value="array"/>
<server name="APP_DEBUG" value="true"/> <server name="DB_CONNECTION" value="memory"/>
<server name="APP_LOG_LEVEL" value="error"/> <server name="DB_PREFIX" value="vmstest_"/>
<server name="BCRYPT_ROUNDS" value="4"/> <server name="MAIL_MAILER" value="array"/>
<server name="CACHE_DRIVER" value="array"/> <server name="QUEUE_DRIVER" value="sync"/>
<server name="DB_CONNECTION" value="memory"/> <server name="SESSION_DRIVER" value="array"/>
<server name="DB_PREFIX" value="vmstest_"/> <server name="TELESCOPE_ENABLED" value="false"/>
<server name="MAIL_MAILER" value="array"/> <server name="APP_CONFIG_CACHE" value="bootstrap/cache/config.phpunit.php"/>
<server name="QUEUE_DRIVER" value="sync"/> <server name="APP_SERVICES_CACHE" value="bootstrap/cache/services.phpunit.php"/>
<server name="SESSION_DRIVER" value="array"/> <server name="APP_PACKAGES_CACHE" value="bootstrap/cache/packages.phpunit.php"/>
<server name="TELESCOPE_ENABLED" value="false"/> <server name="APP_ROUTES_CACHE" value="bootstrap/cache/routes.phpunit.php"/>
<server name="APP_CONFIG_CACHE" value="bootstrap/cache/config.phpunit.php"/> <server name="APP_EVENTS_CACHE" value="bootstrap/cache/events.phpunit.php"/>
<server name="APP_SERVICES_CACHE" value="bootstrap/cache/services.phpunit.php"/> </php>
<server name="APP_PACKAGES_CACHE" value="bootstrap/cache/packages.phpunit.php"/>
<server name="APP_ROUTES_CACHE" value="bootstrap/cache/routes.phpunit.php"/>
<server name="APP_EVENTS_CACHE" value="bootstrap/cache/events.phpunit.php"/>
</php>
</phpunit> </phpunit>

View File

@ -1,3 +1,8 @@
<?php exit(); ?> #
# THIS FILE MUST BE KEPT SECRET! IT IS BLOCKED IN THE HTACCESS FILE
# HOWEVER, THIS DIRECTORY SHOULDN'T BE EXPOSED TO THE PUBLIC AT ALL
# SEE THE DOCS FOR PROPER (SECURE) INSTALLATION:
# https://docs.phpvms.net/installation/uploading
#
APP_KEY=base64:$APP_KEY$ APP_KEY=base64:$APP_KEY$

File diff suppressed because it is too large Load Diff

View File

@ -141,10 +141,11 @@ class SimBriefTest extends TestCase
$this->assertEquals($briefing->id, $flight['simbrief']['id']); $this->assertEquals($briefing->id, $flight['simbrief']['id']);
$url = str_replace('http://', 'https://', $flight['simbrief']['url']); $url = str_replace('http://', 'https://', $flight['simbrief']['url']);
$this->assertEquals( /*$this->assertEquals(
'https://localhost/api/flights/'.$briefing->id.'/briefing', 'https://localhost/api/flights/'.$briefing->id.'/briefing',
$url $url
); );*/
$this->assertTrue(str_ends_with($url, $briefing->id.'/briefing'));
// Retrieve the briefing via API, and then check the doctype // Retrieve the briefing via API, and then check the doctype
$response = $this->get('/api/flights/'.$briefing->id.'/briefing', [], $this->user); $response = $this->get('/api/flights/'.$briefing->id.'/briefing', [], $this->user);