TenantAtlas/tests/Unit/TenantResourceConsentUrlTest.php
Ahmed Darrazi 58e6a4e980 feat(settings-catalog): Add category display and definition caching
- Add SettingsCatalogCategoryResolver service with 3-tier caching
- Add SettingsCatalogCategory model and migration
- Add warm-cache commands for definitions and categories
- Update PolicyNormalizer to display categories in settings table
- Fix extraction of nested children in choiceSettingValue
- Add category inheritance from parent settings
- Skip template IDs with {tenantid} placeholder in Graph API calls
- Update Livewire table with Category, Data Type, and Description columns

Related tests updated and passing.
2025-12-21 00:40:20 +01:00

32 lines
1.1 KiB
PHP

<?php
use App\Filament\Resources\TenantResource;
use App\Models\Tenant;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
uses(TestCase::class, RefreshDatabase::class);
it('includes scope parameter in admin consent url', function () {
// The adminConsentUrl builds scopes from intune_permissions config, not graph.scope
$tenant = Tenant::create([
'tenant_id' => 'b0091e5d-944f-4a34-bcd9-12cbfb7b75cf',
'name' => 'Test Tenant',
'app_client_id' => 'client-id',
]);
$url = TenantResource::adminConsentUrl($tenant);
expect($url)->toContain('scope=');
// Should contain permissions from intune_permissions config
$requiredPermissions = config('intune_permissions.permissions', []);
if (! empty($requiredPermissions)) {
$firstPermission = $requiredPermissions[0]['key'];
expect($url)->toContain(urlencode("https://graph.microsoft.com/{$firstPermission}"));
} else {
// Fallback to .default if no permissions configured
expect($url)->toContain(urlencode('https://graph.microsoft.com/.default'));
}
});