/**
  * @param Bundle $bundle     The bundle
  * @param string $entityName The entity name
  *
  * @throws \RuntimeException
  */
 public function generateController(Bundle $bundle, $entityName)
 {
     $className = sprintf("%sAdminListController", $entityName);
     $dirPath = sprintf("%s/Controller", $bundle->getPath());
     $classPath = sprintf("%s/%s.php", $dirPath, str_replace('\\', '/', $className));
     $extensions = 'csv';
     if (class_exists("\\Kunstmaan\\AdminListBundle\\Service\\ExportService")) {
         $extensions = implode('|', \Kunstmaan\AdminListBundle\Service\ExportService::getSupportedExtensions());
     }
     if (file_exists($classPath)) {
         throw new \RuntimeException(sprintf('Unable to generate the %s class as it already exists under the %s file', $className, $classPath));
     }
     $this->setSkeletonDirs(array($this->skeletonDir));
     $this->renderFile('/Controller/EntityAdminListController.php', $classPath, array('namespace' => $bundle->getNamespace(), 'bundle' => $bundle, 'entity_class' => $entityName, 'export_extensions' => $extensions));
 }
 public function getSupportedExtensions()
 {
     return ExportService::getSupportedExtensions();
 }
 /**
  * @covers Kunstmaan\AdminListBundle\Service\ExportService::createResponseForExcel
  */
 public function testCreateResponseForExcel()
 {
     $writer = $this->getMock('\\PHPExcel_Writer_IWriter');
     $response = $this->object->createResponseForExcel($writer);
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $response);
 }
 /**
  * @covers Kunstmaan\AdminListBundle\Service\ExportService::createResponse
  */
 public function testCreateResponse()
 {
     $response = $this->object->createResponse('content', ExportService::EXT_CSV);
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $response);
 }