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

(-)a/t/db_dependent/Koha/BackgroundJobs.t (-3 / +3 lines)
Lines 146-151 subtest 'search_limited' => sub { Link Here
146
subtest 'purge' => sub {
146
subtest 'purge' => sub {
147
    plan tests => 9;
147
    plan tests => 9;
148
    $schema->storage->txn_begin;
148
    $schema->storage->txn_begin;
149
    my $cnt_finished = Koha::BackgroundJobs->search({ status => 'finished' })->count;
149
150
150
    my $recent_date = dt_from_string;
151
    my $recent_date = dt_from_string;
151
    my $old_date = dt_from_string->subtract({ days => 3 });
152
    my $old_date = dt_from_string->subtract({ days => 3 });
Lines 161-167 subtest 'purge' => sub { Link Here
161
    is( Koha::BackgroundJobs->purge($params), 1, 'Only the old finished type1 job would be purged' );
162
    is( Koha::BackgroundJobs->purge($params), 1, 'Only the old finished type1 job would be purged' );
162
163
163
    $params->{'job_types'} = ['all'];
164
    $params->{'job_types'} = ['all'];
164
    is( Koha::BackgroundJobs->purge($params), 2, 'All finished old jobs would be purged with job_types = all' );
165
    is( Koha::BackgroundJobs->purge($params), $cnt_finished + 2, 'All finished old jobs would be purged with job_types = all' );
165
166
166
    my $rs = Koha::BackgroundJobs->search(
167
    my $rs = Koha::BackgroundJobs->search(
167
        {
168
        {
Lines 182-188 subtest 'purge' => sub { Link Here
182
    is( $rs->count, 3, '3 jobs still left in queue');
183
    is( $rs->count, 3, '3 jobs still left in queue');
183
184
184
    $params->{'job_types'} = ['all'];
185
    $params->{'job_types'} = ['all'];
185
    is( Koha::BackgroundJobs->purge($params), 1, 'The remaining old finished jobs is purged' );
186
    is( Koha::BackgroundJobs->purge($params), $cnt_finished + 1, 'The remaining old finished jobs is purged' );
186
        $rs = Koha::BackgroundJobs->search(
187
        $rs = Koha::BackgroundJobs->search(
187
        {
188
        {
188
            id => [ $job_recent_t1_new->id, $job_recent_t2_fin->id, $job_old_t1_fin->id, $job_old_t2_fin->id ]
189
            id => [ $job_recent_t1_new->id, $job_recent_t2_fin->id, $job_old_t1_fin->id, $job_old_t2_fin->id ]
189
- 

Return to bug 32304