diff --git a/src/DI/ConsoleExtension.php b/src/DI/ConsoleExtension.php index 025d2d9..96b65b9 100644 --- a/src/DI/ConsoleExtension.php +++ b/src/DI/ConsoleExtension.php @@ -45,7 +45,7 @@ public function __construct(bool $cliMode = false) public function getConfigSchema(): Schema { return Expect::structure([ - 'url' => Expect::anyOf(Expect::string(), Expect::null()), + 'url' => Expect::anyOf(Expect::string(), Expect::null())->dynamic(), 'name' => Expect::string(), 'version' => Expect::anyOf(Expect::string(), Expect::int(), Expect::float()), 'catchExceptions' => Expect::bool(), diff --git a/tests/cases/DI/ConsoleExtension.phpt b/tests/cases/DI/ConsoleExtension.phpt index 9cd86c8..f4ee053 100644 --- a/tests/cases/DI/ConsoleExtension.phpt +++ b/tests/cases/DI/ConsoleExtension.phpt @@ -187,3 +187,25 @@ test(function (): void { $application = $container->getByType(Application::class); Assert::type(Application::class, $application); }); + +// URL as Dynamic parameter +test(function (): void { + $loader = new ContainerLoader(TEMP_DIR, true); + $class = $loader->load(function (Compiler $compiler): void { + $compiler->setDynamicParameterNames(['url']); + $compiler->addExtension('console', new ConsoleExtension(true)); + $compiler->addExtension('http', new HttpExtension(true)); + $compiler->loadConfig(FileMock::create(' + console: + url: %url% + parameters: + url: https://contributte.org/ + ', 'neon')); + }, [getmypid(), 9]); + + /** @var Container $container */ + $container = new $class(); + + Assert::type(Application::class, $container->getByType(Application::class)); + Assert::equal('https://contributte.org/', (string) $container->getService('http.request')->getUrl()); +});