Lines 38-44
my $builder = t::lib::TestBuilder->new;
Link Here
|
38 |
|
38 |
|
39 |
subtest '_derived_class() tests' => sub { |
39 |
subtest '_derived_class() tests' => sub { |
40 |
|
40 |
|
41 |
plan tests => 3; |
41 |
plan tests => 6; |
|
|
42 |
|
43 |
t::lib::Mocks::mock_config( 'enable_plugins', 0 ); |
42 |
|
44 |
|
43 |
$schema->storage->txn_begin; |
45 |
$schema->storage->txn_begin; |
44 |
|
46 |
|
Lines 64-69
subtest '_derived_class() tests' => sub {
Link Here
|
64 |
|
66 |
|
65 |
is_deeply( $job->unblessed, $derived->unblessed, '_derived_class object refers to the same DB object and can be manipulated as expected' ); |
67 |
is_deeply( $job->unblessed, $derived->unblessed, '_derived_class object refers to the same DB object and can be manipulated as expected' ); |
66 |
|
68 |
|
|
|
69 |
t::lib::Mocks::mock_config( 'enable_plugins', 1 ); |
70 |
|
71 |
$job_object = Koha::BackgroundJob->new(); |
72 |
$mapping = $job_object->type_to_class_mapping; |
73 |
|
74 |
# pick the first |
75 |
$type = ( keys %{$mapping} )[0]; |
76 |
|
77 |
$job = $builder->build_object( |
78 |
{ class => 'Koha::BackgroundJobs', |
79 |
value => { type => $type, data => 'Foo' } |
80 |
} |
81 |
); |
82 |
|
83 |
$derived = $job->_derived_class; |
84 |
|
85 |
is( ref($derived), $mapping->{$type}, 'Job object class is correct' ); |
86 |
ok( $derived->in_storage, 'The object is correctly marked as in storage' ); |
87 |
|
88 |
$derived->data('Bar')->store->discard_changes; |
89 |
$job->discard_changes; |
90 |
|
91 |
is_deeply( $job->unblessed, $derived->unblessed, '_derived_class object refers to the same DB object and can be manipulated as expected' ); |
92 |
|
67 |
$schema->storage->txn_rollback; |
93 |
$schema->storage->txn_rollback; |
68 |
}; |
94 |
}; |
69 |
|
95 |
|
70 |
- |
|
|