Skip to content

Commit 8c27dd4

Browse files
minor symfony#25302 [DependencyInjection] Add tests to symfony#25264 (Jean85)
This PR was merged into the 3.4 branch. Discussion ---------- [DependencyInjection] Add tests to symfony#25264 | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | adds tests for symfony#25264 | License | MIT As asked by @nicolas-grekas in symfony#25253 (comment), I've added a test about his PR symfony#25264. Commits ------- 93441c1 Add test case for symfony#25264
2 parents 5b8cf03 + 93441c1 commit 8c27dd4

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,16 @@ public function testReplacingAPreDefinedServiceIsDeprecated()
538538

539539
$this->assertSame($bar, $c->get('bar'), '->set() replaces a pre-defined service');
540540
}
541+
542+
/**
543+
* @group legacy
544+
* @expectedDeprecation The "synthetic" service is private, replacing it is deprecated since Symfony 3.2 and will fail in 4.0.
545+
*/
546+
public function testSetWithPrivateSyntheticServiceThrowsDeprecation()
547+
{
548+
$c = new ProjectServiceContainer();
549+
$c->set('synthetic', new \stdClass());
550+
}
541551
}
542552

543553
class ProjectServiceContainer extends Container
@@ -565,8 +575,12 @@ public function __construct()
565575
$this->__foo_bar = new \stdClass();
566576
$this->__foo_baz = new \stdClass();
567577
$this->__internal = new \stdClass();
568-
$this->privates = array('internal' => true);
578+
$this->privates = array(
579+
'internal' => true,
580+
'synthetic' => true,
581+
);
569582
$this->aliases = array('alias' => 'bar');
583+
$this->syntheticIds['synthetic'] = true;
570584
}
571585

572586
protected function getInternalService()

0 commit comments

Comments
 (0)