Bug 35100: Unit tests
This patch adds a unit test to ensure StockrotationAdvance transfers are not cancelled from request_transfer when called with 'replace'. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
5b8cb21fb9
commit
08cecd6c6f
1 changed files with 19 additions and 1 deletions
|
@ -846,7 +846,7 @@ subtest 'pickup_locations() tests' => sub {
|
|||
};
|
||||
|
||||
subtest 'request_transfer' => sub {
|
||||
plan tests => 13;
|
||||
plan tests => 17;
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $library1 = $builder->build_object( { class => 'Koha::Libraries' } );
|
||||
|
@ -906,6 +906,24 @@ subtest 'request_transfer' => sub {
|
|||
is($transfers->count, 1, "There is only 1 live transfer in the queue");
|
||||
$replaced_transfer->datearrived(dt_from_string)->store();
|
||||
|
||||
# Replace StockrotationAdvance transfer
|
||||
my $stock_transfer = $item->request_transfer( { to => $library1, reason => 'StockrotationAdvance' } );
|
||||
is(
|
||||
ref($stock_transfer), 'Koha::Item::Transfer',
|
||||
'Koha::Item->request_transfer added StockrotationAdvance transfer'
|
||||
);
|
||||
$replaced_transfer = $item->request_transfer( { to => $library2, reason => 'Manual', replace => 1 } );
|
||||
is(
|
||||
ref($replaced_transfer), 'Koha::Item::Transfer',
|
||||
'Koha::Item->request_transfer allowed when replace is set'
|
||||
);
|
||||
$stock_transfer->discard_changes;
|
||||
is( $stock_transfer->datecancelled, undef, "StockrotationAdvance transfer left intact" );
|
||||
$transfers = $item->get_transfers;
|
||||
is( $transfers->count, 2, "There are now 2 live transfers in the queue" );
|
||||
$replaced_transfer->datearrived(dt_from_string)->store();
|
||||
$stock_transfer->datearrived(dt_from_string)->store();
|
||||
|
||||
# BranchTransferLimits
|
||||
t::lib::Mocks::mock_preference('UseBranchTransferLimits', 1);
|
||||
t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype');
|
||||
|
|
Loading…
Reference in a new issue