Skip to content

Commit fcb85cd

Browse files
committed
improve tests
1 parent 5b8f811 commit fcb85cd

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container_deprecated_parameters.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
$container = new ContainerBuilder();
66
$container->setParameter('foo_class', 'FooClass\\Foo');
77
$container->deprecateParameter('foo_class', 'symfony/test', '6.3');
8-
$container
9-
->register('foo', '%foo_class%')
8+
$container->register('foo', '%foo_class%')
109
->setPublic(true)
1110
;
1211

src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php

+16
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,22 @@ public function testDeprecate()
143143
$bag->get('foo');
144144
}
145145

146+
/**
147+
* The test should be kept in the group as it always expects a deprecation.
148+
*
149+
* @group legacy
150+
*/
151+
public function testDeprecateWithMessage()
152+
{
153+
$bag = new ParameterBag(['foo' => 'bar']);
154+
155+
$bag->deprecate('foo', 'symfony/test', '6.3', 'The parameter "%s" is deprecated, use "new_foo" instead.');
156+
157+
$this->expectDeprecation('Since symfony/test 6.3: The parameter "foo" is deprecated, use "new_foo" instead.');
158+
159+
$bag->get('foo');
160+
}
161+
146162
/**
147163
* The test should be kept in the group as it always expects a deprecation.
148164
*

0 commit comments

Comments
 (0)