|
22 | 22 |
|
23 | 23 | class ValidateEnvPlaceholdersPassTest extends TestCase |
24 | 24 | { |
25 | | - /** |
26 | | - * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException |
27 | | - * @expectedExceptionMessage Invalid type for env parameter "env(FOO)". Expected "string", but got "bool". |
28 | | - */ |
29 | | - public function testDefaultEnvIsValidatedByType() |
| 25 | + public function testEnvsAreValidatedInConfig() |
30 | 26 | { |
31 | 27 | $container = new ContainerBuilder(); |
32 | | - $container->setParameter('env(FOO)', true); |
33 | | - $container->registerExtension(new EnvExtension()); |
34 | | - $container->prependExtensionConfig('env_extension', array( |
35 | | - 'scalar_node' => '%env(FOO)%', |
| 28 | + $container->setParameter('env(NULLED)', null); |
| 29 | + $container->setParameter('env(FLOATISH)', 3.2); |
| 30 | + $container->registerExtension($ext = new EnvExtension()); |
| 31 | + $container->prependExtensionConfig('env_extension', $expected = array( |
| 32 | + 'scalar_node' => '%env(NULLED)%', |
| 33 | + 'scalar_node_not_empty' => '%env(FLOATISH)%', |
| 34 | + 'int_node' => '%env(int:FOO)%', |
| 35 | + 'float_node' => '%env(float:BAR)%', |
36 | 36 | )); |
37 | 37 |
|
38 | 38 | $this->doProcess($container); |
| 39 | + |
| 40 | + $this->assertSame($expected, $container->resolveEnvPlaceholders($ext->getConfig())); |
39 | 41 | } |
40 | 42 |
|
41 | | - public function testEnvsAreValidatedInConfig() |
| 43 | + public function testDefaultEnvWithoutPrefixIsValidatedInConfig() |
42 | 44 | { |
43 | 45 | $container = new ContainerBuilder(); |
44 | | - $container->setParameter('env(NULLED)', null); |
| 46 | + $container->setParameter('env(FLOATISH)', 3.2); |
45 | 47 | $container->registerExtension($ext = new EnvExtension()); |
46 | 48 | $container->prependExtensionConfig('env_extension', $expected = array( |
47 | | - 'scalar_node' => '%env(NULLED)%', |
48 | | - 'int_node' => '%env(int:FOO)%', |
49 | | - 'float_node' => '%env(float:BAR)%', |
| 49 | + 'float_node' => '%env(FLOATISH)%', |
50 | 50 | )); |
51 | 51 |
|
52 | 52 | $this->doProcess($container); |
|
0 commit comments