Last active
October 26, 2016 09:33
-
-
Save k-vagin-parc/a0206ffac62e1a6e326395964bf0d3cc to your computer and use it in GitHub Desktop.
mock file upload
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
<?php | |
$list = []; | |
$fp = new \SplFileObject('php://temp', 'rw'); | |
foreach ($list as $fields) { | |
$fp->fputcsv($fields); | |
} | |
$uploadedFile = \Mockery::mock( | |
'\Symfony\Component\HttpFoundation\File\UploadedFile', | |
[ | |
'getClientOriginalName' => 'users.csv', | |
'getClientOriginalExtension' => 'csv', | |
'openFile' => $fp, | |
] | |
); | |
$response = $this->action( | |
'POST', | |
'AdminPanel\UserController@bulkRegister', | |
[], | |
[], | |
[], | |
['list' => $uploadedFile] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment