bind() public method

public bind ( $className, $name = '' )
Ejemplo n.º 1
0
 /**
  * @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);
 }
Ejemplo n.º 2
0
 protected function frontControllerBindings(InjectorConfig $config)
 {
     $config->bind('\\Ouzo\\OutputDisplayer')->toInstance(new MockOutputDisplayer());
     $config->bind('\\Ouzo\\HeaderSender')->toInstance(new MockHeaderSender());
     $config->bind('\\Ouzo\\CookiesSetter')->toInstance(new MockCookiesSetter());
     $config->bind('\\Ouzo\\RedirectHandler')->toInstance(new MockRedirectHandler());
     $config->bind('\\Ouzo\\SessionInitializer')->toInstance(new MockSessionInitializer());
     $config->bind('\\Ouzo\\DownloadHandler')->toInstance(new MockDownloadHandler());
 }