Skip to content

Commit 05cce01

Browse files
mraheelkhandrbyte
andauthored
add laravel 11 to workflow run tests (#2605)
* add laravel 11 to workflow run tests * Passport 12 * override passport:install --------- Co-authored-by: Chris Brown <[email protected]> Co-authored-by: drbyte <[email protected]>
1 parent eea8090 commit 05cce01

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

.github/workflows/run-tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,22 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
php: [8.3, 8.2, 8.1, 8.0]
13-
laravel: ["^10.0", "^9.0", "^8.12"]
13+
laravel: ["^11.0", "^10.0", "^9.0", "^8.12"]
1414
dependency-version: [prefer-lowest, prefer-stable]
1515
include:
16+
- laravel: "^11.0"
17+
testbench: 9.*
1618
- laravel: "^10.0"
1719
testbench: 8.*
1820
- laravel: "^9.0"
1921
testbench: 7.*
2022
- laravel: "^8.12"
2123
testbench: "^6.23"
2224
exclude:
25+
- laravel: "^11.0"
26+
php: 8.1
27+
- laravel: "^11.0"
28+
php: 8.0
2329
- laravel: "^10.0"
2430
php: 8.0
2531
- laravel: "^8.12"

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"illuminate/database": "^8.12|^9.0|^10.0|^11.0"
3030
},
3131
"require-dev": {
32-
"laravel/passport": "^11.0",
32+
"laravel/passport": "^11.0|^12.0",
3333
"orchestra/testbench": "^6.23|^7.0|^8.0|^9.0",
3434
"phpunit/phpunit": "^9.4|^10.1"
3535
},

src/Guard.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Guard
1313
* Return a collection of guard names suitable for the $model,
1414
* as indicated by the presence of a $guard_name property or a guardName() method on the model.
1515
*
16-
* @param string|Model $model model class object or name
16+
* @param string|Model $model model class object or name
1717
*/
1818
public static function getNames($model): Collection
1919
{
@@ -58,7 +58,7 @@ protected static function getConfigAuthGuards(string $class): Collection
5858
/**
5959
* Lookup a guard name relevant for the $class model and the current user.
6060
*
61-
* @param string|Model $class model class object or name
61+
* @param string|Model $class model class object or name
6262
* @return string guard name
6363
*/
6464
public static function getDefaultName($class): string

tests/TestCase.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,12 @@ protected function setUpPassport($app): void
203203
$app['config']->set('permission.use_passport_client_credentials', true);
204204
$app['config']->set('auth.guards.api', ['driver' => 'passport', 'provider' => 'users']);
205205

206-
$this->artisan('migrate');
207-
$this->artisan('passport:install');
206+
// mimic passport:install (must load migrations using our own call to loadMigrationsFrom() else rollbacks won't occur, and migrations will be left in skeleton directory
207+
$this->artisan('passport:keys');
208+
$this->loadMigrationsFrom(__DIR__.'/../vendor/laravel/passport/database/migrations/');
209+
$provider = in_array('users', array_keys(config('auth.providers'))) ? 'users' : null;
210+
$this->artisan('passport:client', ['--personal' => true, '--name' => config('app.name').' Personal Access Client']);
211+
$this->artisan('passport:client', ['--password' => true, '--name' => config('app.name').' Password Grant Client', '--provider' => $provider]);
208212

209213
$this->testClient = Client::create(['name' => 'Test', 'redirect' => 'https://example.com', 'personal_access_client' => 0, 'password_client' => 0, 'revoked' => 0]);
210214
$this->testClientRole = $app[Role::class]->create(['name' => 'clientRole', 'guard_name' => 'api']);

0 commit comments

Comments
 (0)