public function testRender()
 {
     $reflectionProperty = $this->getProtectProperty(get_class($this->render), 'headers');
     $header = $reflectionProperty->getValue($this->render);
     $this->assertInternalType('array', $header);
     $this->assertSame("application/hal+json", $header['Content-Type']);
     $render = $this->render->render($this->hal, 200, $header);
     $this->assertInstanceOf('Illuminate\\Http\\Response', $render);
     $this->assertSame('application/hal+json', $render->headers->get('content-type'));
 }
示例#2
0
 /**
  * Hypertext Application Language format
  * usage \Response::hal
  * @param Hal $data
  * @param int $status
  * @param array $header
  * @return \Illuminate\Http\Response
  */
 public static function hal(Hal $data, $status = 200, array $header = [])
 {
     $hal = new HalRender($data);
     return $hal->render($data, $status, $header);
 }