Bugzilla – Attachment 59442 Details for
Bug 17973
Add the Koha::Checkout->item method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17973: Add the Koha::Checkout->item method
Bug-17973-Add-the-KohaCheckout-item-method.patch (text/plain), 1.88 KB, created by
Jonathan Druart
on 2017-01-23 17:01:07 UTC
(
hide
)
Description:
Bug 17973: Add the Koha::Checkout->item method
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-01-23 17:01:07 UTC
Size:
1.88 KB
patch
obsolete
>From 0b0b37860978653016e5d71a24ffed19065c3de9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sat, 21 Jan 2017 16:47:03 +0100 >Subject: [PATCH] Bug 17973: Add the Koha::Checkout->item method > >Test plan: > prove t/db_dependent/Koha/Checkouts.t >should return green >--- > Koha/Checkout.pm | 15 +++++++++++++++ > t/db_dependent/Koha/Checkouts.t | 9 ++++++++- > 2 files changed, 23 insertions(+), 1 deletion(-) > >diff --git a/Koha/Checkout.pm b/Koha/Checkout.pm >index a1a67d6..40a7ad7 100644 >--- a/Koha/Checkout.pm >+++ b/Koha/Checkout.pm >@@ -25,6 +25,7 @@ use Carp; > use Koha::Database; > use DateTime; > use Koha::DateUtils; >+use Koha::Items; > > use base qw(Koha::Object); > >@@ -59,6 +60,20 @@ sub is_overdue { > return $is_overdue; > } > >+=head3 item >+ >+my $item = $checkout->item; >+ >+Return the checked out item >+ >+=cut >+ >+sub item { >+ my ( $self ) = @_; >+ my $item_rs = $self->_result->item; >+ return Koha::Item->_new_from_dbic( $item_rs ); >+} >+ > =head3 type > > =cut >diff --git a/t/db_dependent/Koha/Checkouts.t b/t/db_dependent/Koha/Checkouts.t >index ba85bb2..a8eaa69 100644 >--- a/t/db_dependent/Koha/Checkouts.t >+++ b/t/db_dependent/Koha/Checkouts.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 5; >+use Test::More tests => 6; > > use Koha::Checkouts; > use Koha::Database; >@@ -86,6 +86,13 @@ subtest 'is_overdue' => sub { > 0, 'In Ten days, the item due yesterday will still be late' ); > }; > >+subtest 'item' => sub { >+ plan tests => 2; >+ my $item = $retrieved_checkout_1->item; >+ is( ref( $item ), 'Koha::Item', 'Koha::Checkout->item should return a Koha::Item' ); >+ is( $item->itemnumber, $item_1->{itemnumber}, 'Koha::Checkout->item should return the correct item' ); >+}; >+ > $retrieved_checkout_1->delete; > is( Koha::Checkouts->search->count, $nb_of_checkouts + 1, 'Delete should have deleted the checkout' ); > >-- >2.1.4
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 17973
:
59442
|
59465
|
60398