|
14 | 14 | use PHPUnit\Framework\TestCase;
|
15 | 15 | use Symfony\Component\DependencyInjection\Alias;
|
16 | 16 | use Symfony\Component\DependencyInjection\Container;
|
| 17 | +use Symfony\Component\DependencyInjection\ContainerBuilder; |
17 | 18 | use Symfony\Component\DependencyInjection\ContainerInterface;
|
18 | 19 | use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
19 | 20 | use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
|
@@ -538,6 +539,16 @@ public function testReplacingAPreDefinedServiceIsDeprecated()
|
538 | 539 |
|
539 | 540 | $this->assertSame($bar, $c->get('bar'), '->set() replaces a pre-defined service');
|
540 | 541 | }
|
| 542 | + |
| 543 | + /** |
| 544 | + * @group legacy |
| 545 | + * @expectedDeprecation The "synthetic" service is private, replacing it is deprecated since Symfony 3.2 and will fail in 4.0. |
| 546 | + */ |
| 547 | + public function testSetWithPrivateSyntheticServiceThrowsDeprecation() |
| 548 | + { |
| 549 | + $c = new ProjectServiceContainer(); |
| 550 | + $c->set('synthetic', new \stdClass()); |
| 551 | + } |
541 | 552 | }
|
542 | 553 |
|
543 | 554 | class ProjectServiceContainer extends Container
|
@@ -565,8 +576,12 @@ public function __construct()
|
565 | 576 | $this->__foo_bar = new \stdClass();
|
566 | 577 | $this->__foo_baz = new \stdClass();
|
567 | 578 | $this->__internal = new \stdClass();
|
568 |
| - $this->privates = array('internal' => true); |
| 579 | + $this->privates = array( |
| 580 | + 'internal' => true, |
| 581 | + 'synthetic' => true, |
| 582 | + ); |
569 | 583 | $this->aliases = array('alias' => 'bar');
|
| 584 | + $this->syntheticIds['synthetic'] = true; |
570 | 585 | }
|
571 | 586 |
|
572 | 587 | protected function getInternalService()
|
|
0 commit comments