|
12 | 12 | namespaceSymfony\Component\DependencyInjection\Tests\Compiler; |
13 | 13 |
|
14 | 14 | usePHPUnit\Framework\TestCase; |
| 15 | +useSymfony\Component\Config\Definition\Builder\ParentNodeDefinitionInterface; |
15 | 16 | useSymfony\Component\Config\Definition\Builder\TreeBuilder; |
16 | 17 | useSymfony\Component\Config\Definition\ConfigurationInterface; |
17 | 18 | useSymfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass; |
@@ -229,22 +230,22 @@ public function testEmptyEnvWhichCannotBeEmptyForScalarNode(): void |
229 | 230 | } |
230 | 231 |
|
231 | 232 | /** |
232 | | - * NOT LEGACY (test exception in 5.0). |
233 | | - * |
234 | | - * @group legacy |
235 | | - * @expectedDeprecation Setting path "env_extension.scalar_node_not_empty_validated" to an environment variable is deprecated since Symfony 4.3. Remove "cannotBeEmpty()", "validate()" or include a prefix/suffix value instead. |
| 233 | + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException |
| 234 | + * @expectedExceptionMessage The path "env_extension.scalar_node_not_empty_validated" cannot contain an environment variable when empty values are not allowed by definition and are validated. |
236 | 235 | */ |
237 | 236 | publicfunctiontestEmptyEnvWhichCannotBeEmptyForScalarNodeWithValidation():void |
238 | 237 | { |
| 238 | +if (!method_exists(ParentNodeDefinitionInterface::class,'getChildNodeDefinitions')) { |
| 239 | +$this->markTestSkipped('symfony/config >=5.0 is required.'); |
| 240 | + } |
| 241 | + |
239 | 242 | $container =newContainerBuilder(); |
240 | 243 | $container->registerExtension($ext =newEnvExtension()); |
241 | 244 | $container->prependExtensionConfig('env_extension',$expected = [ |
242 | 245 | 'scalar_node_not_empty_validated' =>'%env(SOME)%', |
243 | 246 | ]); |
244 | 247 |
|
245 | 248 | $this->doProcess($container); |
246 | | - |
247 | | -$this->assertSame($expected,$container->resolveEnvPlaceholders($ext->getConfig())); |
248 | 249 | } |
249 | 250 |
|
250 | 251 | publicfunctiontestPartialEnvWhichCannotBeEmptyForScalarNode():void |
|