|
12 | 12 | namespace Symfony\Component\DependencyInjection\Tests\Compiler;
|
13 | 13 |
|
14 | 14 | use PHPUnit\Framework\TestCase;
|
| 15 | +use Symfony\Component\Config\Definition\Builder\ParentNodeDefinitionInterface; |
15 | 16 | use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
16 | 17 | use Symfony\Component\Config\Definition\ConfigurationInterface;
|
17 | 18 | use Symfony\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 | public function testEmptyEnvWhichCannotBeEmptyForScalarNodeWithValidation(): void
|
238 | 237 | {
|
| 238 | + if (!method_exists(ParentNodeDefinitionInterface::class, 'getChildNodeDefinitions')) { |
| 239 | + $this->markTestSkipped('symfony/config >=5.0 is required.'); |
| 240 | + } |
| 241 | + |
239 | 242 | $container = new ContainerBuilder();
|
240 | 243 | $container->registerExtension($ext = new EnvExtension());
|
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 | public function testPartialEnvWhichCannotBeEmptyForScalarNode(): void
|
|
0 commit comments