public function getXmlAction($isin)
 {
     $display = new DisplayHelper();
     $certificate = $this->certificateRepository->load($isin);
     if (empty($certificate)) {
         return $this->response->setStatusCode(404);
     }
     try {
         $xml = $display->displayAsXml($certificate);
     } catch (\RuntimeException $e) {
         return $this->response->setStatusCode(405)->setContent($e->getMessage());
     }
     $this->response->headers()->addHeaderLine('Content-type', 'application/xml');
     return $this->response->setContent($xml);
 }
    public function testDisplaysAsXml()
    {
        $helper = new DisplayHelper();
        $cert = new \Nfx\Entity\Certificate(array('isin' => 'XXXYYY', 'trading_market' => 'US', 'currency' => 'US', 'issuer' => 'AAPL', 'issuing_price' => 50.01, 'currentPrice' => 60.01));
        $xml = '<?xml version="1.0"?>
<Certificate>
  <isin>XXXYYY</isin>
  <trading_market>US</trading_market>
  <currency>US</currency>
  <issuer>AAPL</issuer>
  <issuing_price>50.01</issuing_price>
  <currentPrice>60.01</currentPrice>
</Certificate>
';
        $result = $helper->displayAsXml($cert);
        $this->assertEquals($xml, $result, $result);
    }