Lines 26-31
use Test::Exception;
Link Here
|
26 |
use Koha::Database; |
26 |
use Koha::Database; |
27 |
use Koha::BackgroundJobs; |
27 |
use Koha::BackgroundJobs; |
28 |
use Koha::BackgroundJob::BatchUpdateItem; |
28 |
use Koha::BackgroundJob::BatchUpdateItem; |
|
|
29 |
use Koha::BackgroundJob::MARCImportCommitBatch; |
29 |
|
30 |
|
30 |
use t::lib::Mocks; |
31 |
use t::lib::Mocks; |
31 |
use t::lib::Mocks::Logger; |
32 |
use t::lib::Mocks::Logger; |
Lines 69-78
subtest '_derived_class() tests' => sub {
Link Here
|
69 |
|
70 |
|
70 |
subtest 'enqueue() tests' => sub { |
71 |
subtest 'enqueue() tests' => sub { |
71 |
|
72 |
|
72 |
plan tests => 8; |
73 |
plan tests => 10; |
73 |
|
74 |
|
74 |
$schema->storage->txn_begin; |
75 |
$schema->storage->txn_begin; |
75 |
|
76 |
|
|
|
77 |
# Enqueue without args |
78 |
throws_ok { Koha::BackgroundJob::BatchUpdateItem->new->enqueue } |
79 |
'Koha::Exceptions::BackgroundJob', |
80 |
'Enqueue BatchUpdateItem without data throws exception'; |
81 |
|
82 |
# The following test needs a mock to trigger the exception |
83 |
my $mock = Test::MockModule->new('Net::Stomp')->mock( 'send_with_receipt', 0 ); |
84 |
throws_ok { Koha::BackgroundJob::MARCImportCommitBatch->new->enqueue } |
85 |
'Koha::Exceptions::BackgroundJob', |
86 |
'Enqueue MARCImportCommitBatch with mock throws exception'; |
87 |
$mock->unmock('send_with_receipt'); |
88 |
|
76 |
# FIXME: This all feels we need to do it better... |
89 |
# FIXME: This all feels we need to do it better... |
77 |
my $job_id = Koha::BackgroundJob::BatchUpdateItem->new->enqueue( { record_ids => [ 1, 2 ] } ); |
90 |
my $job_id = Koha::BackgroundJob::BatchUpdateItem->new->enqueue( { record_ids => [ 1, 2 ] } ); |
78 |
my $job = Koha::BackgroundJobs->find($job_id)->_derived_class; |
91 |
my $job = Koha::BackgroundJobs->find($job_id)->_derived_class; |
79 |
- |
|
|