Skip to content

Commit 6f26a3e

Browse files
committed
Remove "prefer-lowest" in test-matrix and include migrations for tests
1 parent 164ffa1 commit 6f26a3e

9 files changed

+201
-6
lines changed

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
fail-fast: true
1111
matrix:
1212
php: [8.2, 8.3]
13-
dependency-version: [prefer-lowest, prefer-stable]
13+
dependency-version: [prefer-stable]
1414

1515
name: P${{ matrix.php }} - ${{ matrix.dependency-version }}
1616

config/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
| If you publish the migrations set this to false.
5353
|
5454
*/
55-
'migrations' => true,
55+
'migrations' => false,
5656
/*
5757
|--------------------------------------------------------------------------
5858
| Settings for email verification

tests/TestCase.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use Laravel\Socialite\SocialiteServiceProvider;
1010
use Nuwave\Lighthouse\LighthouseServiceProvider;
1111
use Orchestra\Testbench\TestCase as Orchestra;
12-
use Illuminate\Support\Facades\Schema;
1312

1413
class TestCase extends Orchestra
1514
{
@@ -79,9 +78,6 @@ public function test_assert_true()
7978
*/
8079
public function createClient()
8180
{
82-
if (! Schema::hasTable('oauth_clients')) {
83-
$this->artisan('vendor:publish --tag=passport-migrations');
84-
}
8581
$this->artisan('migrate');
8682
$client = app(ClientRepository::class)->createPasswordGrantClient(null, 'test', 'http://localhost');
8783
config()->set('lighthouse-graphql-passport.client_id', $client->id);
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class UpdateSocialProviderUsersTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('users', function (Blueprint $table) {
17+
if (! Schema::hasColumn('users', 'avatar')) {
18+
$table->string('avatar')->nullable();
19+
}
20+
});
21+
Schema::create('social_providers', function (Blueprint $table) {
22+
$table->bigIncrements('id');
23+
$table->unsignedBigInteger('user_id');
24+
$table->string('provider')->index();
25+
$table->string('provider_id')->index();
26+
$table->timestamps();
27+
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
28+
});
29+
}
30+
31+
/**
32+
* Reverse the migrations.
33+
*
34+
* @return void
35+
*/
36+
public function down()
37+
{
38+
Schema::table('users', function (Blueprint $table) {
39+
$table->dropColumn('avatar');
40+
});
41+
Schema::dropIfExists('social_providers');
42+
}
43+
}
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+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('oauth_personal_access_clients', function (Blueprint $table) {
15+
$table->bigIncrements('id');
16+
$table->unsignedBigInteger('client_id');
17+
$table->timestamps();
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*/
24+
public function down(): void
25+
{
26+
Schema::dropIfExists('oauth_personal_access_clients');
27+
}
28+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('oauth_auth_codes', function (Blueprint $table) {
15+
$table->string('id', 100)->primary();
16+
$table->unsignedBigInteger('user_id')->index();
17+
$table->unsignedBigInteger('client_id');
18+
$table->text('scopes')->nullable();
19+
$table->boolean('revoked');
20+
$table->dateTime('expires_at')->nullable();
21+
});
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*/
27+
public function down(): void
28+
{
29+
Schema::dropIfExists('oauth_auth_codes');
30+
}
31+
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('oauth_access_tokens', function (Blueprint $table) {
15+
$table->string('id', 100)->primary();
16+
$table->unsignedBigInteger('user_id')->nullable()->index();
17+
$table->unsignedBigInteger('client_id');
18+
$table->string('name')->nullable();
19+
$table->text('scopes')->nullable();
20+
$table->boolean('revoked');
21+
$table->timestamps();
22+
$table->dateTime('expires_at')->nullable();
23+
});
24+
}
25+
26+
/**
27+
* Reverse the migrations.
28+
*/
29+
public function down(): void
30+
{
31+
Schema::dropIfExists('oauth_access_tokens');
32+
}
33+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('oauth_clients', function (Blueprint $table) {
15+
$table->bigIncrements('id');
16+
$table->unsignedBigInteger('user_id')->nullable()->index();
17+
$table->string('name');
18+
$table->string('secret', 100)->nullable();
19+
$table->string('provider')->nullable();
20+
$table->text('redirect');
21+
$table->boolean('personal_access_client');
22+
$table->boolean('password_client');
23+
$table->boolean('revoked');
24+
$table->timestamps();
25+
});
26+
}
27+
28+
/**
29+
* Reverse the migrations.
30+
*/
31+
public function down(): void
32+
{
33+
Schema::dropIfExists('oauth_clients');
34+
}
35+
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('oauth_refresh_tokens', function (Blueprint $table) {
15+
$table->string('id', 100)->primary();
16+
$table->string('access_token_id', 100)->index();
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+
{
27+
Schema::dropIfExists('oauth_refresh_tokens');
28+
}
29+
};

0 commit comments

Comments
 (0)