Lines 51-56
our $uploads = [
Link Here
|
51 |
# Redirect upload dir structure and mock C4::Context and CGI |
51 |
# Redirect upload dir structure and mock C4::Context and CGI |
52 |
my $tempdir = tempdir( CLEANUP => 1 ); |
52 |
my $tempdir = tempdir( CLEANUP => 1 ); |
53 |
t::lib::Mocks::mock_config('upload_path', $tempdir); |
53 |
t::lib::Mocks::mock_config('upload_path', $tempdir); |
|
|
54 |
my $publictempdir = tempdir( CLEANUP => 1 ); |
55 |
my $public_base_url = 'http://my_opac/public_dir'; |
56 |
t::lib::Mocks::mock_config('upload_public_path', $publictempdir); |
57 |
t::lib::Mocks::mock_config('upload_public_url', $public_base_url); |
54 |
my $specmod = Test::MockModule->new( 'C4::Context' ); |
58 |
my $specmod = Test::MockModule->new( 'C4::Context' ); |
55 |
$specmod->mock( 'temporary_directory' => sub { return $tempdir; } ); |
59 |
$specmod->mock( 'temporary_directory' => sub { return $tempdir; } ); |
56 |
my $cgimod = Test::MockModule->new( 'CGI' ); |
60 |
my $cgimod = Test::MockModule->new( 'CGI' ); |
Lines 149-155
subtest 'Add same file in same category' => sub {
Link Here
|
149 |
}; |
153 |
}; |
150 |
|
154 |
|
151 |
subtest 'Test delete via UploadedFile as well as UploadedFiles' => sub { |
155 |
subtest 'Test delete via UploadedFile as well as UploadedFiles' => sub { |
152 |
plan tests => 12; |
156 |
plan tests => 14; |
153 |
|
157 |
|
154 |
# add temporary file with same name and contents (file4) |
158 |
# add temporary file with same name and contents (file4) |
155 |
my $upl = Koha::Uploader->new({ tmp => 1 }); |
159 |
my $upl = Koha::Uploader->new({ tmp => 1 }); |
Lines 193-198
subtest 'Test delete via UploadedFile as well as UploadedFiles' => sub {
Link Here
|
193 |
ok( $delete =~ /^(0E0|-1)$/, 'Repeated delete unsuccessful' ); |
197 |
ok( $delete =~ /^(0E0|-1)$/, 'Repeated delete unsuccessful' ); |
194 |
is( -e $path, 1, 'File exists if keep_file is passed on deleting' ); |
198 |
is( -e $path, 1, 'File exists if keep_file is passed on deleting' ); |
195 |
# NOTE: Koha::Object->delete does not return 0E0 (yet?) |
199 |
# NOTE: Koha::Object->delete does not return 0E0 (yet?) |
|
|
200 |
|
201 |
# testing delete direct public path |
202 |
$upl = Koha::Uploader->new({ tmp => 1 }); |
203 |
$upl->cgi; |
204 |
$kohaobj = Koha::UploadedFiles->find( $upl->result ); |
205 |
my $local_public_path = $kohaobj->local_public_path; |
206 |
is( -e $local_public_path, 1, 'Local public file exist after create' ); |
207 |
$delete = $kohaobj->delete; |
208 |
ok( $delete=~/^-?1$/, 'Delete successful' ); |
209 |
isnt( -e $local_public_path, 1, 'Local public file no longer found after delete' ); |
196 |
}; |
210 |
}; |
197 |
|
211 |
|
198 |
subtest 'Test delete_missing' => sub { |
212 |
subtest 'Test delete_missing' => sub { |
199 |
- |
|
|