ZendTest\Stratigility\NextTest::testRequestUriInHandlerInvokedByProcessDoesNotContainMatchedPortionOfRoute PHP Method

testRequestUriInHandlerInvokedByProcessDoesNotContainMatchedPortionOfRoute() public method

    public function testRequestUriInHandlerInvokedByProcessDoesNotContainMatchedPortionOfRoute()
    {
        // e.g., if route is "/foo", and "/foo/bar" is the original path,
        // then the URI path in the handler is "/bar"
        $done = function ($req, $res, $err = null) {
            Assert::fail('Should not have hit the done handler, but did');
        };
        $request = $this->request->withUri(new Uri('http://local.example.com/foo/bar'));
        $response = $this->prophesize(ResponseInterface::class)->reveal();
        $middleware = $this->prophesize(ServerMiddlewareInterface::class);
        $middleware->process(Argument::that(function ($arg) {
            Assert::assertInstanceOf(RequestInterface::class, $arg);
            Assert::assertEquals('/bar', $arg->getUri()->getPath());
            return true;
        }), Argument::type(Next::class))->willReturn($response);
        $this->queue->enqueue(new Route('/foo', $middleware->reveal()));
        $next = new Next($this->queue, $done);
        $next->setResponsePrototype($response);
        $this->assertSame($response, $next->process($request));
    }
NextTest