mirror of
https://github.com/Kovah/LinkAce.git
synced 2025-04-21 23:42:10 +02:00
Adjust tests and remove broken user migration
This commit is contained in:
parent
516e6f1919
commit
df0373de8b
@ -10,6 +10,7 @@ use App\Models\User;
|
||||
use App\Settings\SystemSettings;
|
||||
use App\Settings\UserSettings;
|
||||
use Database\Seeders\RolesAndPermissionsSeeder;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use Laravel\Sanctum\SanctumServiceProvider;
|
||||
@ -266,34 +267,4 @@ class UserDataMigrationTest extends TestCase
|
||||
'visibility' => 1, // is public
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_user_api_token_migration(): void
|
||||
{
|
||||
$this->migrateUpTo('2022_06_23_112431_migrate_user_data.php');
|
||||
|
||||
DB::table('users')->insert([
|
||||
'name' => 'test',
|
||||
'email' => 'test@linkace.org',
|
||||
'password' => 'test',
|
||||
'api_token' => 'testApiToken',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
$this->artisan('migrate');
|
||||
|
||||
$this->assertDatabaseHas('personal_access_tokens', [
|
||||
'tokenable_type' => 'App\Models\User',
|
||||
'tokenable_id' => '1',
|
||||
'name' => 'MigratedApiToken',
|
||||
'abilities' => '["user_access"]',
|
||||
]);
|
||||
|
||||
// Test if the token is valid
|
||||
Link::factory()->create(['url' => 'https://token-test.com']);
|
||||
|
||||
$this->get('links/feed', [
|
||||
'Authorization' => 'Bearer testApiToken'
|
||||
])->assertOk()->assertSee('https://token-test.com');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user