Lines 23-28
use Test::Warn;
Link Here
|
23 |
|
23 |
|
24 |
use Koha::Preservation::Trains; |
24 |
use Koha::Preservation::Trains; |
25 |
use Koha::Database; |
25 |
use Koha::Database; |
|
|
26 |
use Koha::DateUtils qw( dt_from_string ); |
26 |
|
27 |
|
27 |
use t::lib::TestBuilder; |
28 |
use t::lib::TestBuilder; |
28 |
use t::lib::Mocks; |
29 |
use t::lib::Mocks; |
Lines 52-58
subtest 'default_processing' => sub {
Link Here
|
52 |
}; |
53 |
}; |
53 |
|
54 |
|
54 |
subtest 'add_items & items' => sub { |
55 |
subtest 'add_items & items' => sub { |
55 |
plan tests => 12; |
56 |
plan tests => 13; |
56 |
|
57 |
|
57 |
$schema->storage->txn_begin; |
58 |
$schema->storage->txn_begin; |
58 |
|
59 |
|
Lines 104-108
subtest 'add_items & items' => sub {
Link Here
|
104 |
is( $train->items->count, 3, 'the item has been added to the train' ); |
105 |
is( $train->items->count, 3, 'the item has been added to the train' ); |
105 |
is( $item_2->get_from_storage->notforloan, $not_for_loan_train_in ); |
106 |
is( $item_2->get_from_storage->notforloan, $not_for_loan_train_in ); |
106 |
|
107 |
|
|
|
108 |
my $another_train = $builder->build_object( |
109 |
{ |
110 |
class => 'Koha::Preservation::Trains', |
111 |
value => { |
112 |
not_for_loan => $not_for_loan_train_in, |
113 |
closed_on => undef, |
114 |
sent_on => undef, |
115 |
received_on => undef |
116 |
} |
117 |
} |
118 |
); |
119 |
|
120 |
$train->closed_on(dt_from_string)->store; |
121 |
|
122 |
throws_ok { |
123 |
$another_train->add_item( { item_id => $item_1->itemnumber }, { skip_waiting_list_check => 1 }); |
124 |
} 'Koha::Exceptions::Preservation::ItemAlreadyInAnotherTrain'; |
125 |
|
107 |
$schema->storage->txn_rollback; |
126 |
$schema->storage->txn_rollback; |
108 |
}; |
127 |
}; |
109 |
- |
|
|