ZendTest\Stratigility\MiddlewarePipeTest::testNestedMiddlewareMatchesOnlyAtPathBoundaries PHP Method

testNestedMiddlewareMatchesOnlyAtPathBoundaries() public method

public testNestedMiddlewareMatchesOnlyAtPathBoundaries ( $topPath, $nestedPath, $fullPath, $assertion )
    public function testNestedMiddlewareMatchesOnlyAtPathBoundaries($topPath, $nestedPath, $fullPath, $assertion)
    {
        $middleware = $this->middleware;
        $nest = new MiddlewarePipe();
        $nest->pipe($nestedPath, function ($req, $res) use($nestedPath) {
            return $res->withHeader('X-Found', 'true');
        });
        $middleware->pipe($topPath, function ($req, $res, $next = null) use($topPath, $nest) {
            $result = $nest($req, $res, $next);
            return $result;
        });
        $uri = (new Uri())->withPath($fullPath);
        $request = (new Request())->withUri($uri);
        $response = $middleware($request, $this->response, $this->createFinalHandler());
        $this->{$assertion}($response->hasHeader('X-Found'), sprintf("%s failed with full path %s against top pipe '%s' and nested pipe '%s'\n", $assertion, $fullPath, $topPath, $nestedPath));
    }
MiddlewarePipeTest