Bugzilla – Attachment 57261 Details for
Bug 17568
Add the Koha::Patron->library method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17568: Add the Koha::Patron->library method
Bug-17568-Add-the-KohaPatron-library-method.patch (text/plain), 1.94 KB, created by
Jonathan Druart
on 2016-11-07 14:32:52 UTC
(
hide
)
Description:
Bug 17568: Add the Koha::Patron->library method
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-11-07 14:32:52 UTC
Size:
1.94 KB
patch
obsolete
>From f30a0562b832b9f3aeb623f705037a6068a05dc9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 7 Nov 2016 14:24:54 +0000 >Subject: [PATCH] Bug 17568: Add the Koha::Patron->library method > >This method will be convenient when moving code to Koha::Patrons > >Test plan: > prove t/db_dependent/Koha/Patrons.t >should return green >--- > Koha/Patron.pm | 5 +++++ > t/db_dependent/Koha/Patrons.t | 8 +++++++- > 2 files changed, 12 insertions(+), 1 deletion(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 9a2fd18..0da30cf 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -113,6 +113,11 @@ sub image { > return Koha::Patron::Images->find( $self->borrowernumber ) > } > >+sub library { >+ my ( $self ) = @_; >+ return Koha::Library->_new_from_dbic($self->_result->branchcode) >+} >+ > =head3 guarantees > > Returns the guarantees (list of Koha::Patron) of this patron >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 6b85dcc..b050288 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 11; >+use Test::More tests => 12; > use Test::Warn; > > use C4::Members; >@@ -68,6 +68,12 @@ is( Koha::Patrons->search->count, $nb_of_patrons + 2, 'The 2 patrons should have > my $retrieved_patron_1 = Koha::Patrons->find( $new_patron_1->borrowernumber ); > is( $retrieved_patron_1->cardnumber, $new_patron_1->cardnumber, 'Find a patron by borrowernumber should return the correct patron' ); > >+subtest 'library' => sub { >+ plan tests => 2; >+ is( $retrieved_patron_1->library->branchcode, $library->{branchcode}, 'Koha::Patron->library should return the correct library' ); >+ is( ref($retrieved_patron_1->library), 'Koha::Library', 'Koha::Patron->library should return a Koha::Library object' ); >+}; >+ > subtest 'guarantees' => sub { > plan tests => 8; > my $guarantees = $new_patron_1->guarantees; >-- >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 17568
:
57261
|
57280
|
57859