feat: 增强环境配置与开发服务,支持局域网访问及币种管理
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Database\Seeders\AdminRbacAndUserSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
@@ -23,6 +23,33 @@ test('admin authorization audit passes on the default authorization catalog', fu
|
||||
->assertExitCode(0);
|
||||
});
|
||||
|
||||
test('admin authorization sync can repair registry-backed api resources and pass audit', function (): void {
|
||||
DB::table('admin_api_resources')
|
||||
->where('code', 'admin.currencies.destroy')
|
||||
->delete();
|
||||
|
||||
$this->artisan('lottery:admin-auth-audit')
|
||||
->expectsOutputToContain('admin.currencies.destroy')
|
||||
->assertExitCode(1);
|
||||
|
||||
$this->artisan('lottery:admin-auth-sync --audit')
|
||||
->expectsOutputToContain('Admin authorization synced')
|
||||
->expectsOutputToContain('Admin authorization audit passed.')
|
||||
->assertExitCode(0);
|
||||
|
||||
$resourceId = DB::table('admin_api_resources')
|
||||
->where('code', 'admin.currencies.destroy')
|
||||
->value('id');
|
||||
|
||||
expect($resourceId)->not->toBeNull();
|
||||
|
||||
$bindingCount = DB::table('admin_api_resource_bindings')
|
||||
->where('api_resource_id', (int) $resourceId)
|
||||
->count();
|
||||
|
||||
expect($bindingCount)->toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test('admin authorization audit detects role api resource drift', function (): void {
|
||||
$this->seed(AdminRbacAndUserSeeder::class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user