Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit98c25dd

Browse files
committed
[DI][5.0] Fix suspicious test
1 parente33ee9d commit98c25dd

File tree

4 files changed

+2
-70
lines changed

4 files changed

+2
-70
lines changed

‎src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespaceSymfony\Component\Config\Definition\Builder;
1313

14-
useSymfony\Component\Config\Definition\Exception\TreeWithoutRootNodeException;
1514
useSymfony\Component\Config\Definition\NodeInterface;
1615

1716
/**
@@ -35,10 +34,6 @@ public function __construct(string $name, string $type = 'array', NodeBuilder $b
3534
*/
3635
publicfunctiongetRootNode():NodeDefinition
3736
{
38-
if (null ===$this->root) {
39-
thrownew \RuntimeException(sprintf('Calling %s() before creating the root node is not supported, migrate to the new constructor signature instead.',__METHOD__));
40-
}
41-
4237
return$this->root;
4338
}
4439

@@ -51,7 +46,6 @@ public function getRootNode(): NodeDefinition
5146
*/
5247
publicfunctionbuildTree()
5348
{
54-
$this->assertTreeHasRootNode();
5549
if (null !==$this->tree) {
5650
return$this->tree;
5751
}
@@ -61,21 +55,9 @@ public function buildTree()
6155

6256
publicfunctionsetPathSeparator(string$separator)
6357
{
64-
$this->assertTreeHasRootNode();
65-
6658
// unset last built as changing path separator changes all nodes
6759
$this->tree =null;
6860

6961
$this->root->setPathSeparator($separator);
7062
}
71-
72-
/**
73-
* @throws \RuntimeException if root node is not defined
74-
*/
75-
privatefunctionassertTreeHasRootNode()
76-
{
77-
if (null ===$this->root) {
78-
thrownewTreeWithoutRootNodeException('The configuration tree has no root node.');
79-
}
80-
}
8163
}

‎src/Symfony/Component/Config/Definition/Exception/TreeWithoutRootNodeException.php‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎src/Symfony/Component/DependencyInjection/Compiler/ValidateEnvPlaceholdersPass.php‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespaceSymfony\Component\DependencyInjection\Compiler;
1313

1414
useSymfony\Component\Config\Definition\BaseNode;
15-
useSymfony\Component\Config\Definition\Exception\TreeWithoutRootNodeException;
1615
useSymfony\Component\Config\Definition\Processor;
1716
useSymfony\Component\DependencyInjection\ContainerBuilder;
1817
useSymfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface;
@@ -80,10 +79,7 @@ public function process(ContainerBuilder $container)
8079
continue;
8180
}
8281

83-
try {
84-
$this->extensionConfig[$name] =$processor->processConfiguration($configuration,$config);
85-
}catch (TreeWithoutRootNodeException$e) {
86-
}
82+
$this->extensionConfig[$name] =$processor->processConfiguration($configuration,$config);
8783
}
8884
}finally {
8985
BaseNode::resetPlaceholders();

‎src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php‎

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
usePHPUnit\Framework\TestCase;
1515
useSymfony\Component\Config\Definition\Builder\TreeBuilder;
1616
useSymfony\Component\Config\Definition\ConfigurationInterface;
17-
useSymfony\Component\Config\Definition\Exception\TreeWithoutRootNodeException;
1817
useSymfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass;
1918
useSymfony\Component\DependencyInjection\Compiler\RegisterEnvVarProcessorsPass;
2019
useSymfony\Component\DependencyInjection\Compiler\ValidateEnvPlaceholdersPass;
@@ -274,20 +273,6 @@ public function testEnvWithVariableNode(): void
274273
$this->assertSame($expected,$container->resolveEnvPlaceholders($ext->getConfig()));
275274
}
276275

277-
/**
278-
* @group legacy
279-
*/
280-
publicfunctiontestConfigurationWithoutRootNode():void
281-
{
282-
$container =newContainerBuilder();
283-
$container->registerExtension(newEnvExtension(newEnvConfigurationWithoutRootNode()));
284-
$container->loadFromExtension('env_extension');
285-
286-
$this->doProcess($container);
287-
288-
$this->addToAssertionCount(1);
289-
}
290-
291276
publicfunctiontestEmptyConfigFromMoreThanOneSource()
292277
{
293278
$container =newContainerBuilder();
@@ -386,14 +371,6 @@ public function getConfigTreeBuilder()
386371
}
387372
}
388373

389-
class EnvConfigurationWithoutRootNodeimplements ConfigurationInterface
390-
{
391-
publicfunctiongetConfigTreeBuilder()
392-
{
393-
returnnewTreeBuilder('env_extension');
394-
}
395-
}
396-
397374
class ConfigurationWithArrayNodeRequiringOneElementimplements ConfigurationInterface
398375
{
399376
publicfunctiongetConfigTreeBuilder()
@@ -438,11 +415,7 @@ public function load(array $configs, ContainerBuilder $container)
438415
return;
439416
}
440417

441-
try {
442-
$this->config =$this->processConfiguration($this->getConfiguration($configs,$container),$configs);
443-
}catch (TreeWithoutRootNodeException$e) {
444-
$this->config =null;
445-
}
418+
$this->config =$this->processConfiguration($this->getConfiguration($configs,$container),$configs);
446419
}
447420

448421
publicfunctiongetConfig()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp