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

Skip to content

Commit 8b6feec

Browse files
committed
Add test case for symfony#25264
1 parent 5b8cf03 commit 8b6feec

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\DependencyInjection\Alias;
1616
use Symfony\Component\DependencyInjection\Container;
17+
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718
use Symfony\Component\DependencyInjection\ContainerInterface;
1819
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
1920
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
@@ -538,6 +539,16 @@ public function testReplacingAPreDefinedServiceIsDeprecated()
538539

539540
$this->assertSame($bar, $c->get('bar'), '->set() replaces a pre-defined service');
540541
}
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+
}
541552
}
542553

543554
class ProjectServiceContainer extends Container
@@ -565,8 +576,12 @@ public function __construct()
565576
$this->__foo_bar = new \stdClass();
566577
$this->__foo_baz = new \stdClass();
567578
$this->__internal = new \stdClass();
568-
$this->privates = array('internal' => true);
579+
$this->privates = array(
580+
'internal' => true,
581+
'synthetic' => true,
582+
);
569583
$this->aliases = array('alias' => 'bar');
584+
$this->syntheticIds['synthetic'] = true;
570585
}
571586

572587
protected function getInternalService()

0 commit comments

Comments
 (0)
0