Esempio n. 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');
 }
Esempio n. 2
0
 /**
  * Set a service
  */
 public function setService($service)
 {
     $this->injector->registerService($service);
 }