baseDirectory = sys_get_temp_dir().DIRECTORY_SEPARATOR.'ptero-frontend-config-'.uniqid(); $extensions = $this->baseDirectory.DIRECTORY_SEPARATOR.'extensions'; File::ensureDirectoryExists($extensions.DIRECTORY_SEPARATOR.'config-probe'); File::put($extensions.DIRECTORY_SEPARATOR.'config-probe'.DIRECTORY_SEPARATOR.'extension.json', json_encode([ 'id' => 'config-probe', 'name' => 'Config Probe', 'version' => '1.0.0', 'ui' => ['entry' => 'dist/client.js'], ], JSON_THROW_ON_ERROR)); config(['extensions.enabled' => true, 'extensions.directory' => $extensions, 'extensions.assets_directory' => $this->baseDirectory.DIRECTORY_SEPARATOR.'assets']); Extension::query()->create(['identifier' => 'config-probe', 'version' => '1.0.0', 'enabled' => true]); $repository = $this->app->make(ExtensionRepository::class); $repository->flushDiscovery(); $this->app->make(ExtensionSettingsRegistry::class)->register('config-probe', new ExtensionSettingsDefinition($repository->settings('config-probe'), [ ExtensionSettingDefinition::make('public_note', 'public_note', 'frontend-config-marker', ['required', 'string'])->frontend(), ExtensionSettingDefinition::make('registration', 'registration', 'guest-config-marker', ['required', 'string'])->frontend()->public(), ExtensionSettingDefinition::make('accent', 'accent', '#3b82f6')->color()->frontend()->public(), ExtensionSettingDefinition::make('api_token', 'api_token', 'secret-config-marker')->secret(), ])); }); afterEach(function (): void { $this->app->make(ExtensionRepository::class)->flushDiscovery(); File::deleteDirectory($this->baseDirectory); }); test('guests load extension bundles with only their public frontend settings', function (string $path): void { $this->app->make(ExtensionRepository::class)->settings('config-probe')->set('accent', '#abcdef'); $this->get($path)->assertOk() ->assertSee('"id":"config-probe"', false) ->assertSee('"config":{"registration":"guest-config-marker","accent":"#abcdef"}', false) ->assertDontSee('frontend-config-marker', false) ->assertDontSee('secret-config-marker', false); })->with(['/auth/login', '/']); test('setting values cannot change how the inline bootstrap script is parsed', function (): void { $hostile = '