public function testExport() { $exporter = new CsvExporter($this->getEntityManagerExporter(), $this->getClass()); $filePath = __DIR__ . '/export.txt'; $result = $exporter->export($filePath, $this->getCollection()); $this->assertTrue($result); $this->assertTrue(file_exists($filePath)); $result = <<<EOF enabled\tsource\tdestination\tstatusCode 1\tfoo\tbar\t307 1\tbar\tdest\t301 EOF; $this->assertEquals(file_get_contents($filePath), $result); unlink($filePath); }
/** * Export * * @param string Full path of file */ public function export($path) { $collection = $this->getRepository()->getAllOrderBySource()->getQuery()->getResult(); return $this->csvExporter->export($path, $collection); }