Lines 149-155
subtest 'Add same file in same category' => sub {
Link Here
|
149 |
}; |
149 |
}; |
150 |
|
150 |
|
151 |
subtest 'Test delete via UploadedFile as well as UploadedFiles' => sub { |
151 |
subtest 'Test delete via UploadedFile as well as UploadedFiles' => sub { |
152 |
plan tests => 10; |
152 |
plan tests => 12; |
153 |
|
153 |
|
154 |
# add temporary file with same name and contents (file4) |
154 |
# add temporary file with same name and contents (file4) |
155 |
my $upl = Koha::Uploader->new({ tmp => 1 }); |
155 |
my $upl = Koha::Uploader->new({ tmp => 1 }); |
Lines 186-194
subtest 'Test delete via UploadedFile as well as UploadedFiles' => sub {
Link Here
|
186 |
# add another one with TestBuilder and delete twice (file does not exist) |
186 |
# add another one with TestBuilder and delete twice (file does not exist) |
187 |
$upload01 = $builder->build({ source => 'UploadedFile' }); |
187 |
$upload01 = $builder->build({ source => 'UploadedFile' }); |
188 |
$kohaobj = Koha::UploadedFiles->find( $upload01->{id} ); |
188 |
$kohaobj = Koha::UploadedFiles->find( $upload01->{id} ); |
|
|
189 |
$path = $kohaobj->full_path; |
190 |
is( -e $path, 1, 'File exists after creation'); |
189 |
$delete = $kohaobj->delete({ keep_file => 1 }); |
191 |
$delete = $kohaobj->delete({ keep_file => 1 }); |
190 |
$delete = $kohaobj->delete({ keep_file => 1 }); |
192 |
$delete = $kohaobj->delete({ keep_file => 1 }); |
191 |
ok( $delete =~ /^(0E0|-1)$/, 'Repeated delete unsuccessful' ); |
193 |
ok( $delete =~ /^(0E0|-1)$/, 'Repeated delete unsuccessful' ); |
|
|
194 |
is( -e $path, 1, 'File exists if keep_file is passed on deleting' ); |
192 |
# NOTE: Koha::Object->delete does not return 0E0 (yet?) |
195 |
# NOTE: Koha::Object->delete does not return 0E0 (yet?) |
193 |
}; |
196 |
}; |
194 |
|
197 |
|
195 |
- |
|
|