Finish up the file upload handling by PseudoRequest. If you

call $pseudoRequest->uploadFiles with a list of filenames, it will populate
the upload method with upload objects, so that Storage->getFileFromFormPost
will have an object with all the right methods.
t/Storage.t tests this incidently.  It occurs to me that we need tests
for our PseudoRequest module, and it needs POD, and it should probably
be rewritten using Class::InsideOut for good form.
This commit is contained in:
Colin Kuskie 2007-11-10 00:47:17 +00:00
parent 4de53b2de9
commit 1cf78f5321
2 changed files with 72 additions and 2 deletions

View file

@ -11,7 +11,6 @@
use FindBin;
use strict;
use lib "$FindBin::Bin/lib";
our $todo;
use WebGUI::Test;
use WebGUI::Session;
@ -55,7 +54,7 @@ my $extensionTests = [
},
];
plan tests => 76 + scalar @{ $extensionTests }; # increment this value for each test you create
plan tests => 77 + scalar @{ $extensionTests }; # increment this value for each test you create
my $session = WebGUI::Test->session;
@ -395,6 +394,12 @@ $session->http->setStatus(200);
$pseudoRequest->upload('files', []);
is($fileStore->addFileFromFormPost('files'), undef, 'addFileFromFormPost returns empty string when asking for a form variable with no files attached');
$pseudoRequest->uploadFiles(
'oneFile',
[ File::Spec->catfile( WebGUI::Test->getTestCollateralPath, qw/WebGUI.pm/) ],
);
is($fileStore->addFileFromFormPost('oneFile'), 'WebGUI.pm', 'Return the name of the uploaded file');
END {
foreach my $stor (
$storage1, $storage2, $storage3, $copiedStorage,