private function prepare()
 {
     $request = ServerRequest::createFromGlobals(['REQUEST_URI' => '/test', 'REQUEST_METHOD' => IRequest::METHOD_GET]);
     $route = new RoutePoint('custom', []);
     $handler = $this->prophesize(IHandler::class);
     $handler->handle($request)->willReturn(Response::ok()->withBody('ok'));
     $nf_handler = $this->prophesize(IHandler::class);
     $nf_handler->handle($request)->willReturn(Response::notFound());
     $router = $this->prophesize(IRouter::class);
     $router->route('/test')->willReturn($route);
     $hregistry = $this->prophesize(IHandlerRegistry::class);
     $hregistry->getHandler('custom')->willReturn($handler->reveal());
     $hregistry->getNotFoundHandler()->willReturn($nf_handler->reveal());
     return (object) ['router' => $router, 'hregistry' => $hregistry, 'request' => $request];
 }
Exemple #2
0
 public function testCtorInternalError()
 {
     $response = Response::internalError();
     $this->assertEquals(IResponse::STATUS_INTERNAL_ERROR, $response->getStatusCode());
 }