summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer.json3
-rw-r--r--src/Config/Output.php1
-rw-r--r--test/CsvTest.php20
3 files changed, 22 insertions, 2 deletions
diff --git a/composer.json b/composer.json
index fc2b18b..a8057f7 100644
--- a/composer.json
+++ b/composer.json
@@ -21,7 +21,8 @@
"ext-mbstring" : "*"
},
"require-dev": {
- "phpunit/phpunit" : "~4.0"
+ "phpunit/phpunit" : "~4.0",
+ "ext-xdebug": "~2.0"
},
"autoload": {
"psr-4": {
diff --git a/src/Config/Output.php b/src/Config/Output.php
index 8411075..9a2dd16 100644
--- a/src/Config/Output.php
+++ b/src/Config/Output.php
@@ -154,7 +154,6 @@ trait Output
*
* @param string $filename CSV downloaded name if present adds extra headers
*
- * @codeCoverageIgnore
*/
public function output($filename = null)
{
diff --git a/test/CsvTest.php b/test/CsvTest.php
index ad64826..5ee00c5 100644
--- a/test/CsvTest.php
+++ b/test/CsvTest.php
@@ -204,4 +204,24 @@ EOF;
$csv->prependStreamFilter('string.toupper');
$this->assertFalse($csv->getIterator()->getRealPath());
}
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testOutput()
+ {
+ $this->csv->output("test.csv");
+ $headers = xdebug_get_headers();
+ $this->assertSame($headers[0], "Content-Type: application/octet-stream");
+ $this->assertSame($headers[1], "Content-Transfer-Encoding: binary");
+ $this->assertSame($headers[2], "Content-Disposition: attachment; filename=\"test.csv\"");
+ }
+
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ */
+ public function testFailedOutput()
+ {
+ $this->csv->output(new DateTime);
+ }
}