/** * @covers Kunstmaan\AdminListBundle\Service\ExportService::getSupportedExtensions */ public function testGetSupportedExtensions() { $extensions = ExportService::getSupportedExtensions(); $this->assertEquals(array('Csv' => 'csv', 'Excel' => 'xlsx'), $extensions); }
/** * @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(); }