$this->
assertTrue($definition->
isSynthetic());
$this->
assertSame(ContainerInterface::
class,
$definition->
getClass());
} public function testDefinitions() { $builder =
new ContainerBuilder();
$definitions =
[ 'foo' =>
new Definition('Bar\FooClass'
),
'bar' =>
new Definition('BarClass'
),
];
$builder->
setDefinitions($definitions);
$this->
assertEquals($definitions,
$builder->
getDefinitions(), '->setDefinitions() sets the service definitions'
);
$this->
assertTrue($builder->
hasDefinition('foo'
), '->hasDefinition() returns true if a service definition exists'
);
$this->
assertFalse($builder->
hasDefinition('foobar'
), '->hasDefinition() returns false if a service definition does not exist'
);
$builder->
setDefinition('foobar',
$foo =
new Definition('FooBarClass'
));
$this->
assertEquals($foo,
$builder->
getDefinition('foobar'
), '->getDefinition() returns a service definition if defined'
);
$this->
assertSame($builder->
setDefinition('foobar',
$foo =
new Definition('FooBarClass'
)),
$foo, '->setDefinition() implements a fluid interface by returning the service reference'
);
$builder->
addDefinitions($defs =
['foobar' =>
new Definition('FooBarClass'
)]);
$this->
assertEquals(array_merge($definitions,
$defs),
$builder->
getDefinitions(), '->addDefinitions() adds the service definitions'
);