filterFiles() protected method

This method created test instances of UploadedFile so that the move() method can be called on those instances. If the size of a file is greater than the allowed size (from php.ini) then an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE.
See also: UploadedFile
protected filterFiles ( array $files ) : array
$files array An array of files
return array An array with all uploaded files marked as already moved
Example #1
0
 /**
  * Make sure files are \Illuminate\Http\UploadedFile instances with the private $test property set to true.
  * Fixes issue https://github.com/Codeception/Codeception/pull/3417.
  *
  * @param array $files
  * @return array
  */
 protected function filterFiles(array $files)
 {
     $files = parent::filterFiles($files);
     if (!class_exists('Illuminate\\Http\\UploadedFile')) {
         // The \Illuminate\Http\UploadedFile class was introduced in Laravel 5.2.15,
         // so don't change the $files array if it does not exist.
         return $files;
     }
     $filtered = [];
     foreach ($files as $key => $file) {
         $filtered[$key] = UploadedFile::createFromBase($file, true);
     }
     return $filtered;
 }