PhlyTest\Conduit\NextTest::testInvokesItselfWhenRouteDoesNotMatchCurrentUrl PHP Method

testInvokesItselfWhenRouteDoesNotMatchCurrentUrl() public method

    public function testInvokesItselfWhenRouteDoesNotMatchCurrentUrl()
    {
        // e.g., handler matches "/foo", but path is "/bar"
        $phpunit = $this;
        $route = new Route('/foo', function ($req, $res, $next) use($phpunit) {
            $phpunit->fail('Route should not be invoked if path does not match');
        });
        $this->queue->enqueue($route);
        $triggered = null;
        $done = function ($req, $res, $err = null) use(&$triggered) {
            $triggered = true;
        };
        $this->request->withUri(new Uri('http://local.example.com/bar'));
        $next = new Next($this->queue, $done);
        $next($this->request, $this->response);
        $this->assertTrue($triggered);
    }