173 'Foo' =>
function() {
176 'Bar' =>
function() {
179 'Car' =>
function() {
190 $newServices->defineService(
'Car',
function() {
195 $newServices->getService(
'Car' );
199 $newServices->defineService(
'Xar',
function() {
204 $newServices->importWiring(
$services, [
'Bar' ] );
206 $this->assertNotContains(
'Bar', $newServices->getServiceNames(),
'Skip `Bar` service' );
207 $this->assertSame(
'Foo!', $newServices->getService(
'Foo' ) );
212 $this->assertContains(
'Bar', $newServices->getServiceNames(),
'Import all services' );
213 $this->assertSame(
'Bar!', $newServices->getService(
'Bar' ) );
214 $this->assertSame(
'Car!', $newServices->getService(
'Car' ),
'Use existing service instance' );
215 $this->assertSame(
'Xar!', $newServices->getService(
'Xar' ),
'Predefined services are kept' );