Bugzilla – Attachment 94283 Details for
Bug 23382
Issuing rules failing after bug 20912
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23382: Add hourly tests for Circulation
Bug-23382-Add-hourly-tests-for-Circulation.patch (text/plain), 9.46 KB, created by
Martin Renvoize (ashimema)
on 2019-10-16 12:12:52 UTC
(
hide
)
Description:
Bug 23382: Add hourly tests for Circulation
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-10-16 12:12:52 UTC
Size:
9.46 KB
patch
obsolete
>From bb29f954f247f4ef3213f246522ed205d1e9da8b Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 15 Aug 2019 14:57:08 +0100 >Subject: [PATCH] Bug 23382: Add hourly tests for Circulation > >--- > t/db_dependent/Circulation.t | 132 ++++++++++++++++++++++++++--------- > 1 file changed, 98 insertions(+), 34 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index f0086a0e73..0c859f1c03 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -3074,14 +3074,18 @@ subtest 'ProcessOfflinePayment() tests' => sub { > }; > > subtest 'Incremented fee tests' => sub { >- plan tests => 11; >+ plan tests => 16; > >- t::lib::Mocks::mock_preference('item-level_itypes', 1); >+ my $dt = dt_from_string(); >+ Time::Fake->offset( $dt->epoch ); > >- my $library = $builder->build_object( { class => 'Koha::Libraries' } )->store; >+ t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); >+ >+ my $library = >+ $builder->build_object( { class => 'Koha::Libraries' } )->store; > > my $module = new Test::MockModule('C4::Context'); >- $module->mock('userenv', sub { { branch => $library->id } }); >+ $module->mock( 'userenv', sub { { branch => $library->id } } ); > > my $patron = $builder->build_object( > { >@@ -3093,9 +3097,9 @@ subtest 'Incremented fee tests' => sub { > my $itemtype = $builder->build_object( > { > class => 'Koha::ItemTypes', >- value => { >- notforloan => undef, >- rentalcharge => 0, >+ value => { >+ notforloan => undef, >+ rentalcharge => 0, > rentalcharge_daily => 1.000000 > } > } >@@ -3108,32 +3112,45 @@ subtest 'Incremented fee tests' => sub { > } > ); > >- is( $itemtype->rentalcharge_daily, '1.000000', 'Daily rental charge stored and retreived correctly' ); >- is( $item->effective_itemtype, $itemtype->id, "Itemtype set correctly for item"); >+ is( $itemtype->rentalcharge_daily, >+ '1.000000', 'Daily rental charge stored and retreived correctly' ); >+ is( $item->effective_itemtype, $itemtype->id, >+ "Itemtype set correctly for item" ); > >- my $dt_from = dt_from_string(); >- my $dt_to = dt_from_string()->add( days => 7 ); >+ my $dt_from = dt_from_string(); >+ my $dt_to = dt_from_string()->add( days => 7 ); > my $dt_to_renew = dt_from_string()->add( days => 13 ); > >- t::lib::Mocks::mock_preference('finesCalendar', 'ignoreCalendar'); >- my $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); >- my $accountline = Koha::Account::Lines->find({ itemnumber => $item->id }); >- is( $accountline->amount, '7.000000', "Daily rental charge calculated correctly with finesCalendar = ignoreCalendar" ); >+ # Daily Tests >+ t::lib::Mocks::mock_preference( 'finesCalendar', 'ignoreCalendar' ); >+ my $issue = >+ AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); >+ my $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >+ is( $accountline->amount, '7.000000', >+"Daily rental charge calculated correctly with finesCalendar = ignoreCalendar" >+ ); > $accountline->delete(); > AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); >- $accountline = Koha::Account::Lines->find({ itemnumber => $item->id }); >- is( $accountline->amount, '6.000000', "Daily rental charge calculated correctly with finesCalendar = ignoreCalendar, for renewal" ); >+ $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >+ is( $accountline->amount, '6.000000', >+"Daily rental charge calculated correctly with finesCalendar = ignoreCalendar, for renewal" >+ ); > $accountline->delete(); > $issue->delete(); > >- t::lib::Mocks::mock_preference('finesCalendar', 'noFinesWhenClosed'); >- $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); >- $accountline = Koha::Account::Lines->find({ itemnumber => $item->id }); >- is( $accountline->amount, '7.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed" ); >+ t::lib::Mocks::mock_preference( 'finesCalendar', 'noFinesWhenClosed' ); >+ $issue = >+ AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); >+ $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >+ is( $accountline->amount, '7.000000', >+"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed" >+ ); > $accountline->delete(); > AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); >- $accountline = Koha::Account::Lines->find({ itemnumber => $item->id }); >- is( $accountline->amount, '6.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed, for renewal" ); >+ $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >+ is( $accountline->amount, '6.000000', >+"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed, for renewal" >+ ); > $accountline->delete(); > $issue->delete(); > >@@ -3143,27 +3160,74 @@ subtest 'Incremented fee tests' => sub { > title => 'Test holiday', > description => 'Test holiday' > ); >- $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); >- $accountline = Koha::Account::Lines->find({ itemnumber => $item->id }); >- is( $accountline->amount, '6.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays" ); >+ $issue = >+ AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); >+ $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >+ is( $accountline->amount, '6.000000', >+"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays" >+ ); > $accountline->delete(); > AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); >- $accountline = Koha::Account::Lines->find({ itemnumber => $item->id }); >- is( $accountline->amount, '5.000000', "Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays, for renewal" ); >+ $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >+ is( $accountline->amount, '5.000000', >+"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays, for renewal" >+ ); > $accountline->delete(); > $issue->delete(); > > $itemtype->rentalcharge('2.000000')->store; >- is( $itemtype->rentalcharge, '2.000000', 'Rental charge updated and retreived correctly' ); >- $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from); >- my $accountlines = Koha::Account::Lines->search({ itemnumber => $item->id }); >- is( $accountlines->count, '2', "Fixed charge and accrued charge recorded distinctly"); >+ is( $itemtype->rentalcharge, '2.000000', >+ 'Rental charge updated and retreived correctly' ); >+ $issue = >+ AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); >+ my $accountlines = >+ Koha::Account::Lines->search( { itemnumber => $item->id } ); >+ is( $accountlines->count, '2', >+ "Fixed charge and accrued charge recorded distinctly" ); > $accountlines->delete(); > AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); >- $accountlines = Koha::Account::Lines->search({ itemnumber => $item->id }); >- is( $accountlines->count, '2', "Fixed charge and accrued charge recorded distinctly, for renewal"); >+ $accountlines = Koha::Account::Lines->search( { itemnumber => $item->id } ); >+ is( $accountlines->count, '2', >+ "Fixed charge and accrued charge recorded distinctly, for renewal" ); > $accountlines->delete(); > $issue->delete(); >+ $itemtype->rentalcharge('00.000000')->store; >+ is( $itemtype->rentalcharge, '00.000000', >+ 'Rental charge reset and retreived correctly' ); >+ >+ # Hourly >+ my $issuingrule = Koha::IssuingRules->get_effective_issuing_rule( >+ { >+ categorycode => $patron->categorycode, >+ itemtype => $itemtype->id, >+ branchcode => $library->id >+ } >+ ); >+ $issuingrule->lengthunit('hours')->store(); >+ is( $issuingrule->lengthunit, 'hours', >+ 'Issuingrule updated and retrieved correctly' ); >+ >+ $itemtype->rentalcharge_hourly('2.500000')->store(); >+ is( $itemtype->rentalcharge_hourly, >+ '2.500000', 'Hourly rental charge stored and retreived correctly' ); >+ >+ $dt_to = dt_from_string()->add( hours => 4 ); >+ $dt_to_renew = dt_from_string()->add( hours => 6 ); >+ >+ $issue = >+ AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); >+ $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >+ is( $accountline->amount, '10.000000', >+ "Hourly rental charge calculated correctly" ); >+ $accountline->delete(); >+ AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); >+ $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >+ is( $accountline->amount, '5.000000', >+ "Hourly rental charge calculated correctly, for renewal" ); >+ $accountline->delete(); >+ $issue->delete(); >+ $issuingrule->lengthunit('days')->store(); >+ Time::Fake->reset; > }; > > subtest 'CanBookBeIssued & RentalFeesCheckoutConfirmation' => sub { >-- >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 23382
:
92221
|
92222
|
92236
|
92237
|
92238
|
92273
|
92274
|
92275
|
92276
|
93407
|
93408
|
93409
|
93410
|
93411
|
93412
|
94281
|
94282
|
94283
|
94284
|
94285
|
94286
|
94287
|
94288
|
94289
|
94723
|
94724
|
94725
|
94726
|
94727
|
94728
|
94729
|
94730
|
94731
|
94743
|
94755
|
94756
|
94757
|
94758
|
94759
|
94760
|
94761
|
94762
|
94763
|
94764
|
94765
|
94766
|
94774
|
94775
|
94776
|
94777
|
94778
|
94779
|
94780
|
94781
|
94782
|
94783
|
94784
|
107456
|
107457