Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
DummyProxyDumper example
public
function
testNonSharedLazyDefinitionReferences
(
bool
$asGhostObject
)
{
$container
=
new
ContainerBuilder
(
)
;
$container
->
register
(
'foo', 'stdClass'
)
->
setShared
(
false
)
->
setLazy
(
true
)
;
$container
->
register
(
'bar', 'stdClass'
)
->
addArgument
(
new
Reference
(
'foo', ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE
)
)
->
setPublic
(
true
)
;
$container
->
compile
(
)
;
$dumper
=
new
PhpDumper
(
$container
)
;
if
(
!
$asGhostObject
)
{
$dumper
->
setProxyDumper
(
new
\
DummyProxyDumper
(
)
)
;
}
$this
->
assertStringEqualsFile
(
self::
$fixturesPath
.'/php/services_non_shared_lazy'.
(
$asGhostObject
? '_ghost' : ''
)
.'.php',
$dumper
->
dump
(
)
)
;
}
public
function
testNonSharedDuplicates
(
)
{
$container
=
new
ContainerBuilder
(
)
;
$container
->
register
(
'foo', 'stdClass'
)
->
setShared
(
false
)
;
$container
->
register
(
'baz', 'stdClass'
)
->
setPublic
(
true
)
->
addArgument
(
new
ServiceLocatorArgument
(
[
'foo' =>
new
Reference
(
'foo'
)
]
)
)
;