Some checks failed
lotterLaravel CI / test (push) Has been cancelled
- Updated AGENTS.md to clarify player interface bindings and agent account restrictions. - Improved PlayerAuthLoginController to include captcha verification for player login. - Enhanced AdminPlayerIndexController with permission checks for admin users. - Refactored AdminPlayerStoreController to enforce agent node restrictions for non-super admins. - Introduced new error codes for player authentication failures and updated related services. - Enhanced validation rules for agent profiles to include settlement cycle options. - Improved AdminCaptchaService to support separate scopes for admin and player captcha handling. - Updated various services to ensure proper credit management and settlement processes.
55 lines
1.8 KiB
PHP
55 lines
1.8 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function (): void {
|
|
$this->artisan('lottery:admin-auth-sync')->assertExitCode(0);
|
|
});
|
|
|
|
test('admin authorization audit reports missing api resources for protected routes', function (): void {
|
|
DB::table('admin_api_resources')
|
|
->where('code', 'admin.config.play-versions.index')
|
|
->delete();
|
|
|
|
$this->artisan('lottery:admin-auth-audit')
|
|
->expectsOutputToContain('Admin authorization audit found')
|
|
->expectsOutputToContain('[route_coverage]')
|
|
->assertExitCode(1);
|
|
});
|
|
|
|
test('admin authorization audit passes on the default authorization catalog', function (): void {
|
|
$this->artisan('lottery:admin-auth-audit')
|
|
->expectsOutputToContain('Admin authorization audit passed.')
|
|
->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);
|
|
});
|