|
4 | 4 |
|
5 | 5 | use Illuminate\Auth\EloquentUserProvider;
|
6 | 6 | use Illuminate\Database\Schema\Blueprint;
|
| 7 | +use Illuminate\Foundation\Testing\RefreshDatabase; |
7 | 8 | use Illuminate\Support\Facades\Schema;
|
8 | 9 | use LdapRecord\Laravel\Auth\DatabaseUserProvider;
|
9 | 10 | use LdapRecord\Laravel\Import\UserSynchronizer;
|
|
13 | 14 | use LdapRecord\Models\ActiveDirectory\User;
|
14 | 15 | use LdapRecord\Models\Model;
|
15 | 16 | use Mockery as m;
|
| 17 | +use Orchestra\Testbench\Attributes\WithMigration; |
16 | 18 |
|
| 19 | +#[WithMigration] |
17 | 20 | class DatabaseTestCase extends TestCase
|
18 | 21 | {
|
| 22 | + use RefreshDatabase; |
| 23 | + |
19 | 24 | protected function setUp(): void
|
20 | 25 | {
|
21 | 26 | parent::setUp();
|
22 | 27 |
|
23 |
| - $this->createUsersTable(); |
| 28 | + Schema::table('users', function (Blueprint $table) { |
| 29 | + $table->softDeletes(); |
| 30 | + }); |
24 | 31 | }
|
25 | 32 |
|
26 |
| - protected function createUsersTable() |
| 33 | + protected function defineDatabaseMigrations() |
27 | 34 | {
|
28 |
| - // Setup the users database table. |
29 |
| - Schema::create('users', function (Blueprint $table) { |
30 |
| - $table->bigIncrements('id'); |
31 |
| - $table->string('name'); |
32 |
| - $table->string('email')->unique(); |
33 |
| - $table->timestamp('email_verified_at')->nullable(); |
34 |
| - $table->string('password'); |
35 |
| - $table->rememberToken(); |
36 |
| - $table->timestamps(); |
37 |
| - $table->softDeletes(); |
38 |
| - |
39 |
| - // Additional fields for LdapRecord. |
40 |
| - $table->string('guid')->unique()->nullable(); |
41 |
| - $table->string('domain')->nullable(); |
42 |
| - }); |
| 35 | + $this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); |
| 36 | + $this->loadMigrationsFrom(__DIR__.'/../../vendor/laravel/sanctum/database/migrations'); |
43 | 37 | }
|
44 | 38 |
|
45 | 39 | protected function getMockLdapModel(array $attributes = [])
|
|
0 commit comments