From a749e8be433dee3da216e886e934519eb35055cd Mon Sep 17 00:00:00 2001 From: Ivan Vermeyen Date: Sun, 12 Mar 2023 14:05:16 +0100 Subject: [PATCH] Drop support for Laravel 5.6, 5.7, 5.8 and 6.x --- .github/workflows/run-tests.yml | 15 --------------- README.md | 6 +++--- UPGRADE.md | 9 +++++++++ composer.json | 8 ++++---- tests/Feature/SetLocaleTest.php | 18 ++---------------- 5 files changed, 18 insertions(+), 38 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 06f9ee9..9e9fd1f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -15,21 +15,6 @@ jobs: - laravel: 10.* php: 8.0 include: - - laravel: 5.6.* - php: 7.1 - testbench: 3.6.* - - laravel: 5.7.* - php: 7.2 - testbench: 3.7.* - - laravel: 5.8.* - php: 7.2 - testbench: 3.8.* - - laravel: 6.* - php: 7.2 - testbench: 4.* - - laravel: 6.* - php: 8.0 - testbench: 4.* - laravel: 7.* php: 7.2 testbench: 5.* diff --git a/README.md b/README.md index a59d5d6..22e5ca9 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ Automatically detect and set an app locale that matches your visitor's preferenc ## ✅ Requirements -- PHP >= 7.1 -- Laravel >= 5.6 +- PHP >= 7.2.5 +- Laravel >= 7.0 ## ⬆️ Upgrade @@ -54,7 +54,7 @@ protected $middlewareGroups = [ ]; ``` -In Laravel 6.x and higher, you also need to add the middleware to the `$middlewarePriority` array in `app/Http/Kernel.php` +You also need to add the middleware to the `$middlewarePriority` array in `app/Http/Kernel.php` to trigger it in the correct order: ```php diff --git a/UPGRADE.md b/UPGRADE.md index 84280d0..8330861 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -2,6 +2,15 @@ ## Upgrading To 2.0 From 1.x +### Minimum Requirements Updated + +We dropped support for Laravel 5.6, 5.7, 5.8 and 6.x. + +- The minimum PHP version required is now 7.2.5 +- The minimum Laravel version required is now 7.0 + +### Names of Config Options Updated + Every config option that contained a `-` (dash) in its name has been updated and the dash is replaced by an `_` (underscore). This is done mainly for consistency across other packages. diff --git a/composer.json b/composer.json index ce3d5f2..daf66fa 100644 --- a/composer.json +++ b/composer.json @@ -21,14 +21,14 @@ } ], "require": { - "php": "^7.1|^8.0", + "php": "^7.2.5|^8.0", "codezero/browser-locale": "^3.0", - "illuminate/support": "^5.6|^6.0|^7.0|^8.0|^9.0|^10.0" + "illuminate/support": "^7.0|^8.0|^9.0|^10.0" }, "require-dev": { "mockery/mockery": "^1.3.3", - "orchestra/testbench": "^3.6|^4.0|^5.0|^6.0|^7.0|^8.0", - "phpunit/phpunit": "^7.0|^8.0|^9.0" + "orchestra/testbench": "^5.0|^6.0|^7.0|^8.0", + "phpunit/phpunit": "^8.0|^9.0" }, "scripts": { "test": "phpunit" diff --git a/tests/Feature/SetLocaleTest.php b/tests/Feature/SetLocaleTest.php index b015324..f3f2729 100644 --- a/tests/Feature/SetLocaleTest.php +++ b/tests/Feature/SetLocaleTest.php @@ -293,7 +293,8 @@ public function it_looks_for_a_locale_in_a_cookie() return App::getLocale(); })->middleware(['web', SetLocale::class]); - $response = $this->getWithCookie('some/route', $cookie); + $response = $this->withCookie($this->cookieName, $cookie) + ->get('some/route'); $response->assertSessionHas($this->sessionKey, 'nl'); $response->assertCookie($this->cookieName, 'nl'); @@ -451,19 +452,4 @@ protected function setBrowserLocales($locales) return $this; } - - /** - * Perform a GET request when the given cookie was previously set. - * - * @param string $url - * @param string $cookie - * - * @return \Illuminate\Testing\TestResponse - */ - protected function getWithCookie($url, $cookie) - { - return version_compare(App::version(), '6.0.0') === -1 - ? $this->call('GET', $url, [], [$this->cookieName => Crypt::encrypt($cookie, false)]) - : $this->withCookie($this->cookieName, $cookie)->get($url); - } }