Bugzilla – Attachment 137642 Details for
Bug 31086
Do not allow hold requests with no branchcode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31086: (QA follow-up) Add unit tests
Bug-31086-QA-follow-up-Add-unit-tests.patch (text/plain), 1.97 KB, created by
Martin Renvoize (ashimema)
on 2022-07-12 15:25:18 UTC
(
hide
)
Description:
Bug 31086: (QA follow-up) Add unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-07-12 15:25:18 UTC
Size:
1.97 KB
patch
obsolete
>From 0147ae8485ca161250efa5213eef137d47248964 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 12 Jul 2022 16:22:46 +0100 >Subject: [PATCH] Bug 31086: (QA follow-up) Add unit tests > >This patch adds the unit tests for the change to Koha::Hold::store. > >We test for and catch the exception introduced for both the create and >update cases. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Koha/Hold.t | 32 +++++++++++++++++++++++++++++++- > 1 file changed, 31 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Hold.t b/t/db_dependent/Koha/Hold.t >index 8c32bda3f7..db5189db40 100755 >--- a/t/db_dependent/Koha/Hold.t >+++ b/t/db_dependent/Koha/Hold.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 6; >+use Test::More tests => 7; > > use Test::Exception; > use Test::MockModule; >@@ -36,6 +36,36 @@ use Koha::Old::Holds; > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; > >+subtest 'store() tests' => sub { >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $item = $builder->build_sample_item; >+ throws_ok { >+ Koha::Hold->new( >+ { >+ borrowernumber => $patron->borrowernumber, >+ biblionumber => $item->biblionumber, >+ priority => 1, >+ itemnumber => $item->itemnumber, >+ } >+ )->store >+ } >+ 'Koha::Exceptions::Hold::MissingPickupLocation', >+ 'Exception thrown because branchcode was not passed'; >+ >+ my $hold = $builder->build_object( { class => 'Koha::Holds' } ); >+ throws_ok { >+ $hold->branchcode(undef)->store; >+ } >+ 'Koha::Exceptions::Hold::MissingPickupLocation', >+ 'Exception thrown if one tries to set branchcode to null'; >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'fill() tests' => sub { > > plan tests => 13; >-- >2.20.1
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 31086
:
136983
|
136984
|
136986
|
136987
|
137026
|
137254
|
137255
|
137256
|
137257
|
137258
|
137635
|
137636
|
137637
|
137638
|
137639
|
137640
|
137641
| 137642 |
138006
|
138018
|
138051
|
144824