Lines 245-251
subtest 'Testing allows_add_by' => sub {
Link Here
|
245 |
}; |
245 |
}; |
246 |
|
246 |
|
247 |
subtest 'Testing delete_temporary' => sub { |
247 |
subtest 'Testing delete_temporary' => sub { |
248 |
plan tests => 7; |
248 |
plan tests => 6; |
249 |
|
249 |
|
250 |
# Add two temporary files: result should be 3 + 3 |
250 |
# Add two temporary files: result should be 3 + 3 |
251 |
Koha::Uploader->new({ tmp => 1 })->cgi; # add file6 and file7 |
251 |
Koha::Uploader->new({ tmp => 1 })->cgi; # add file6 and file7 |
Lines 268-288
subtest 'Testing delete_temporary' => sub {
Link Here
|
268 |
$recs[1]->dtcreated($dt)->store; |
268 |
$recs[1]->dtcreated($dt)->store; |
269 |
$recs[2]->dtcreated($dt)->store; |
269 |
$recs[2]->dtcreated($dt)->store; |
270 |
|
270 |
|
271 |
# Now call delete_temporary with 0, 6, 5 and 1 (via override) |
271 |
# Now call delete_temporary with 6, 5 and 0 |
272 |
t::lib::Mocks::mock_preference('UploadPurgeTemporaryFilesDays', 0 ); |
|
|
273 |
Koha::UploadedFiles->delete_temporary; |
274 |
is( Koha::UploadedFiles->search->count, 6, 'Delete with pref==0' ); |
275 |
|
276 |
t::lib::Mocks::mock_preference('UploadPurgeTemporaryFilesDays', 6 ); |
272 |
t::lib::Mocks::mock_preference('UploadPurgeTemporaryFilesDays', 6 ); |
277 |
Koha::UploadedFiles->delete_temporary; |
273 |
Koha::UploadedFiles->delete_temporary; |
278 |
is( Koha::UploadedFiles->search->count, 6, 'Delete with pref==6' ); |
274 |
is( Koha::UploadedFiles->search->count, 6, 'Delete with pref==6' ); |
279 |
|
275 |
|
280 |
t::lib::Mocks::mock_preference('UploadPurgeTemporaryFilesDays', 5 ); |
276 |
# use override parameter |
281 |
Koha::UploadedFiles->delete_temporary; |
277 |
Koha::UploadedFiles->delete_temporary({ override_pref => 5 }); |
282 |
is( Koha::UploadedFiles->search->count, 4, 'Delete with pref==5 makes 4' ); |
278 |
is( Koha::UploadedFiles->search->count, 4, 'Delete with override==5' ); |
283 |
|
279 |
|
284 |
Koha::UploadedFiles->delete_temporary({ override_pref => 1 }); |
280 |
t::lib::Mocks::mock_preference('UploadPurgeTemporaryFilesDays', 0 ); |
285 |
is( Koha::UploadedFiles->search->count, 3, 'Delete override==1 makes 3' ); |
281 |
Koha::UploadedFiles->delete_temporary; |
|
|
282 |
is( Koha::UploadedFiles->search->count, 3, 'Delete with pref==0 makes 3' ); |
286 |
is( Koha::UploadedFiles->search({ permanent => 1 })->count, 3, |
283 |
is( Koha::UploadedFiles->search({ permanent => 1 })->count, 3, |
287 |
'Still 3 permanent uploads' ); |
284 |
'Still 3 permanent uploads' ); |
288 |
}; |
285 |
}; |
289 |
- |
|
|