Beispiel #1
0
 public function test_get_and_set_value()
 {
     $route = new Route([HttpRequestMethod::GET], 'foo', 'bar');
     $this->assertEquals('bar', $route->getAction());
     $route->setAction('foo');
     $this->assertEquals('foo', $route->getAction());
 }
 public function test_build_response_for_mapping_with_custom_response()
 {
     $builder = new ResponseBuilder();
     $route = new Route([HttpRequestMethod::GET], 'foo', 'bar');
     $routeResponse = new HttpResponse(HttpStatusCode::NOT_FOUND, 'Yada yada', new HttpHeaders(['foo' => 'bar', 'bar' => 'foo']));
     $route->setAction($routeResponse);
     $response = $builder->buildResponseForRoute($route);
     $this->assertEquals($routeResponse->getStatusCode(), $response->getStatusCode());
     $this->assertEquals($routeResponse->getHeaders()->get('foo'), $response->getHeaders()->get('foo'));
     $this->assertEquals($routeResponse->getHeaders()->get('bar'), $response->getHeaders()->get('bar'));
 }