Bugzilla – Attachment 101077 Details for
Bug 24299
Record if a transfer was triggered by 'rotating collections'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24299: Add Unit test for 'reason' in transferbook
Bug-24299-Add-Unit-test-for-reason-in-transferbook.patch (text/plain), 2.90 KB, created by
Martin Renvoize (ashimema)
on 2020-03-20 11:16:59 UTC
(
hide
)
Description:
Bug 24299: Add Unit test for 'reason' in transferbook
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-03-20 11:16:59 UTC
Size:
2.90 KB
patch
obsolete
>From 9917a9fc67ac920d70351b4e08ae6efcf00fc456 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 20 Mar 2020 11:15:54 +0000 >Subject: [PATCH] Bug 24299: Add Unit test for 'reason' in transferbook > >Test plan >1/ Run test and verify it passes >2/ Signoff >--- > t/db_dependent/Circulation/transferbook.t | 52 ++++++++++++++++++++++- > 1 file changed, 50 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Circulation/transferbook.t b/t/db_dependent/Circulation/transferbook.t >index 042830743c..efc7c3021d 100644 >--- a/t/db_dependent/Circulation/transferbook.t >+++ b/t/db_dependent/Circulation/transferbook.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 4; >+use Test::More tests => 5; > use t::lib::TestBuilder; > use t::lib::Mocks; > >@@ -47,6 +47,54 @@ subtest 'transfer a non-existant item' => sub { > ); > }; > >+subtest 'field population tests' => sub { >+ plan tests => 5; >+ >+ my $dbh = C4::Context->dbh; >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } )->store; >+ t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode } ); >+ >+ my $library2 = $builder->build_object( { class => 'Koha::Libraries' } )->store; >+ >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { branchcode => $library->branchcode } >+ } >+ ); >+ >+ my $item = $builder->build_sample_item( >+ { >+ library => $library->branchcode, >+ } >+ ); >+ >+ my $trigger = "Manual"; >+ my ($dotransfer, $messages ) = transferbook( $library2->branchcode, $item->barcode, undef, $trigger ); >+ is( $dotransfer, 1, 'Transfer succeeded' ); >+ is_deeply( >+ $messages, >+ { 'WasTransfered' => 1 }, >+ "WasTransfered was set correctly" >+ ); >+ >+ my $query = ' >+ SELECT datesent, >+ frombranch, >+ tobranch, >+ reason >+ FROM branchtransfers >+ WHERE itemnumber = ? >+ AND datearrived IS NULL >+ '; >+ my $sth = $dbh->prepare($query); >+ $sth->execute($item->itemnumber); >+ my ($datesent, $frombranch, $tobranch, $reason) = $sth->fetchrow_array(); >+ is ($frombranch, $library->branchcode, 'frombranch set correctly'); >+ is ($tobranch, $library2->branchcode, 'tobranch set correctly'); >+ is ($reason, $trigger, 'reason set if passed'); >+}; >+ > #FIXME:'UseBranchTransferLimits tests missing > > subtest 'transfer already at destination' => sub { >@@ -69,7 +117,7 @@ subtest 'transfer already at destination' => sub { > ); > > my ($dotransfer, $messages ) = transferbook( $library->branchcode, $item->barcode ); >- is( $dotransfer, 0, 'Transfer of reserved item failed with ignore reserves: true' ); >+ is( $dotransfer, 0, 'Transfer of item failed when destination equals holding branch' ); > is_deeply( > $messages, > { 'DestinationEqualsHolding' => 1 }, >-- >2.20.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 24299
:
97464
|
97465
|
97508
|
97509
|
97537
|
97538
|
98295
|
98296
|
100626
|
100627
|
101075
|
101076
|
101077
|
101083
|
101084
|
101085
|
101086
|
101097