PhlyTest\Conduit\NextTest::testSlashAndPathGetResetBeforeExecutingNextMiddleware PHP Method

testSlashAndPathGetResetBeforeExecutingNextMiddleware() public method

    public function testSlashAndPathGetResetBeforeExecutingNextMiddleware()
    {
        $route1 = new Route('/foo', function ($req, $res, $next) {
            $next($req, $res);
        });
        $route2 = new Route('/foo/bar', function ($req, $res, $next) {
            $next($req, $res);
        });
        $route3 = new Route('/foo/baz', function ($req, $res, $next) {
            $res->end('done');
            return $res;
        });
        $this->queue->enqueue($route1);
        $this->queue->enqueue($route2);
        $this->queue->enqueue($route3);
        $phpunit = $this;
        $done = function ($req, $res, $err) use($phpunit) {
            $phpunit->fail('Should not hit final handler');
        };
        $request = $this->request->withUri(new Uri('http://example.com/foo/baz/bat'));
        $next = new Next($this->queue, $done);
        $next($request, $this->response);
        $this->assertEquals('done', (string) $this->response->getBody());
    }