Browse Source

Add test for withDownload()

Mark Story 9 years ago
parent
commit
5be9f45f15
1 changed files with 15 additions and 0 deletions
  1. 15 0
      tests/TestCase/Network/ResponseTest.php

+ 15 - 0
tests/TestCase/Network/ResponseTest.php

@@ -667,6 +667,21 @@ class ResponseTest extends TestCase
     }
 
     /**
+     * Tests the withDownload method
+     *
+     * @return void
+     */
+    public function testWithDownload()
+    {
+        $response = new Response();
+        $new = $response->withDownload('myfile.mp3');
+        $this->assertFalse($response->hasHeader('Content-Disposition'), 'No mutation');
+
+        $expected = 'attachment; filename="myfile.mp3"';
+        $this->assertEquals($expected, $new->getHeaderLine('Content-Disposition'));
+    }
+
+    /**
      * Tests the mapType method
      *
      * @return void