From 1e3eb651979eed3a300234af25b43d9dce116a42 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sun, 25 Feb 2024 21:12:23 +0100 Subject: [PATCH] feat: add Laravel 11 support (#152) --- .github/workflows/tests.yml | 6 +++--- composer.json | 8 +++---- phpstan.neon | 2 +- src/Sabre/Server.php | 6 +++--- tests/Authenticated.php | 43 +++++++++++++++++++++++++++++++++++++ tests/FeatureTestCase.php | 34 ----------------------------- 6 files changed, 54 insertions(+), 45 deletions(-) create mode 100644 tests/Authenticated.php diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2e14a10..9b941f7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,11 +24,11 @@ jobs: name: Run tests uses: monicahq/workflows/.github/workflows/library.yml@v2 with: - php-versions: "['8.0', '8.1', '8.2']" - laravel-versions: "['8.*', '9.*', '10.*']" + php-versions: "['8.0', '8.1', '8.2', '8.3']" + laravel-versions: "['8.*', '9.*', '10.*', '11.*']" default-php-version: '8.2' default-laravel-version: '10.*' - matrix-exclude: "[{'php-version': '8.0', 'laravel-version': '10.*'}]" + matrix-exclude: "[{'php-version': '8.0', 'laravel-version': '10.*'},{'php-version': '8.0', 'laravel-version': '11.*'},{'php-version': '8.1', 'laravel-version': '11.*'}]" project: monicahq_laravel-sabre secrets: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/composer.json b/composer.json index 2866434..c44a8da 100644 --- a/composer.json +++ b/composer.json @@ -20,19 +20,19 @@ } ], "require": { - "illuminate/support": "^8.0 || ^9.0 || ^10.0", + "illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0", "sabre/dav": "^4.0", "thecodingmachine/safe": "^2.0" }, "require-dev": { "mockery/mockery": "^1.4", - "nunomaduro/larastan": "^1.0 || ^2.0", + "larastan/larastan": "^1.0 || ^2.0", "ocramius/package-versions": "^1.9 || ^2.0", - "orchestra/testbench": "^6.0 || ^7.0 || ^8.0", + "orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.0", + "phpunit/phpunit": "^9.0 || ^10.0 || ^11.0", "roave/security-advisories": "dev-master", "thecodingmachine/phpstan-safe-rule": "^1.0", "vimeo/psalm": "^4.0 || ^5.6" diff --git a/phpstan.neon b/phpstan.neon index d03548f..70dc63a 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ includes: - - ./vendor/nunomaduro/larastan/extension.neon + - ./vendor/larastan/larastan/extension.neon - ./vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon - ./vendor/phpstan/phpstan-phpunit/extension.neon - ./vendor/phpstan/phpstan-deprecation-rules/rules.neon diff --git a/src/Sabre/Server.php b/src/Sabre/Server.php index 09d223a..7f60799 100644 --- a/src/Sabre/Server.php +++ b/src/Sabre/Server.php @@ -21,7 +21,7 @@ class Server extends SabreServer */ public function __construct($treeOrNode = null) { - if (App::environment('testing')) { + if (App::environment('testing') === true) { $_SERVER['REQUEST_URI'] = $_SERVER['REQUEST_URI'] ?? '/'; $_SERVER['REQUEST_METHOD'] = $_SERVER['REQUEST_METHOD'] ?? 'CLI'; } @@ -32,7 +32,7 @@ public function __construct($treeOrNode = null) $sapi = new Sapi(); $this->sapi = $sapi; - if (! App::environment('production')) { + if (App::environment('production') === false) { $this->debugExceptions = true; } } @@ -54,7 +54,7 @@ public function setRequest(Request $request) // Set Url with trailing slash $this->httpRequest->setUrl($this->fullUrl($request)); - if (App::environment('testing')) { + if (App::environment('testing') === true) { // Testing needs request to be set manually $this->httpRequest->setMethod($request->method()); $this->httpRequest->setBody($request->getContent(true)); diff --git a/tests/Authenticated.php b/tests/Authenticated.php new file mode 100644 index 0000000..dfec18b --- /dev/null +++ b/tests/Authenticated.php @@ -0,0 +1,43 @@ +