public function testContainerResolvesMiddlewares()
 {
     $container = new Container();
     $container->delegate(new ReflectionContainer());
     $runner = new Runner();
     $runner->setContainer($container);
     $runner->addMiddleware(TestClass::class);
     $this->assertCount(1, $runner->getMiddlewares());
     $response = $runner(ServerRequestFactory::fromGlobals(), new Response());
     $this->assertInstanceOf(Response::class, $response);
 }
Beispiel #2
0
 /**
  * Assert delegation works for method calls
  */
 public function testContainerDelegationResultsInMethodCallsBeingPassedDown()
 {
     $container = new Container();
     $serviceProvider = new ServiceProviderContainer();
     $container->delegate($serviceProvider);
     //this should fall through to the service provider container
     $container->addServiceProvider(TestServiceProvider::class);
     $this->assertTrue($container->has(\stdClass::class));
     $this->assertInstanceOf('stdClass', $container->get(\stdClass::class));
 }