Bugzilla – Attachment 121981 Details for
Bug 27064
Transferring an item with a hold allows the user to set a hold waiting without transferring to the correct branch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27064: Correct transferbook.t tests to reflect new behaviour of transferbook()
Bug-27064-Correct-transferbookt-tests-to-reflect-n.patch (text/plain), 5.30 KB, created by
Joonas Kylmälä
on 2021-06-15 09:28:13 UTC
(
hide
)
Description:
Bug 27064: Correct transferbook.t tests to reflect new behaviour of transferbook()
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2021-06-15 09:28:13 UTC
Size:
5.30 KB
patch
obsolete
>From 1cb9228c82eb73291d542bb19390e71d63d751bb Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= <joonas.kylmala@helsinki.fi> >Date: Tue, 15 Jun 2021 11:56:43 +0300 >Subject: [PATCH] Bug 27064: Correct transferbook.t tests to reflect new > behaviour of transferbook() > >The transferbook() behaviour was changed so that it only allows >transferring the item with a reserve if ignore_reserves=1 is passed to >it. The tests are changed here to reflect that. Note that however the >tests were buggy already before this change because the transfer's >"from" and "to" branches were the same and so the transfer should have >failed due to the error DestinationEqualsHolding, but futher though >the transferbook() code was buggy and it override the >DestinationEqualsHolding checking totally if there was a transfer! So >the tests were earlier working due to a bug in transferbook(). > >To test): > 1) Make sure the new test scenarios make sense > 2) prove t/db_dependent/Circulation/transferbook.t >--- > t/db_dependent/Circulation/transferbook.t | 28 ++++++++++------------- > 1 file changed, 12 insertions(+), 16 deletions(-) > >diff --git a/t/db_dependent/Circulation/transferbook.t b/t/db_dependent/Circulation/transferbook.t >index 03c735afbd..2e2ac0fe74 100755 >--- a/t/db_dependent/Circulation/transferbook.t >+++ b/t/db_dependent/Circulation/transferbook.t >@@ -148,7 +148,7 @@ subtest 'transfer already at destination' => sub { > barcode => $item->barcode, > trigger => "Manual" > }); >- is( $dotransfer, 1, 'Transfer of reserved item succeeded without ignore reserves' ); >+ is( $dotransfer, 0, 'Transfer of reserved item doesn\'t succeed without ignore_reserves' ); > is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve"); > is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info"); > }; >@@ -205,15 +205,16 @@ subtest 'transfer an issued item' => sub { > barcode => $item->barcode, > trigger => "Manual" > }); >- is( $dotransfer, 1, 'Transfer of reserved item succeeded without ignore reserves' ); >+ is( $dotransfer, 0, 'Transfer of reserved item doesn\'t succeed without ignore_reserves' ); > is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve"); > is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info"); > is( $messages->{WasReturned}, $patron->borrowernumber, "We got the return info"); > }; > > subtest 'ignore_reserves flag' => sub { >- plan tests => 10; >+ plan tests => 9; > my $library = $builder->build_object( { class => 'Koha::Libraries' } )->store; >+ my $library2 = $builder->build_object( { class => 'Koha::Libraries' } )->store; > t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode } ); > > my $patron = $builder->build_object( >@@ -241,42 +242,37 @@ subtest 'ignore_reserves flag' => sub { > # found will override all other measures that may prevent transfer and force a transfer. > my ($dotransfer, $messages ) = transferbook({ > from_branch => $item->homebranch, >- to_branch => $library->branchcode, >+ to_branch => $library2->branchcode, > barcode => $item->barcode, > trigger => "Manual" > }); >- is( $dotransfer, 1, 'Transfer of reserved item succeeded without ignore reserves' ); >+ is( $dotransfer, 0, 'Transfer of reserved item doesn\'t succeed without ignore_reserves' ); > is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve"); > is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info"); > > my $ignore_reserves = 0; > ($dotransfer, $messages ) = transferbook({ > from_branch => $item->homebranch, >- to_branch => $library->branchcode, >+ to_branch => $library2->branchcode, > barcode => $item->barcode, > ignore_reserves => $ignore_reserves, > trigger => "Manual" > }); >- is( $dotransfer, 1, 'Transfer of reserved item succeeded with ignore reserves: false' ); >+ is( $dotransfer, 0, 'Transfer of reserved item doesn\'t succeed without ignore_reserves' ); > is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve"); > is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info"); > > $ignore_reserves = 1; > ($dotransfer, $messages ) = transferbook({ > from_branch => $item->homebranch, >- to_branch => $library->branchcode, >+ to_branch => $library2->branchcode, > barcode => $item->barcode, > ignore_reserves => $ignore_reserves, > trigger => "Manual" > }); >- is( $dotransfer, 0, 'Transfer of reserved item failed with ignore reserves: true' ); >- is_deeply( >- $messages, >- { 'DestinationEqualsHolding' => 1 }, >- "We got the expected failure message: DestinationEqualsHolding" >- ); >- isnt( $messages->{ResFound}->{ResFound}, 'Reserved', "We did not return that we found a reserve"); >- isnt( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We did not return the reserve info"); >+ is( $dotransfer, 1, 'Transfer of reserved item succeed with ignore reserves: true' ); >+ is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve"); >+ is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info"); > }; > > subtest 'transferbook test from branch' => sub { >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27064
:
113877
|
114712
|
120222
|
120759
|
120764
|
121065
|
121066
|
121067
|
121090
|
121091
|
121092
|
121093
|
121141
|
121142
|
121143
|
121144
|
121670
|
121671
|
121672
|
121673
|
121674
|
121675
|
121676
|
121677
|
121678
|
121679
|
121680
|
121681
|
121682
|
121683
|
121684
|
121685
| 121981