class FileBagTest extends TestCase
{ public function testFileMustBeAnArrayOrUploadedFile() { $this->
expectException(\InvalidArgumentException::
class);
new FileBag(['file' => 'foo'
]);
} public function testShouldConvertsUploadedFiles() { $tmpFile =
$this->
createTempFile();
$file =
new UploadedFile($tmpFile,
basename($tmpFile), 'text/plain'
);
$bag =
new FileBag(['file' =>
[ 'name' =>
basename($tmpFile),
'type' => 'text/plain',
'tmp_name' =>
$tmpFile,
'error' => 0,
'size' => null,
]]);
$this->
assertEquals($file,
$bag->
get('file'
));
}