예제 #1
0
 public function testAutoSetInjector()
 {
     $injector = new NovemberInjector(dirname(dirname(__FILE__)) . '/services');
     $injector->addAutoProperty('auto', 'somevalue');
     $injector->loadServices();
     $this->assertTrue($injector->hasService('SampleService'));
     // We expect a false because the 'AnotherService' is actually
     // just a replacement of the SampleService
     $myObject = new TestObject();
     $injector->inject($myObject);
     $this->assertEqual(get_class($myObject->sampleService), 'SampleService');
     $this->assertEqual($myObject->auto, 'somevalue');
 }
예제 #2
0
 /**
  * Inject $object with available objects from $availableObjects
  *
  * @param Injectable $object
  */
 public function inject($object)
 {
     $this->injector->inject($object);
 }