Exemplo n.º 1
0
 public function testInstantiateBySetters()
 {
     $injector = new Phemto();
     $injector->forType(WithSetter::class)->call('setDependency');
     $injector->willUse(new Graph(WithSetter::class, 'graph1'));
     $injector->whenCreating(SecondClass::class, 'graph1')->forVariable('property')->useString('second value for graph1');
     $object1 = $injector->createGraph(WithSetter::class, 'graph1');
     $this->assertEquals('second value for graph1', $object1->dependency->property);
 }