$container->
registerExtension($ext =
new EnvExtension());
$container->
prependExtensionConfig('env_extension',
$expected =
[ 'scalar_node' => '%env(NULLED)%',
'scalar_node_not_empty' => '%env(FLOATISH)%',
'int_node' => '%env(int:FOO)%',
'float_node' => '%env(float:BAR)%',
'string_node' => '%env(UNDEFINED)%',
]);
$this->
doProcess($container);
$this->
assertSame($expected,
$container->
resolveEnvPlaceholders($ext->
getConfig()));
} public function testDefaultEnvIsValidatedInConfig() { $this->
expectException(InvalidConfigurationException::
class);
$this->
expectExceptionMessage('Invalid configuration for path "env_extension.string_node": "fail" is not a valid string'
);
$container =
new ContainerBuilder();
$container->
setParameter('env(STRING)', 'fail'
);
$container->
registerExtension($ext =
new EnvExtension());
$container->
prependExtensionConfig('env_extension',
$expected =
[ 'string_node' => '%env(STRING)%',
]);