Skip to content

Commit f8a9400

Browse files
outdooracorndati18rosalieper
authored
Update laravel/passport from v11.10.6 to v12.4.3 (#1112)
Update composer packages with this command: ``` docker run --rm -it -v $PWD:/app -u $(id -u):$(id -g) composer:2.9.2 \ --ignore-platform-req=ext-pcntl \ --with-all-dependencies \ require \ laravel/passport:^12.4 \ firebase/php-jwt:^7.0 \ absszero/laravel-stackdriver-error-reporting ``` Add Passport's migrations to the `database/migrations` dir with `docker compose exec api php artisan vendor:publish --tag=passport-migrations` [1]. Fix `LoginTest::testLoginSuccess()` by using `Artisan::call()` instead of `$this->artisan()` in the `setUp()` method. Add `--no-interaction` to `php artisan passport:install` commands in the Makefile and README. [1]: https://github.com/laravel/passport/blob/12.x/UPGRADE.md#upgrading-to-120-from-11x Bug: T424471 Co-authored-by: Dat <dat.nguyen@wikimedia.de> Co-authored-by: Perside Rosalie <perside.rosalie@wikimedia.de>
1 parent 917003e commit f8a9400

10 files changed

Lines changed: 590 additions & 409 deletions

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test:
66
docker compose exec api bash -c 'LOG_CHANNEL=stderr LOG_LEVEL=debug vendor/bin/phpunit ${FILTER}'
77

88
init:
9-
docker compose exec api bash -c 'php artisan migrate:fresh && php artisan passport:install && php artisan key:generate'
9+
docker compose exec api bash -c 'php artisan migrate:fresh && php artisan passport:install --no-interaction && php artisan key:generate'
1010

1111
test-fresh: init test
1212

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ docker compose down --volumes
5050
Run everything in one go:
5151

5252
```sh
53-
docker compose exec api bash -c 'php artisan migrate:fresh && php artisan passport:install && php artisan db:seed && php artisan key:generate && php artisan storage:link'
53+
docker compose exec api bash -c 'php artisan migrate:fresh && php artisan passport:install --no-interaction && php artisan db:seed && php artisan key:generate && php artisan storage:link'
5454
```
5555

5656
Or each command separately:
@@ -60,7 +60,7 @@ Or each command separately:
6060
docker compose exec api php artisan migrate:fresh
6161

6262
# Create some certs needed for authentication (passport is a laravel plugin)
63-
docker compose exec api php artisan passport:install
63+
docker compose exec api php artisan passport:install --no-interaction
6464

6565
# Seed some useful development data
6666
docker compose exec api php artisan db:seed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
"license": "MIT",
99
"type": "project",
1010
"require": {
11-
"absszero/laravel-stackdriver-error-reporting": "^1.7",
11+
"absszero/laravel-stackdriver-error-reporting": "^1.9",
1212
"doctrine/dbal": "^3.1",
13-
"firebase/php-jwt": "^6.10",
13+
"firebase/php-jwt": "^7.0",
1414
"google/recaptcha": "^1.2",
1515
"guzzlehttp/guzzle": "^7.8",
1616
"guzzlehttp/psr7": "^2.9",
1717
"hackzilla/password-generator": "^1.6",
1818
"intervention/image": "^2.5",
1919
"laravel/framework": "^10.10",
2020
"laravel/horizon": "^5.23",
21-
"laravel/passport": "^11.0",
21+
"laravel/passport": "^12.4",
2222
"laravel/tinker": "^3.0",
2323
"laravel/ui": "^4.4",
2424
"lcobucci/jwt": "^5.6",

composer.lock

Lines changed: 441 additions & 402 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration {
8+
/**
9+
* Run the migrations.
10+
*/
11+
public function up(): void {
12+
Schema::create('oauth_auth_codes', function (Blueprint $table) {
13+
$table->string('id', 100)->primary();
14+
$table->unsignedBigInteger('user_id')->index();
15+
$table->unsignedBigInteger('client_id');
16+
$table->text('scopes')->nullable();
17+
$table->boolean('revoked');
18+
$table->dateTime('expires_at')->nullable();
19+
});
20+
}
21+
22+
/**
23+
* Reverse the migrations.
24+
*/
25+
public function down(): void {
26+
Schema::dropIfExists('oauth_auth_codes');
27+
}
28+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration {
8+
/**
9+
* Run the migrations.
10+
*/
11+
public function up(): void {
12+
Schema::create('oauth_access_tokens', function (Blueprint $table) {
13+
$table->string('id', 100)->primary();
14+
$table->unsignedBigInteger('user_id')->nullable()->index();
15+
$table->unsignedBigInteger('client_id');
16+
$table->string('name')->nullable();
17+
$table->text('scopes')->nullable();
18+
$table->boolean('revoked');
19+
$table->timestamps();
20+
$table->dateTime('expires_at')->nullable();
21+
});
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*/
27+
public function down(): void {
28+
Schema::dropIfExists('oauth_access_tokens');
29+
}
30+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration {
8+
/**
9+
* Run the migrations.
10+
*/
11+
public function up(): void {
12+
Schema::create('oauth_refresh_tokens', function (Blueprint $table) {
13+
$table->string('id', 100)->primary();
14+
$table->string('access_token_id', 100)->index();
15+
$table->boolean('revoked');
16+
$table->dateTime('expires_at')->nullable();
17+
});
18+
}
19+
20+
/**
21+
* Reverse the migrations.
22+
*/
23+
public function down(): void {
24+
Schema::dropIfExists('oauth_refresh_tokens');
25+
}
26+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration {
8+
/**
9+
* Run the migrations.
10+
*/
11+
public function up(): void {
12+
Schema::create('oauth_clients', function (Blueprint $table) {
13+
$table->bigIncrements('id');
14+
$table->unsignedBigInteger('user_id')->nullable()->index();
15+
$table->string('name');
16+
$table->string('secret', 100)->nullable();
17+
$table->string('provider')->nullable();
18+
$table->text('redirect');
19+
$table->boolean('personal_access_client');
20+
$table->boolean('password_client');
21+
$table->boolean('revoked');
22+
$table->timestamps();
23+
});
24+
}
25+
26+
/**
27+
* Reverse the migrations.
28+
*/
29+
public function down(): void {
30+
Schema::dropIfExists('oauth_clients');
31+
}
32+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration {
8+
/**
9+
* Run the migrations.
10+
*/
11+
public function up(): void {
12+
Schema::create('oauth_personal_access_clients', function (Blueprint $table) {
13+
$table->bigIncrements('id');
14+
$table->unsignedBigInteger('client_id');
15+
$table->timestamps();
16+
});
17+
}
18+
19+
/**
20+
* Reverse the migrations.
21+
*/
22+
public function down(): void {
23+
Schema::dropIfExists('oauth_personal_access_clients');
24+
}
25+
};

tests/Routes/Auth/LoginTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use App\User;
66
use Illuminate\Foundation\Testing\DatabaseTransactions;
7+
use Illuminate\Support\Facades\Artisan;
78
use Tests\Routes\Traits\OptionsRequestAllowed;
89
use Tests\TestCase;
910

@@ -15,7 +16,7 @@ class LoginTest extends TestCase {
1516

1617
protected function setUp(): void {
1718
parent::setUp();
18-
$this->artisan('passport:install', ['--no-interaction' => true]);
19+
Artisan::call('passport:install', ['--no-interaction' => true]);
1920
}
2021

2122
public function testLoginFailNoExistingUser() {

0 commit comments

Comments
 (0)