コード例 #1
0
 /**
  * @covers \Cougar\RestService\RestService::bindFromObject
  * @covers \Cougar\RestService\RestService::handleRequest
  * @expectedException \Cougar\Exceptions\BadRequestException
  */
 public function testVariableRegexInvalidQuarter2()
 {
     $_SERVER["SERVER_PROTOCOL"] = "HTTP/1.1";
     $_SERVER["REQUEST_METHOD"] = "GET";
     $_SERVER["REQUEST_URI"] = "/get/variable/regex/2014/8/sales";
     $_SERVER["PHP_SELF"] = "/request_handler";
     $_SERVER["HTTP_HOST"] = "localhost";
     $_SERVER["HTTP_ACCEPT"] = "application/vnd.php.serialized";
     $object = new AnnotatedRestServiceGetTests();
     $service = new AnnotatedRestService(new Security());
     $service->bindFromObject($object);
     $service->handleRequest();
 }
コード例 #2
0
 /**
  * @covers \Cougar\RestService\AnnotatedRestService::bindFromObject
  * @covers \Cougar\RestService\AnnotatedRestService::handleRequest
  * 
  * @todo FIX ME
  */
 public function testXmlContentType()
 {
     $_SERVER["SERVER_PROTOCOL"] = "HTTP/1.1";
     $_SERVER["REQUEST_METHOD"] = "DELETE";
     $_SERVER["REQUEST_URI"] = "/delete/ContentType";
     $_SERVER["PHP_SELF"] = "/request_handler";
     $_SERVER["HTTP_HOST"] = "localhost";
     $_SERVER["HTTP_ACCEPT"] = "application/xml";
     $_SERVER["HTTP_CONTENT_TYPE"] = "application/xml";
     $xml = new \SimpleXMLElement("<foo><bar id=\"1\"/></foo>");
     $xml_text = trim($xml->asXML());
     global $_BODY;
     $_BODY = $xml_text;
     $object = new AnnotatedRestServiceDeleteTests();
     $this->expectOutputString(XML::toXml($object->PostBodyXml($xml_text))->asXML());
     $service = new AnnotatedRestService(new Security());
     $service->bindFromObject($object);
     $service->handleRequest();
 }