/** * @test */ public function If_a_service_requires_itself_in_its_init_function_this_is_not_considered_as_circular_reference() { // given $ServiceDefinitions = new ServiceDefinitions(); $ServiceDefinitions->add(IdentifyingType::is(Type::fromName('tueena\\spec\\core\\stubs\\A')), ImplementingType::isTheSame(), InitFunction::is(function (A $A) { })); $Target = new ServiceDefinitionsValidator(); // when, then $Target->validate($ServiceDefinitions); }
/** * @param ServiceDefinitions $ServiceDefinitions */ public function __construct(ServiceDefinitions $ServiceDefinitions) { $Validator = new ServiceDefinitionsValidator(); $Validator->validate($ServiceDefinitions); $this->ServiceDefinitions = $ServiceDefinitions; }