$other_service =
$this->container->
get('other.service'
);
$this->
assertInstanceOf($other_service_class,
$other_service);
$some_parameter =
$this->containerDefinition
['parameters'
]['some_config'
];
$some_other_parameter =
$this->containerDefinition
['parameters'
]['some_other_config'
];
$service =
$this->container->
get('service.provider'
);
$this->
assertEquals($other_service,
$service->
getSomeOtherService(), '@other.service was injected via constructor.'
);
$this->
assertEquals($some_parameter,
$service->
getSomeParameter(), '%some_config% was injected via constructor.'
);
$this->
assertEquals($this->container,
$service->
getContainer(), 'Container was injected via setter injection.'
);
$this->
assertEquals($some_other_parameter,
$service->
getSomeOtherParameter(), '%some_other_config% was injected via setter injection.'
);
$this->
assertEquals('foo',
$service->someProperty, 'Service has added properties.'
);
} /**
* Tests that Container::get() for non-shared services works properly.
*
* @covers ::get
* @covers ::createService
*/
public function testGetForNonSharedService() { $service =
$this->container->
get('non_shared_service'
);