Пример #1
0
 public function testMultiFileUploadProcessing()
 {
     $files = ['combinedFiles' => ['name' => ['one.jpg', 'two.jpg'], 'type' => ['image/jpg', 'image/jpeg'], 'tmp_name' => ['/tmp/php3A.tmp', '/tmp/php3B.tmp'], 'error' => [UPLOAD_ERR_OK, UPLOAD_ERR_EXTENSION], 'size' => [644563, 365446]], 'anotherLooseFile' => ['name' => 'bookmarks.html', 'type' => 'text/html', 'tmp_name' => '/tmp/php3D.tmp', 'error' => UPLOAD_ERR_OK, 'size' => 644563]];
     $request = new Request();
     $request->setFileData($files);
     $ups = $request->getFileUploads();
     $this->assertCount(3, $ups);
     $fileOne = array_shift($ups);
     $this->assertEquals('combinedFiles', $fileOne->getFormKey());
     $this->assertEquals('one.jpg', $fileOne->getOriginalName());
     $fileTwo = array_shift($ups);
     $this->assertEquals('combinedFiles', $fileTwo->getFormKey());
     $this->assertEquals('two.jpg', $fileTwo->getOriginalName());
     $fileThree = array_shift($ups);
     $this->assertEquals('anotherLooseFile', $fileThree->getFormKey());
     $this->assertEquals('bookmarks.html', $fileThree->getOriginalName());
 }