|
Lines 17-30
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 3; |
20 |
use Test::More tests => 4; |
| 21 |
use Test::Exception; |
21 |
use Test::Exception; |
| 22 |
|
22 |
|
| 23 |
use Koha::Database; |
23 |
use Koha::Database; |
| 24 |
use Koha::BackgroundJobs; |
24 |
use Koha::BackgroundJobs; |
| 25 |
use Koha::BackgroundJob::BatchUpdateItem; |
25 |
use Koha::BackgroundJob::BatchUpdateItem; |
| 26 |
|
26 |
|
| 27 |
use JSON qw( decode_json ); |
27 |
use JSON qw( decode_json encode_json ); |
| 28 |
|
28 |
|
| 29 |
use t::lib::Mocks; |
29 |
use t::lib::Mocks; |
| 30 |
use t::lib::TestBuilder; |
30 |
use t::lib::TestBuilder; |
|
Lines 143-145
subtest 'start(), step() and finish() tests' => sub {
Link Here
|
| 143 |
|
143 |
|
| 144 |
$schema->storage->txn_rollback; |
144 |
$schema->storage->txn_rollback; |
| 145 |
}; |
145 |
}; |
| 146 |
- |
146 |
|
|
|
147 |
subtest 'decoded_data() and set_encoded_data() tests' => sub { |
| 148 |
|
| 149 |
plan tests => 3; |
| 150 |
|
| 151 |
my $job = Koha::BackgroundJob::BatchUpdateItem->new->set_encoded_data( undef ); |
| 152 |
is( $job->decoded_data, undef ); |
| 153 |
|
| 154 |
my $data = { some => 'data' }; |
| 155 |
|
| 156 |
$job->set_encoded_data( $data ); |
| 157 |
|
| 158 |
is_deeply( decode_json($job->data), $data ); |
| 159 |
is_deeply( $job->decoded_data, $data ); |
| 160 |
}; |