/**
* @group lazy-piping
*/
public function testAllowsPipingErrorMiddlewareAsServiceNameWithPath()
{
$middleware = function ($error, $req, $res, $next) {
return 'invoked';
};
$container = $this->prophesize(ContainerInterface::class);
$container->has('foo')->willReturn(true);
$container->get('foo')->willReturn($middleware);
$app = new Application($this->router->reveal(), $container->reveal());
$app->pipeErrorHandler('/foo', 'foo');
$r = new ReflectionProperty($app, 'pipeline');
$r->setAccessible(true);
$pipeline = $r->getValue($app);
$route = $pipeline->dequeue();
$this->assertInstanceOf('Zend\\Stratigility\\Route', $route);
$handler = $route->handler;
$this->assertEquals('invoked', $handler('foo', 'bar', 'baz', 'bat'));
}