/** * Sets $_FILES data for this request object. * * @param array $files Key/value $_FILES array. * @return $this */ public function setFileData(array $files) { $files = $this->deflateFilesArray($files); $this->fileUploads = []; foreach ($files as $key => $fileData) { $uploadObj = FileUpload::createFromFileArray($fileData); if (!empty($uploadObj)) { $this->fileUploads[$key] = $uploadObj; } } return $this; }
public function testCreateFromSubArray() { $file = FileUpload::createFromFileArray(['name' => 'my_name.jpg', 'type' => 'image/jpeg', 'tmp_name' => ['why', 'is', 'this', 'here'], 'error' => UPLOAD_ERR_EXTENSION, 'size' => 1234567890, 'key' => 'myKey']); $this->assertNull($file, 'Bad array should result in null result'); }