Skip to content

Instantly share code, notes, and snippets.

@abfan1127
Created January 27, 2014 02:59
Show Gist options
  • Save abfan1127/8642649 to your computer and use it in GitHub Desktop.
Save abfan1127/8642649 to your computer and use it in GitHub Desktop.
Laravel 4 File Download Integration Test
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