Created
January 27, 2014 02:59
-
-
Save abfan1127/8642649 to your computer and use it in GitHub Desktop.
Laravel 4 File Download Integration Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function testDownloadPass() | |
{ | |
// this is just my file repository, to generate the path | |
$path = $fileRepo->path('test.txt'); | |
// create the file | |
file_put_contents($path, 'twoseventwo'); | |
// more logic here as needed | |
// call needs the path, I use the Route helper to get it by name | |
$response = $this->call('GET', Route('admin_product_download', 1)); | |
// now here is the assertion | |
$this->assertEquals($path,$response->getFile()->getRealPath()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment