public function bind($className, $name = '') { $className = Strings::prependIfMissing($className, '\\'); $binder = new Binder($className, $name); $this->binders[$className . '_' . $name] = $binder; return $binder; }
/** * @test */ public function shouldModifyConfigAfterCreation() { //given $object = new ClassWithNoDep(); $config = new InjectorConfig(); $injector = new Injector($config); $config->bind('\\ClassWithNoDep')->toInstance($object); //ControllerTestCase exposes injectorConfig and allows users to add their bindings after injector is created //when $instance = $injector->getInstance('\\ClassWithNoDep'); //then $this->assertSame($object, $instance); }