Пример #1
0
 public function testConstructorSetsProperties()
 {
     $response = new Response('content');
     $this->assertEquals('content', $response->getContent());
 }
Пример #2
0
 /**
  * Check whether the response content is valid.
  *
  * A valid response content is a representation object or an array
  * containing representation objects.
  *
  * @param Response $response
  * @return bool
  */
 protected function isValidResponseContent(Response $response)
 {
     $content = $response->getContent();
     if ($content instanceof RepresentationInterface) {
         return true;
     }
     if (is_array($content)) {
         foreach ($content as $representation) {
             if (!$representation instanceof RepresentationInterface) {
                 return false;
             }
         }
         return true;
     }
     return false;
 }