Skip to content

Commit

Permalink
feat: add Laravel 11 support (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Feb 25, 2024
1 parent dc8f9aa commit 1e3eb65
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 45 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/Sabre/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand All @@ -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;
}
}
Expand All @@ -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));
Expand Down
43 changes: 43 additions & 0 deletions tests/Authenticated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace LaravelSabre\Tests;

use Illuminate\Contracts\Auth\Authenticatable;

class Authenticated implements Authenticatable
{
public $email;

public function getAuthIdentifierName()
{
return 'Identifier name';
}

public function getAuthIdentifier()
{
return 'auth-identifier';
}

public function getAuthPasswordName()
{
return 'password';
}

public function getAuthPassword()
{
return 'secret';
}

public function getRememberToken()
{
return 'token';
}

public function setRememberToken($value)
{
}

public function getRememberTokenName()
{
}
}
34 changes: 0 additions & 34 deletions tests/FeatureTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace LaravelSabre\Tests;

use Illuminate\Contracts\Auth\Authenticatable;
use LaravelSabre\LaravelSabreServiceProvider;
use Orchestra\Testbench\TestCase;

Expand Down Expand Up @@ -50,36 +49,3 @@ class_alias('\Illuminate\Foundation\Testing\TestResponse', '\Illuminate\Testing\
}
}
}

class Authenticated implements Authenticatable
{
public $email;

public function getAuthIdentifierName()
{
return 'Identifier name';
}

public function getAuthIdentifier()
{
return 'auth-identifier';
}

public function getAuthPassword()
{
return 'secret';
}

public function getRememberToken()
{
return 'token';
}

public function setRememberToken($value)
{
}

public function getRememberTokenName()
{
}
}

0 comments on commit 1e3eb65

Please sign in to comment.