Bugzilla – Attachment 61692 Details for
Bug 18258
Add the Koha::Biblio->subscriptions method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18258: Add the Koha::Biblio->subscriptions method
Bug-18258-Add-the-KohaBiblio-subscriptions-method.patch (text/plain), 2.44 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-03-29 17:51:45 UTC
(
hide
)
Description:
Bug 18258: Add the Koha::Biblio->subscriptions method
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-03-29 17:51:45 UTC
Size:
2.44 KB
patch
obsolete
>From 1d655c88a392eb8aca885aa582abc28ec7862f72 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 13 Mar 2017 15:27:06 -0300 >Subject: [PATCH] Bug 18258: Add the Koha::Biblio->subscriptions method >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Test plan: > prove t/db_dependent/Koha/Biblios.t >should return green > >Signed-off-by: Marc Véron <veron@veron.ch> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Biblio.pm | 17 +++++++++++++++++ > t/db_dependent/Koha/Biblios.t | 19 ++++++++++++++++++- > 2 files changed, 35 insertions(+), 1 deletion(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index d5ca370..a296cd5 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -280,6 +280,23 @@ sub biblioitem { > return $self->{_biblioitem}; > } > >+=head3 subscriptions >+ >+my $subscriptions = $self->subscriptions >+ >+Returns the related Koha::Subscriptions object for this Biblio object >+ >+=cut >+ >+sub subscriptions { >+ my ($self) = @_; >+ >+ $self->{_subscriptions} ||= Koha::Subscriptions->search( { biblionumber => $self->biblionumber } ); >+ >+ return $self->{_subscriptions}; >+} >+ >+ > =head3 type > > =cut >diff --git a/t/db_dependent/Koha/Biblios.t b/t/db_dependent/Koha/Biblios.t >index 2498b86..e16868f 100644 >--- a/t/db_dependent/Koha/Biblios.t >+++ b/t/db_dependent/Koha/Biblios.t >@@ -19,12 +19,13 @@ > > use Modern::Perl; > >-use Test::More tests => 1; >+use Test::More tests => 2; > > use C4::Reserves; > > use Koha::Biblios; > use Koha::Patrons; >+use Koha::Subscriptions; > use t::lib::TestBuilder; > use t::lib::Mocks; > >@@ -52,6 +53,22 @@ subtest 'holds' => sub { > is( $holds->next->borrowernumber, $patron->borrowernumber, '->holds should return the correct hold' ); > }; > >+subtest 'subscriptions' => sub { >+ plan tests => 2; >+ $builder->build( >+ { source => 'Subscription', value => { biblionumber => $biblio->id } } >+ ); >+ $builder->build( >+ { source => 'Subscription', value => { biblionumber => $biblio->id } } >+ ); >+ my $biblio = Koha::Biblios->find( $biblio->id ); >+ my $subscriptions = $biblio->subscriptions; >+ is( ref($subscriptions), 'Koha::Subscriptions', >+ 'Koha::Biblio->subscriptions should return a Koha::Subscriptions object' >+ ); >+ is( $subscriptions->count, 2, 'Koha::Biblio->subscriptions should return the correct number of subscriptions'); >+}; >+ > $schema->storage->txn_rollback; > > 1; >-- >2.7.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 18258
:
61050
|
61121
| 61692 |
61693