View | Details | Raw Unified | Return to bug 6874
Collapse All | Expand All

(-)a/t/db_dependent/UploadedFiles.t (-5 / +9 lines)
Lines 3-9 Link Here
3
use Modern::Perl;
3
use Modern::Perl;
4
use File::Temp qw/ tempdir /;
4
use File::Temp qw/ tempdir /;
5
use Test::CGI::Multipart;
5
use Test::CGI::Multipart;
6
use Test::More tests => 15;
6
use Test::More tests => 17;
7
use Test::Warn;
7
8
8
use t::lib::Mocks;
9
use t::lib::Mocks;
9
10
Lines 44-52 open my $fh,">",($file->{filepath}); Link Here
44
print $fh "";
45
print $fh "";
45
close $fh;
46
close $fh;
46
47
47
ok(C4::UploadedFiles::DelUploadedFile($id)==1, "DelUploadedFile($id) returned 1.");
48
my $DelResult;
48
ok(C4::UploadedFiles::DelUploadedFile($id)==-1, "DelUploadedFile($id) returned -1 as expected.");
49
is(C4::UploadedFiles::DelUploadedFile($id),1, "DelUploadedFile($id) returned 1 as expected.");
50
warning_like { $DelResult=C4::UploadedFiles::DelUploadedFile($id); } qr/file for id=/, "Expected warning for deleting Dangling Entry.";
51
is($DelResult,-1, "DelUploadedFile($id) returned -1 as expected.");
49
ok(! -e $file->{filepath}, "File $file->{filepath} does not exist anymore");
52
ok(! -e $file->{filepath}, "File $file->{filepath} does not exist anymore");
50
53
51
is(C4::UploadedFiles::UploadFile($testfilename, '../', $testfile_fh->handle), undef, 'UploadFile with $dir containing ".." return undef');
54
my $UploadResult;
55
warning_like { $UploadResult=C4::UploadedFiles::UploadFile($testfilename,'../',$testfile_fh->handle); } qr/^Filename or dirname contains '..'. Aborting upload/, "Expected warning for bad file upload.";
56
is($UploadResult, undef, "UploadFile with dir containing \"..\" return undef");
52
is(C4::UploadedFiles::GetUploadedFile(), undef, 'GetUploadedFile without parameters returns undef');
57
is(C4::UploadedFiles::GetUploadedFile(), undef, 'GetUploadedFile without parameters returns undef');
53
- 

Return to bug 6874