set('database.default', 'sandbox'); $config->set('database.connections', ['sandbox' => [ 'driver' => 'sqlite', 'database' => $directory.'/db.sqlite', 'prefix' => '', 'foreign_key_constraints' => true, ]]); $config->set('database.redis', []); $config->set('mail.default', 'array'); $config->set('mail.mailers', ['array' => ['transport' => 'array']]); $config->set('mail.from', ['address' => 'tester@sandbox.invalid', 'name' => 'Prozess-Tester']); $config->set('fewo.mail_redirect_to', null); $config->set('cache.default', 'array'); $config->set('cache.stores', ['array' => ['driver' => 'array', 'serialize' => false]]); $config->set('session.driver', 'array'); $config->set('queue.default', 'sync'); $config->set('queue.connections', ['sync' => ['driver' => 'sync']]); $config->set('queue.failed', ['driver' => 'null']); $files = $directory.'/files'; $config->set('filesystems.default', 'local'); $config->set('filesystems.disks', [ 'local' => ['driver' => 'local', 'root' => $files.'/private', 'throw' => true], 'private' => ['driver' => 'local', 'root' => $files.'/private', 'throw' => true], 'public' => ['driver' => 'local', 'root' => $files.'/public', 'throw' => true], 'media' => ['driver' => 'local', 'root' => $files.'/media', 'throw' => true], ]); $config->set('logging.default', 'sandbox'); $config->set('logging.channels', [ 'sandbox' => ['driver' => 'single', 'path' => $directory.'/log.txt', 'level' => 'debug'], 'null' => ['driver' => 'monolog', 'handler' => NullHandler::class], 'emergency' => ['path' => $directory.'/log.txt'], ]); $config->set('app.key', 'base64:'.base64_encode(random_bytes(32))); $config->set('app.previous_keys', []); // Secrets and outside services: blank. The scripted answers of the scenario replace them. foreach (['services', 'fewo.mailbox', 'fewo.automation', 'fewo.llm'] as $key) { if (is_array($config->get($key))) { $config->set($key, array_map(fn (mixed $value): mixed => is_array($value) ? [] : null, (array) $config->get($key))); } } $config->set('sandbox', ['run' => $run, 'directory' => $directory, 'probe' => self::probe($app)]); // Registered after every framework provider, so its bindings replace the managers before anything resolves them. $config->set('app.providers', [...($config->get('app.providers') ?? ServiceProvider::defaultProviders()->toArray()), SandboxServiceProvider::class]); } /** * A probe that deliberately tries forbidden accesses – only for the negative tests of the test suite. */ private static function probe(Application $app): ?string { $probe = getenv('FEWO_SANDBOX_PROBE') ?: null; return $probe !== null && $app->environment('testing') && class_exists($probe) ? $probe : null; } }