public function testControllerInContainer() { $route = new Route(['GET'], '/', 'CallableTest:toCall'); $container = new Container(); $container['CallableTest'] = new CallableTest(); $route->setContainer($container); $uri = Uri::createFromString('https://example.com:80'); $body = new Body(fopen('php://temp', 'r+')); $request = new Request('GET', $uri, new Headers(), [], Environment::mock()->all(), $body); CallableTest::$CalledCount = 0; $result = $route->callMiddlewareStack($request, new Response()); $this->assertInstanceOf('Slim\\Http\\Response', $result); $this->assertEquals(1, CallableTest::$CalledCount); }