8000 Add test case for #25264 · Jean85/symfony@93441c1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 93441c1

Browse files
committed
Add test case for symfony#25264
1 parent 5b8cf03 commit 93441c1

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)
0