Bugzilla – Attachment 108785 Details for
Bug 18501
Automatic refunds need protection from failure
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18501: (follow-up) Test undefined userenv behaviour
Bug-18501-follow-up-Test-undefined-userenv-behavio.patch (text/plain), 3.19 KB, created by
Martin Renvoize (ashimema)
on 2020-08-21 09:26:19 UTC
(
hide
)
Description:
Bug 18501: (follow-up) Test undefined userenv behaviour
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-08-21 09:26:19 UTC
Size:
3.19 KB
patch
obsolete
>From 5bfe201aa15244723e75329b757f736ed1623f14 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 20 Aug 2020 14:28:46 +0100 >Subject: [PATCH] Bug 18501: (follow-up) Test undefined userenv behaviour > >This patch adds a test to ensure that the 'Koha::Item->store' method >will function when the userenv is not set >--- > t/db_dependent/Koha/Items.t | 51 ++++++++++++++++++++++++++++++++++++- > 1 file changed, 50 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t >index 68232df0ef..6140139c0c 100644 >--- a/t/db_dependent/Koha/Items.t >+++ b/t/db_dependent/Koha/Items.t >@@ -136,7 +136,7 @@ subtest 'store' => sub { > }; > > subtest '_lost_found_trigger' => sub { >- plan tests => 6; >+ plan tests => 7; > > t::lib::Mocks::mock_preference( 'WhenLostChargeReplacementFee', 1 ); > t::lib::Mocks::mock_preference( 'WhenLostForgiveFine', 0 ); >@@ -758,6 +758,53 @@ subtest 'store' => sub { > is( $item->{_refunded}, undef, 'No refund triggered' ); > > }; >+ >+ subtest 'Continue when userenv is not set' => sub { >+ plan tests => 1; >+ >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $barcode = 'KD123456795'; >+ my $replacement_amount = 100; >+ my $processfee_amount = 20; >+ >+ my $item_type = $builder->build_object( >+ { >+ class => 'Koha::ItemTypes', >+ value => { >+ notforloan => undef, >+ rentalcharge => 0, >+ defaultreplacecost => undef, >+ processfee => 0, >+ rentalcharge_daily => 0, >+ } >+ } >+ ); >+ my $item = $builder->build_sample_item( >+ { >+ biblionumber => $biblio->biblionumber, >+ homebranch => $library->branchcode, >+ holdingbranch => $library->branchcode, >+ barcode => $barcode, >+ replacementprice => $replacement_amount, >+ itype => $item_type->itemtype >+ } >+ ); >+ >+ my $issue = >+ C4::Circulation::AddIssue( $patron->unblessed, $barcode ); >+ >+ # Simulate item marked as lost >+ $item->itemlost(1)->store; >+ C4::Circulation::LostItem( $item->itemnumber, 1 ); >+ >+ # Unset the userenv >+ C4::Context->_new_userenv(undef); >+ >+ # Simluate item marked as found >+ $item->itemlost(0)->store; >+ is( $item->{_refunded}, 1, 'No refund triggered' ); >+ >+ }; > }; > }; > >@@ -815,6 +862,8 @@ subtest 'biblioitem' => sub { > is( $biblioitem->biblionumber, $retrieved_item_1->biblionumber, 'Koha::Item->biblioitem should return the correct biblioitem' ); > }; > >+# Restore userenv >+t::lib::Mocks::mock_userenv({ branchcode => $library->{branchcode} }); > subtest 'checkout' => sub { > plan tests => 5; > my $item = Koha::Items->find( $new_item_1->itemnumber ); >-- >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 18501
:
108004
|
108005
|
108006
|
108121
|
108122
|
108123
|
108167
|
108168
|
108169
|
108170
|
108193
|
108194
|
108195
|
108243
|
108248
|
108249
|
108291
|
108292
|
108293
|
108294
|
108295
|
108296
|
108297
|
108298
|
108299
|
108300
|
108301
|
108482
|
108483
|
108484
|
108485
|
108486
|
108487
|
108488
|
108489
|
108490
|
108491
|
108492
|
108493
|
108494
|
108575
|
108576
|
108577
|
108578
|
108579
|
108580
|
108581
|
108582
|
108583
|
108584
|
108585
|
108586
|
108596
|
108597
|
108598
|
108599
|
108600
|
108601
|
108602
|
108603
|
108604
|
108605
|
108606
|
108607
|
108608
|
108610
|
108611
|
108612
|
108613
|
108614
|
108615
|
108616
|
108617
|
108618
|
108619
|
108620
|
108621
|
108717
|
108732
|
108738
|
108739
|
108740
|
108741
|
108784
| 108785 |
108786
|
108787
|
108788
|
108795
|
111295