public function exportAction() { $csvExporter = new CsvExporter($this->routeCollection, sys_get_temp_dir()); $this->console->write('Exporting all routes...'); $fileName = $csvExporter->export(); $this->console->writeLine(' done.'); $this->console->write('CSV file now available at '); $this->console->writeLine($fileName, ColorInterface::LIGHT_BLUE); }
public function testExport() { $routeCollection = $this->getRouteCollection(); $outputDir = sys_get_temp_dir(); $csvExporter = new CsvExporter($routeCollection, $outputDir); $file = $csvExporter->export(); $this->assertTrue(is_file($file)); $contents = file($file); $this->assertEquals(self::ROUTES_COUNT + 1, count($contents)); if (is_file($file)) { unlink($file); } }