## Summary - replace the legacy Tenant and TenantMembership core models with ManagedEnvironment and ManagedEnvironmentMembership - propagate the managed environment naming and key changes across Filament resources, pages, controllers, jobs, models, and supporting runtime paths - add feature 279 spec artifacts and focused managed-environment test coverage for model behavior, route binding, panel context, authorization, and legacy guardrails ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/ManagedEnvironment/LegacyTenantCoreGuardTest.php tests/Feature/ManagedEnvironment/ManagedEnvironmentAuthorizationTest.php tests/Feature/ManagedEnvironment/ManagedEnvironmentPanelContextTest.php tests/Feature/ManagedEnvironment/ManagedEnvironmentRouteBindingTest.php tests/Unit/ManagedEnvironment/ManagedEnvironmentContextResolverTest.php tests/Unit/ManagedEnvironment/ManagedEnvironmentModelTest.php` - `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` ## Notes - branch pushed from commit `1123b122` - browser smoke test file was added but not run in this pass Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #335
45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php
|
|
|
|
use App\Services\Graph\GraphContractRegistry;
|
|
use App\Services\Graph\GraphLogger;
|
|
use App\Services\Graph\MicrosoftGraphClient;
|
|
use Illuminate\Http\Client\Request;
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Illuminate\Support\Facades\Config;
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
it('falls back to default graph scope when config is empty', function () {
|
|
Cache::flush();
|
|
|
|
Config::set('graph.scope', '');
|
|
Config::set('graph.managed_environment_id', 'tenant-scope');
|
|
Config::set('graph.client_id', 'client-id');
|
|
Config::set('graph.client_secret', 'client-secret');
|
|
|
|
Http::fake([
|
|
'https://login.microsoftonline.com/*/oauth2/v2.0/token' => Http::response([
|
|
'access_token' => 'token',
|
|
'expires_in' => 3600,
|
|
'token_type' => 'Bearer',
|
|
]),
|
|
'https://graph.microsoft.com/*' => Http::response(['value' => []]),
|
|
]);
|
|
|
|
$client = new MicrosoftGraphClient(
|
|
app(GraphLogger::class),
|
|
app(GraphContractRegistry::class)
|
|
);
|
|
|
|
$client->getOrganization();
|
|
|
|
Http::assertSent(function (Request $request): bool {
|
|
if (! str_contains($request->url(), '/oauth2/v2.0/token')) {
|
|
return false;
|
|
}
|
|
|
|
return $request['scope'] === 'https://graph.microsoft.com/.default'
|
|
&& $request['client_id'] === 'client-id'
|
|
&& $request['grant_type'] === 'client_credentials';
|
|
});
|
|
});
|