Exemplo n.º 1
0
 private function processInstance($compiler)
 {
     if (is_object($compiler)) {
         return $compiler;
     } elseif (class_exists($compiler)) {
         return $this->container->getInstance($compiler);
     }
     throw Exception::neitherObjectOrClass($compiler);
 }
Exemplo n.º 2
0
 protected function setUp()
 {
     $container = new IocContainer();
     $this->binder = new BinderStub();
     $container->register(Binder::class, $this->binder);
     $this->cache = new CachedBinderStub();
     $container->register(CachedBinder::class, $this->cache);
     $this->context = new ContextMock();
     $this->compiler = new ProcessorListStub();
     $handler = new CompilerHandler($this->compiler, $container);
     $executor = new Executor($container, $this->context);
     $this->target = new FluentBuilder($executor, $this->context, $handler);
 }
Exemplo n.º 3
0
 private function getBinder()
 {
     $class = $this->context->hasCache() ? CachedBinder::class : Binder::class;
     return $this->container->getInstance($class);
 }
Exemplo n.º 4
0
 /**
  * @test
  * @expectedException InvalidArgumentException
  */
 public function getInstance_failComplexDependencyLoop()
 {
     $this->target->getInstance(DummyLoopComplex::class);
 }