/**
  *
  */
 public function downloadAction()
 {
     $params = $this->getRequest()->getParams();
     $output = $this->getRequest()->getParam('output', 'xml');
     // Check if it's allowed to perform this action
     $auditLog = new \Application\Model\AuditLogModel();
     $this->_helper->allowed('download', $auditLog);
     if (!isset($params['date'])) {
         throw new \Application\Exceptions\InvalidArgumentException('Query param "date" not given');
     }
     if (!isset($params['orgId']) && !isset($params['serviceProviderId'])) {
         throw new \Application\Exceptions\InvalidArgumentException('Query params "orgId" or "serviceProviderId" not given');
     }
     $filters = $this->_auditLogSrv->buildFilterList($params);
     $result = $this->_auditLogSrv->findAll($filters);
     $date = date_create_from_format('Y-m-d', $params['date']);
     $fileName = "audit-" . ($params['serviceProviderId'] ? $params['serviceProviderId'] : $params['orgId']) . "-" . $date->format('Ymd') . "-log";
     // Init view
     $helper = $this->_helper->output('Stream_Json');
     $helper->setFilename($fileName . '.json');
     if ($output == 'csv') {
         $helper = $this->_helper->output('Stream_Csv');
         $helper->setFilename($fileName . '.csv');
     } else {
         if ($output == 'xml') {
             $helper = $this->_helper->output('Stream_Xml');
             $helper->setFilename($fileName . '.xml');
         }
     }
     $this->view->data = $result;
     $helper->addHeaders();
     $this->getResponse()->sendHeaders();
     $this->view->render('');
     $this->_helper->forceExit();
 }
 /**
  * Test elementHasChanged.
  *
  * @covers ::elementHasChanged
  * @covers ::onElementChanged
  */
 public final function testElementHasChanged()
 {
     $before = array('test' => array('label' => 'test1', 'value' => 'test1'));
     $after = array('test' => array('label' => 'test2', 'value' => 'test2'));
     $service = new AuditLogService();
     $result = $service->elementHasChanged(ElementType::Entry, 1, $before, $after);
     $this->assertInternalType('array', $result);
 }