Skip to content

Commit

Permalink
Adjust tests and remove broken user migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Kovah committed Feb 15, 2025
1 parent 516e6f1 commit df0373d
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions tests/Migrations/UserDataMigrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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;
Expand Down Expand Up @@ -266,34 +267,4 @@ public function test_note_visibility_migration_with_enabled_guest_mode(): void
'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' => '[email protected]',
'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');
}
}

0 comments on commit df0373d

Please sign in to comment.