|
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 152-154
subtest 'start(), step() and finish() tests' => sub {
Link Here
|
| 152 |
|
152 |
|
| 153 |
$schema->storage->txn_rollback; |
153 |
$schema->storage->txn_rollback; |
| 154 |
}; |
154 |
}; |
| 155 |
- |
155 |
|
|
|
156 |
subtest 'decoded_data() and set_encoded_data() tests' => sub { |
| 157 |
|
| 158 |
plan tests => 3; |
| 159 |
|
| 160 |
my $job = Koha::BackgroundJob::BatchUpdateItem->new->set_encoded_data( undef ); |
| 161 |
is( $job->decoded_data, undef ); |
| 162 |
|
| 163 |
my $data = { some => 'data' }; |
| 164 |
|
| 165 |
$job->set_encoded_data( $data ); |
| 166 |
|
| 167 |
is_deeply( decode_json($job->data), $data ); |
| 168 |
is_deeply( $job->decoded_data, $data ); |
| 169 |
}; |