|
12 | 12 | namespace Symfony\Component\Config\Tests\Definition\Builder; |
13 | 13 |
|
14 | 14 | use PHPUnit\Framework\Attributes\DataProvider; |
15 | | -use PHPUnit\Framework\Attributes\Group; |
16 | | -use PHPUnit\Framework\Attributes\IgnoreDeprecations; |
17 | 15 | use PHPUnit\Framework\TestCase; |
18 | 16 | use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
19 | 17 | use Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition; |
@@ -76,32 +74,26 @@ public function testUnknownPackageThrowsException() |
76 | 74 | $node->docUrl('https://example.com/doc/{package}/{version:major}.{version:minor}', 'phpunit/invalid'); |
77 | 75 | } |
78 | 76 |
|
79 | | - #[IgnoreDeprecations] |
80 | | - #[Group('legacy')] |
81 | 77 | #[DataProvider('provideDefinitionClassesAndDefaultValues')] |
82 | 78 | public function testIncoherentRequiredAndDefaultValue(string $class, mixed $defaultValue) |
83 | 79 | { |
84 | 80 | $node = new $class('foo'); |
85 | 81 | self::assertInstanceOf(NodeDefinition::class, $node); |
86 | 82 |
|
87 | | - // $this->expectException(InvalidDefinitionException::class); |
88 | | - // $this->expectExceptionMessage('The node "foo" cannot be required and have a default value.'); |
89 | | - $this->expectUserDeprecationMessage('Since symfony/config 7.4: Flagging a node with a default value as required is deprecated. Remove the default from node "foo" or make it optional.'); |
| 83 | + $this->expectException(InvalidDefinitionException::class); |
| 84 | + $this->expectExceptionMessage('The node "foo" cannot be required and have a default value.'); |
90 | 85 |
|
91 | 86 | $node->defaultValue($defaultValue)->isRequired(); |
92 | 87 | } |
93 | 88 |
|
94 | | - #[IgnoreDeprecations] |
95 | | - #[Group('legacy')] |
96 | 89 | #[DataProvider('provideDefinitionClassesAndDefaultValues')] |
97 | 90 | public function testIncoherentDefaultValueAndRequired(string $class, mixed $defaultValue) |
98 | 91 | { |
99 | 92 | $node = new $class('foo'); |
100 | 93 | self::assertInstanceOf(NodeDefinition::class, $node); |
101 | 94 |
|
102 | | - // $this->expectException(InvalidDefinitionException::class); |
103 | | - // $this->expectExceptionMessage('The node "foo" cannot be required and have a default value.'); |
104 | | - $this->expectUserDeprecationMessage('Since symfony/config 7.4: Setting a default value to a required node is deprecated. Remove the default value from the node "foo" or make it optional.'); |
| 95 | + $this->expectException(InvalidDefinitionException::class); |
| 96 | + $this->expectExceptionMessage('The node "foo" cannot be required and have a default value.'); |
105 | 97 |
|
106 | 98 | $node->isRequired()->defaultValue($defaultValue); |
107 | 99 | } |
|
0 commit comments