Bugzilla – Attachment 129078 Details for
Bug 29804
Koha::Hold->is_pickup_location_valid explodes if empty list of pickup locations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29804: Regression tests
Bug-29804-Regression-tests.patch (text/plain), 2.73 KB, created by
Martin Renvoize (ashimema)
on 2022-01-06 13:33:21 UTC
(
hide
)
Description:
Bug 29804: Regression tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-01-06 13:33:21 UTC
Size:
2.73 KB
patch
obsolete
>From 57e26f595fe250d848f00726ef02fd4cb6114cca Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 6 Jan 2022 07:11:02 -0300 >Subject: [PATCH] Bug 29804: Regression tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Koha/Hold.t | 48 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 47 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Hold.t b/t/db_dependent/Koha/Hold.t >index 5f6a9016c8..addf0e4ae4 100755 >--- a/t/db_dependent/Koha/Hold.t >+++ b/t/db_dependent/Koha/Hold.t >@@ -147,7 +147,7 @@ subtest 'set_pickup_location() tests' => sub { > > subtest 'is_pickup_location_valid() tests' => sub { > >- plan tests => 4; >+ plan tests => 5; > > $schema->storage->txn_begin; > >@@ -200,5 +200,51 @@ subtest 'is_pickup_location_valid() tests' => sub { > ok( !$item_hold->is_pickup_location_valid({ library_id => $library_1->branchcode }), 'Pickup location invalid'); > ok( $item_hold->is_pickup_location_valid({ library_id => $library_2->id }), 'Pickup location valid' ); > >+ subtest 'pickup_locations() returning ->empty' => sub { >+ >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ my $library = $builder->build_object({ class => 'Koha::Libraries' }); >+ >+ my $mock_item = Test::MockModule->new('Koha::Item'); >+ $mock_item->mock( 'pickup_locations', sub { return Koha::Libraries->new->empty; } ); >+ >+ my $mock_biblio = Test::MockModule->new('Koha::Biblio'); >+ $mock_biblio->mock( 'pickup_locations', sub { return Koha::Libraries->new->empty; } ); >+ >+ my $item = $builder->build_sample_item(); >+ my $biblio = $item->biblio; >+ >+ # Test biblio-level holds >+ my $biblio_hold = $builder->build_object( >+ { >+ class => "Koha::Holds", >+ value => { >+ biblionumber => $biblio->biblionumber, >+ itemnumber => undef, >+ } >+ } >+ ); >+ >+ ok( !$biblio_hold->is_pickup_location_valid({ library_id => $library->branchcode }), 'Pickup location invalid'); >+ >+ # Test item-level holds >+ my $item_hold = $builder->build_object( >+ { >+ class => "Koha::Holds", >+ value => { >+ biblionumber => $biblio->biblionumber, >+ itemnumber => $item->itemnumber, >+ } >+ } >+ ); >+ >+ ok( !$item_hold->is_pickup_location_valid({ library_id => $library->branchcode }), 'Pickup location invalid'); >+ >+ $schema->storage->txn_rollback; >+ }; >+ > $schema->storage->txn_rollback; > }; >-- >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 29804
:
129048
|
129049
|
129054
|
129055
| 129078 |
129079