Bugzilla – Attachment 95695 Details for
Bug 24013
Transferring a checked out item gives a software error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24013: Add tests
Bug-24013-Add-tests.patch (text/plain), 2.22 KB, created by
Martin Renvoize
on 2019-11-21 16:41:38 UTC
(
hide
)
Description:
Bug 24013: Add tests
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2019-11-21 16:41:38 UTC
Size:
2.22 KB
patch
obsolete
>From dd086202d99942f6ee71b63f4a301ed24a87a9cf Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 20 Nov 2019 11:55:55 +0100 >Subject: [PATCH] Bug 24013: Add tests > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Circulation/transferbook.t | 33 ++++++++++++++++++++++- > 1 file changed, 32 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation/transferbook.t b/t/db_dependent/Circulation/transferbook.t >index 88651b8cec..886534a29f 100644 >--- a/t/db_dependent/Circulation/transferbook.t >+++ b/t/db_dependent/Circulation/transferbook.t >@@ -17,10 +17,12 @@ > > use Modern::Perl; > >-use Test::More tests => 1; >+use Test::More tests => 2; > use t::lib::TestBuilder; >+use t::lib::Mocks; > > use C4::Circulation; >+use Koha::DateUtils qw( dt_from_string ); > > my $builder = t::lib::TestBuilder->new; > >@@ -33,3 +35,32 @@ my $badbc = 'wherethehelldoyoucomefrom'; > @got = C4::Circulation::transferbook( $library->{branchcode}, $badbc ); > @wanted = ( 0, { 'BadBarcode' => $badbc } ); > is_deeply( \@got , \@wanted, 'bad barcode case'); >+ >+subtest 'transfer an issued item' => sub { >+ plan tests => 1; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } )->store; >+ t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode } ); >+ >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { branchcode => $library->branchcode } >+ } >+ ); >+ >+ my $item = $builder->build_sample_item( >+ { >+ library => $library->branchcode, >+ } >+ ); >+ >+ my $dt_to = dt_from_string(); >+ my $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to ); >+ >+ # We are making sure there is no regression, feel free to change the behavior if needed. >+ # * WasReturned does not seem like a variable that should contain a borrowernumber >+ # * Should we return even if the transfer did not happen? (same branches) >+ my @got = transferbook( $library->branchcode, $item->barcode ); >+ is( $got[1]->{WasReturned}, $patron->borrowernumber, 'transferbook should have return a WasReturned flag is the item was issued before the transferbook call'); >+}; >-- >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 24013
:
95608
|
95609
|
95695
|
95696
|
95755
|
95756