X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/c0b530184e94d6c61ea15b3c75bd66f51fe958eb..41ec1a254c67a6bbd3ce97b91fb9521876a2e91b:/t/file/filesystem.t?ds=sidebyside diff --git a/t/file/filesystem.t b/t/file/filesystem.t index aa19ac714..6c22e3d4c 100644 --- a/t/file/filesystem.t +++ b/t/file/filesystem.t @@ -1,5 +1,5 @@ use strict; -use Test::More tests => 11; +use Test::More tests => 14; use lib 't'; @@ -54,31 +54,53 @@ ok( $$content5 eq 'inhalt3 new version' ,"file has right actual $content5 = $file6[1]->get_content; ok( $$content5 eq 'inhalt3 created' ,"file has right old content"); -print "\n\nController:\n"; +#print "\n\nController Test:\n"; # now test controller #$::form->{object_id} = 1; #$::form->{object_type}= 'sales_order'; #$::form->{file_type} = 'document'; + +my $output; +open(my $outputFH, '>', \$output) or die; # This shouldn't fail +my $oldFH = select $outputFH; + $::form->{id} = $file1->id; -print "id=".$::form->{id}."\n"; use SL::Controller::File; SL::Controller::File->action_download(); + +select $oldFH; +close $outputFH; +my @lines = split "\n" , $output; +ok($lines[4] eq 'inhalt1 uploaded' ,"controller download has correct content"); + +#some controller checks $::form->{object_id} = 12345678; $::form->{object_type} = undef; +my $result='xx1'; eval { SL::Controller::File->check_object_params(); + $result='yy1'; 1; } or do { - print $@; + $result=$@; }; -$::form->{object_type} ='xx'; -$::form->{file_type} ='yy'; +$result = substr($result,0,14); +#print $result."\n"; +ok($result eq "No object type","correct error 'No object type'"); + +$::form->{object_type} ='sales_order'; +$::form->{file_type} =''; +$result='xx2'; eval { SL::Controller::File->check_object_params(); + $result='yy2'; 1; } or do { - print $@; + $result=$@; }; +$result = substr($result,0,12); +#print $result."\n"; +ok($result eq "No file type","correct error 'No file type'"); clear_up(); done_testing;