-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] fixed definition loosing property shared when decorated by a parent definition #16926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DependencyInjection] fixed definition loosing property shared when decorated by a parent definition #16926
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,25 @@ public function testProcessDoesNotCopyScope() | |
$this->assertEquals(ContainerInterface::SCOPE_CONTAINER, $def->getScope()); | ||
} | ||
|
||
public function testProcessDoesNotCopyShared() | ||
{ | ||
$container = new ContainerBuilder(); | ||
|
||
$container | ||
->register('parent') | ||
->setShared(false) | ||
; | ||
|
||
$container | ||
->setDefinition('child', new DefinitionDecorator('parent')) | ||
; | ||
|
||
$this->process($container); | ||
|
||
$def = $container->getDefinition('child'); | ||
$this->assertTrue($def->isShared()); | ||
} | ||
|
||
public function testProcessDoesNotCopyTags() | ||
{ | ||
$container = new ContainerBuilder(); | ||
|
@@ -139,6 +158,25 @@ public function testProcessDoesNotCopyDecoratedService() | |
$this->assertNull($def->getDecoratedService()); | ||
} | ||
|
||
public function testProcessDoesNotDropShared() | ||
{ | ||
$container = new ContainerBuilder(); | ||
|
||
$container | ||
->register('parent') | ||
; | ||
|
||
$container | ||
->setDefinition('child', new DefinitionDecorator('parent')) | ||
->setShared(false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO you should put this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dosten the shared flag is always taken from the child (same than the scope in 2.x, as this is the replacement for the scope) |
||
; | ||
|
||
$this->process($container); | ||
|
||
$def = $container->getDefinition('child'); | ||
$this->assertFalse($def->isShared()); | ||
} | ||
|
||
public function testProcessHandlesMultipleInheritance() | ||
{ | ||
$container = new ContainerBuilder(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add a
testProcessDoesNotCopyShared
, to mimic what we have for the scopeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem.
testProcessDoesNotCopyShared
has been added.