PhlyTest\Conduit\DispatchTest::testHasErrorAndHandleArityLessThanFourTriggersNextWithError PHP Method

testHasErrorAndHandleArityLessThanFourTriggersNextWithError() public method

    public function testHasErrorAndHandleArityLessThanFourTriggersNextWithError()
    {
        $phpunit = $this;
        $triggered = false;
        $handler = function ($req, $res, $next) use($phpunit) {
            $phpunit->fail('Handler was called; it should not have been');
        };
        $next = function ($req, $res, $err) use(&$triggered) {
            $triggered = $err;
        };
        $route = new Route('/foo', $handler);
        $dispatch = new Dispatch();
        $err = (object) ['error' => true];
        $dispatch($route, $err, $this->request, $this->response, $next);
        $this->assertSame($err, $triggered);
    }