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_KEY="base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY="
APP_URL="http://localhost"

View File

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

View File

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

View File

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

View File

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

View File

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

2559
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

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

View File

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

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$

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']);
$url = str_replace('http://', 'https://', $flight['simbrief']['url']);
$this->assertEquals(
/*$this->assertEquals(
'https://localhost/api/flights/'.$briefing->id.'/briefing',
$url
);
);*/
$this->assertTrue(str_ends_with($url, $briefing->id.'/briefing'));
// Retrieve the briefing via API, and then check the doctype
$response = $this->get('/api/flights/'.$briefing->id.'/briefing', [], $this->user);