Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
Symfony_DI_PhpDumper_Test_Lazy_Autowire_Attribute example
$container
->
setAlias
(
Foo::
class
, 'foo'
)
;
$container
->
register
(
'bar', LazyServiceConsumer::
class
)
->
setPublic
(
'true'
)
->
setAutowired
(
true
)
;
$container
->
compile
(
)
;
$dumper
=
new
PhpDumper
(
$container
)
;
$this
->
assertStringEqualsFile
(
self::
$fixturesPath
.'/php/lazy_autowire_attribute.php',
$dumper
->
dump
(
[
'class' => 'Symfony_DI_PhpDumper_Test_Lazy_Autowire_Attribute'
]
)
)
;
require
self::
$fixturesPath
.'/php/lazy_autowire_attribute.php';
$container
=
new
\
Symfony_DI_PhpDumper_Test_Lazy_Autowire_Attribute
(
)
;
$this
->
assertInstanceOf
(
Foo::
class
,
$container
->
get
(
'bar'
)
->foo
)
;
$this
->
assertInstanceOf
(
LazyObjectInterface::
class
,
$container
->
get
(
'bar'
)
->foo
)
;
$this
->
assertSame
(
$container
->
get
(
'foo'
)
,
$container
->
get
(
'bar'
)
->foo->
initializeLazyObject
(
)
)
;
}
public
function
testLazyAutowireAttributeWithIntersection
(
)
{
$container
=
new
ContainerBuilder
(
)
;
$container
->
register
(
'foo', AAndIInterfaceConsumer::
class
)
->
setPublic
(
'true'
)