/** * @dataProvider getGetResponseTests */ public function testGetResponse($format, $filename, $contentType) { $source = new ArraySourceIterator(array(array('foo' => 'bar'))); $writer = $this->getMock('Exporter\\Writer\\TypedWriterInterface'); $writer->expects($this->any())->method('getFormat')->willReturn('made-up'); $writer->expects($this->any())->method('getDefaultMimeType')->willReturn('application/made-up'); $exporter = new Exporter(array(new CsvWriter('php://output', ',', '"', '', true, true), new JsonWriter('php://output'), new XlsWriter('php://output'), new XmlWriter('php://output'), $writer)); $response = $exporter->getResponse($format, $filename, $source); $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $response); $this->assertSame($contentType, $response->headers->get('Content-Type')); $this->assertSame('attachment; filename="' . $filename . '"', $response->headers->get('Content-Disposition')); }