/**
  * @return iRenderer
  * @throws Exception\NotImplementedException
  * @throws Exception
  */
 public function getRenderer()
 {
     $outputTypeCode = $this->request->getOutputType()->getCode();
     $renderer = null;
     switch ($outputTypeCode) {
         case OutputType::TSV_EXCEL:
         case OutputType::CSV:
         case OutputType::HTML:
             throw new NotImplementedException($outputTypeCode . " rendering is not implemented");
             break;
         case OutputType::JSON:
         case OutputType::JSONP:
             $renderer = new JsonRenderer();
             break;
         default:
             throw new Exception("Unknown Output Type: " . $outputTypeCode);
             break;
     }
     return $renderer;
 }
 public function testSpecifiedGetSignature()
 {
     $vars = array('tqx' => 'sig:abc');
     $r = new Request($vars);
     $sig = $r->getSignature();
     $this->assertSame('abc', $sig, "getSignature should return same value the client specified");
 }
 public function testCsvResponseWriterWithCustomOutputFilename()
 {
     $requestParameters = implode(";", array(RequestParameters::OUTPUT_TYPE_PARAMETER . ":" . OutputType::CSV, RequestParameters::OUTPUT_FILE_NAME_PARAMETER . ":custom_secure.123"));
     $request = new Request();
     $request->setParams($requestParameters);
     $response = $this->createMockResponseFromRequest($request);
     $responseWriter = new MockResponseWriter();
     $this->expectOutputString($this->expectedOutputString);
     $responseWriter->send($response);
     $this->assertArrayHasKey('Content-Type', $responseWriter->headersSent, "Expect to have sent Content-Type header");
     $this->assertSame("text/csv; charset=UTF-8", $responseWriter->headersSent['Content-Type'], "Expect to have sent CSV Content-Type");
     $this->assertArrayHasKey('Content-Disposition', $responseWriter->headersSent, "Expect to have sent Content-Disposition header");
     $this->assertSame("attachment; filename=custom_secure.123.csv", $responseWriter->headersSent['Content-Disposition'], "Expect to have sent results.csv filename");
 }