Bugzilla – Attachment 119999 Details for
Bug 23207
Allow automatic checkin/return at end of circulation period
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23207: Regression tests
Bug-23207-Regression-tests.patch (text/plain), 4.81 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-04-22 12:11:18 UTC
(
hide
)
Description:
Bug 23207: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-04-22 12:11:18 UTC
Size:
4.81 KB
patch
obsolete
>From 9d6c3601e997baa3c2cbe60053961cf30f0e2c31 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 22 Apr 2021 08:57:19 -0300 >Subject: [PATCH] Bug 23207: Regression tests > >This patch introduces a regression test for the case the automatic >checkin happens after the date due. In that case the item souldn't >really be overdue, and the checkin should be recorded with the date due >as return date. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Checkouts.t >=> FAIL: The feature doesn't behave correctly > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Checkouts.t | 52 +++++++++++++++++++++++++++------ > 1 file changed, 43 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/Koha/Checkouts.t b/t/db_dependent/Koha/Checkouts.t >index 6d6bf5b81cb..7163bd208b5 100755 >--- a/t/db_dependent/Koha/Checkouts.t >+++ b/t/db_dependent/Koha/Checkouts.t >@@ -262,41 +262,62 @@ subtest 'Koha::Old::Checkouts->filter_by_todays_checkins' => sub { > $schema->storage->txn_rollback; > > subtest 'automatic_checkin' => sub { >- plan tests => 6; >+ >+ plan tests => 9; > > $schema->storage->txn_begin; > > my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); > > my $due_ac_item = >- $builder->build_sample_item( { homebranch => $patron->branchcode } ); >+ $builder->build_sample_item( >+ { homebranch => $patron->branchcode, itemlost => 0 } ); > my $ac_item = >- $builder->build_sample_item( { homebranch => $patron->branchcode } ); >+ $builder->build_sample_item( >+ { homebranch => $patron->branchcode, itemlost => 0 } ); >+ my $odue_ac_item = >+ $builder->build_sample_item( >+ { homebranch => $patron->branchcode, itemlost => 0 } ); > my $normal_item = >- $builder->build_sample_item( { homebranch => $patron->branchcode } ); >+ $builder->build_sample_item( >+ { homebranch => $patron->branchcode, itemlost => 0 } ); > > $due_ac_item->itemtype->automatic_checkin(1)->store; >+ $odue_ac_item->itemtype->automatic_checkin(1)->store; > $ac_item->itemtype->automatic_checkin(1)->store; > $normal_item->itemtype->automatic_checkin(0)->store; > >- my $current_date = dt_from_string; >+ my $today = dt_from_string; >+ my $tomorrow = dt_from_string->add( days => 1 ); >+ my $yesterday = dt_from_string->subtract( days => 1 ); > >- # due checkout for automatic checkin >+ # Checkout do for automatic checkin > my $checkout_due_aci = Koha::Checkout->new( > { > borrowernumber => $patron->borrowernumber, > itemnumber => $due_ac_item->itemnumber, > branchcode => $patron->branchcode, >- date_due => $current_date, >+ date_due => $today, >+ } >+ )->store; >+ >+ # Checkout not due for automatic checkin >+ my $checkout_odue_aci = Koha::Checkout->new( >+ { >+ borrowernumber => $patron->borrowernumber, >+ itemnumber => $odue_ac_item->itemnumber, >+ branchcode => $patron->branchcode, >+ date_due => $yesterday > } > )->store; > >- # in time checkout for automatic checkin >+ # Checkout not due for automatic checkin > my $checkout_aci = Koha::Checkout->new( > { > borrowernumber => $patron->borrowernumber, > itemnumber => $ac_item->itemnumber, > branchcode => $patron->branchcode, >+ date_due => $tomorrow > } > )->store; > >@@ -306,7 +327,7 @@ subtest 'automatic_checkin' => sub { > borrowernumber => $patron->borrowernumber, > itemnumber => $normal_item->itemnumber, > branchcode => $patron->branchcode, >- date_due => $current_date, >+ date_due => $today, > } > )->store; > >@@ -325,6 +346,13 @@ subtest 'automatic_checkin' => sub { > 'checkout for due_ac_item exists' > ); > >+ $searched = Koha::Checkouts->find( $checkout_odue_aci->issue_id ); >+ is( >+ $searched->issue_id, >+ $checkout_odue_aci->issue_id, >+ 'checkout for odue_ac_item exists' >+ ); >+ > Koha::Checkouts->automatic_checkin; > > $searched = Koha::Checkouts->find( $checkout_ni->issue_id ); >@@ -338,5 +366,11 @@ subtest 'automatic_checkin' => sub { > $searched = Koha::Checkouts->find( $checkout_due_aci->issue_id ); > is( $searched, undef, 'checkout for due_ac_item doesn\'t exist anymore' ); > >+ $searched = Koha::Checkouts->find( $checkout_odue_aci->issue_id ); >+ is( $searched, undef, 'checkout for odue_ac_item doesn\'t exist anymore' ); >+ >+ $searched = Koha::Old::Checkouts->find( $checkout_odue_aci->issue_id ); >+ is( dt_from_string($searched->returndate), $yesterday, 'old checkout for odue_ac_item has the right return date' ); >+ > $schema->storage->txn_rollback; > } >-- >2.31.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 23207
:
114212
|
114213
|
114214
|
114215
|
117970
|
117971
|
117972
|
117973
|
117984
|
117985
|
117986
|
117987
|
117991
|
117992
|
117993
|
117994
|
119726
|
119727
|
119728
|
119729
|
119730
|
119966
|
119967
|
119973
|
119985
| 119999 |
120000