public function __construct($name = null, array $data = array(), $dataName = '') { parent::__construct($name, $data, $dataName); $this->injectorConfig = new InjectorConfig(); $this->frontControllerBindings($this->injectorConfig); $injector = new Injector($this->injectorConfig); $this->frontController = $injector->getInstance('\\Ouzo\\FrontController'); }
private function getInstance(RouteRule $routeRule, $controller) { $controllerInstance = $this->injector->getInstance($controller); $controllerInstance->initialize($routeRule); return $controllerInstance; }
/** * @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); }