Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8b6feec

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

File tree

Expand file treeCollapse file tree

1 file changed

+16
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
+16-1Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.