dimanche 28 août 2016

How to create a PHP-Unit test for a file download?

after long thinking about this topic without a result, I hope someone can give me a hint about phpUnit-Test for downloads. How can I create a phpUnit test for this function, which execute a download for a zip-File? Or is there an oter usual practice to test a logic like this?

public function createOutput($zipFolderName) { $zipFolderName = $zipFolderName."/imageResizer.zip"; header('Content-Type: application/zip'); header('Content-disposition: attachment; filename=' . $zipFolderName); header('Content-Length: ' . filesize($zipFolderName)); readfile($zipFolderName); }

Aucun commentaire:

Enregistrer un commentaire