Closed triopsi closed 2 years ago
This:
new UploadedFile( TESTS . '/TestFiles/Home-Network.pdf'
Should be:
copy(TESTS . '/TestFiles/Home-Network.pdf'`, $someTempLocation);
new UploadedFile( TESTS . '/TestFiles/Home-Network.pdf', ...
Thanks @Ocramius Your solution is ok and I can work with it :) Thanks
Bug Report
Summary
Hi,
I use the UploadedFile object to make my PHPUnit test cases more realistic for my application. (See example below) After an update of the laminas-diactoros framework, I noticed that many PHPUnit test cases no longer work. This is because the UploadedFile object deletes the original file after use. See commit link: https://github.com/laminas/laminas-diactoros/commit/197f195ef75dd8db528a459154ba917c0fd644b9#commitcomment-77930965
If this is not a bug, is there an alternative to creating an UploadedFile object without the object deleting the file?
Danger! This only applies if multiple PHPUnit test cases that want to use the same file to test a function.
Example