Bugzilla – Attachment 74401 Details for
Bug 20599
Add the Koha::Subscription->vendor method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20599: Add the Koha::Subscription->vendor method
Bug-20599-Add-the-KohaSubscription-vendor-method.patch (text/plain), 2.88 KB, created by
Mark Tompsett
on 2018-04-18 01:21:38 UTC
(
hide
)
Description:
Bug 20599: Add the Koha::Subscription->vendor method
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2018-04-18 01:21:38 UTC
Size:
2.88 KB
patch
obsolete
>From 948f33def9fdeba136c58f630fee39a06048d635 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 17 Apr 2018 18:12:50 -0300 >Subject: [PATCH] Bug 20599: Add the Koha::Subscription->vendor method > >Test plan: > prove t/db_dependent/Koha/Subscription.t >must return green > >NOTE: My preference is for $subscription to be object, > and perhaps something like $built_subscription to > be from the builder. Because, $object is a poor > variable name. > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > Koha/Subscription.pm | 12 ++++++++++++ > t/db_dependent/Koha/Subscription.t | 24 +++++++++++++++++++++--- > 2 files changed, 33 insertions(+), 3 deletions(-) > >diff --git a/Koha/Subscription.pm b/Koha/Subscription.pm >index 2a793e5..d585ba8 100644 >--- a/Koha/Subscription.pm >+++ b/Koha/Subscription.pm >@@ -23,6 +23,7 @@ use Carp; > > use Koha::Database; > use Koha::Biblios; >+use Koha::Acquisition::Booksellers; > > use base qw(Koha::Object); > >@@ -48,6 +49,17 @@ sub biblio { > return scalar Koha::Biblios->find($self->biblionumber); > } > >+=head3 vendor >+ >+Returns the vendor/supplier linked to this subscription as a Koha::Acquisition::Bookseller object >+ >+=cut >+ >+sub vendor { >+ my ($self) = @_; >+ return scalar Koha::Acquisition::Booksellers->find($self->aqbooksellerid); >+} >+ > =head3 type > > =cut >diff --git a/t/db_dependent/Koha/Subscription.t b/t/db_dependent/Koha/Subscription.t >index 46256d3..81c5563 100644 >--- a/t/db_dependent/Koha/Subscription.t >+++ b/t/db_dependent/Koha/Subscription.t >@@ -19,15 +19,19 @@ > > use Modern::Perl; > >-use Test::More tests => 1; >+use Test::More tests => 2; > >-use Koha::Subscription; >+use Koha::Subscriptions; > use Koha::Biblio; > >+use t::lib::TestBuilder; >+ > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; > >-subtest 'Koha::Subscription::biblio' => sub { >+my $builder = t::lib::TestBuilder->new; >+ >+subtest 'Koha::Subscription->biblio' => sub { > plan tests => 1; > > my $biblio = Koha::Biblio->new()->store(); >@@ -39,6 +43,20 @@ subtest 'Koha::Subscription::biblio' => sub { > is($b->biblionumber, $biblio->biblionumber, 'Koha::Subscription::biblio returns the correct biblio'); > }; > >+subtest 'Koha::Subscription->vendor' => sub { >+ plan tests => 2; >+ my $vendor = $builder->build( { source => 'Aqbookseller' } ); >+ my $subscription = $builder->build( >+ { >+ source => 'Subscription', >+ value => { aqbooksellerid => $vendor->{id} } >+ } >+ ); >+ my $object = Koha::Subscriptions->find( $subscription->{subscriptionid} ); >+ is( ref($object->vendor), 'Koha::Acquisition::Bookseller', 'Koha::Subscription->vendor should return a Koha::Acquisition::Bookseller' ); >+ is( $object->vendor->id, $subscription->{aqbooksellerid}, 'Koha::Subscription->vendor should return the correct vendor' ); >+}; >+ > $schema->storage->txn_rollback; > > 1; >-- >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 20599
:
74392
|
74401
|
74403