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

(-)a/t/db_dependent/Koha/BackgroundJob/BatchUpdateBiblioHoldsQueue.t (-2 / +22 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::NoWarnings;
20
use Test::NoWarnings;
21
use Test::More tests => 2;
21
use Test::More tests => 3;
22
use Test::Exception;
22
use Test::Exception;
23
23
24
use Koha::Database;
24
use Koha::Database;
Lines 61-63 subtest 'enqueue() tests' => sub { Link Here
61
61
62
    $schema->storage->txn_rollback;
62
    $schema->storage->txn_rollback;
63
};
63
};
64
- 
64
65
subtest 'prevent duplicate jobs tests' => sub {
66
67
    plan tests => 4;
68
69
    $schema->storage->txn_begin;
70
71
    t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 1 );
72
73
    Koha::BackgroundJobs->search()->delete();
74
75
    my $job_id = Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => [1] } );
76
    isnt( $job_id, undef, "Job id was returned for background job with no duplicate" );
77
    is( Koha::BackgroundJobs->search()->count(), 1, "Found one enqueued background job" );
78
79
    $job_id = Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => [1] } );
80
    is( $job_id,                                 undef, "No job id was returned for background job with duplicate" );
81
    is( Koha::BackgroundJobs->search()->count(), 1,     "Still found one enqueued background job" );
82
83
    $schema->storage->txn_rollback;
84
};

Return to bug 41248