Bugzilla – Attachment 89650 Details for
Bug 22891
ILS-DI: RenewLoan explodes in error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22891: Add tests
Bug-22891-Add-tests.patch (text/plain), 2.28 KB, created by
Marcel de Rooy
on 2019-05-13 09:29:40 UTC
(
hide
)
Description:
Bug 22891: Add tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2019-05-13 09:29:40 UTC
Size:
2.28 KB
patch
obsolete
>From ed545a4407cda2067e3aa6217d324338841116e6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sun, 12 May 2019 11:48:11 -0500 >Subject: [PATCH] Bug 22891: Add tests >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/ILSDI_Services.t | 37 ++++++++++++++++++++++++++++++++++++- > 1 file changed, 36 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t >index d102836386..13dbc0089c 100644 >--- a/t/db_dependent/ILSDI_Services.t >+++ b/t/db_dependent/ILSDI_Services.t >@@ -19,7 +19,7 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > >-use Test::More tests => 7; >+use Test::More tests => 8; > use Test::MockModule; > use t::lib::Mocks; > use t::lib::TestBuilder; >@@ -596,3 +596,38 @@ subtest 'GetRecords' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'RenewHold' => sub { >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $cgi = new CGI; >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $item = $builder->build_object( { class => 'Koha::Items' } ); >+ $cgi->param( patron_id => $patron->borrowernumber ); >+ $cgi->param( item_id => $item->itemnumber ); >+ >+ t::lib::Mocks::mock_userenv( { patron => $patron } ); # For AddIssue >+ my $checkout = C4::Circulation::AddIssue( $patron->unblessed, $item->barcode ); >+ >+ # Everything is ok >+ my $reply = C4::ILSDI::Services::RenewLoan($cgi); >+ is( exists $reply->{date_due}, 1, 'If the item is checked out, the date_due key should exist' ); >+ >+ # The item is not checked out >+ $checkout->delete; >+ $reply = C4::ILSDI::Services::RenewLoan($cgi); >+ is( $reply, undef, 'If the item is not checked out, we should not explode.'); # FIXME We should return an error code instead >+ >+ # The item does not exist >+ $item->delete; >+ $reply = C4::ILSDI::Services::RenewLoan($cgi); >+ is( $reply->{code}, 'RecordNotFound', 'If the item does not exist, RecordNotFound should be returned'); >+ >+ $patron->delete; >+ $reply = C4::ILSDI::Services::RenewLoan($cgi); >+ is( $reply->{code}, 'PatronNotFound', 'If the patron does not exist, PatronNotFound should be returned'); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.11.0
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 22891
:
89640
|
89641
| 89650 |
89651