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'); }
/** * Inject $object with available objects from $availableObjects * * @param Injectable $object */ public function inject($object) { $this->injector->inject($object); }