Bugzilla – Attachment 22823 Details for
Bug 11218
Due notices broken / not generated
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11218: Regression tests for Due notice generation
Bug-11218-Regression-tests-for-Due-notice-generati.patch (text/plain), 4.81 KB, created by
Kyle M Hall (khall)
on 2013-11-08 14:35:55 UTC
(
hide
)
Description:
Bug 11218: Regression tests for Due notice generation
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-11-08 14:35:55 UTC
Size:
4.81 KB
patch
obsolete
>From aae52405fa0f0690bd1619d15c0cf0902e41bff3 Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <Katrin.Fischer.83@web.de> >Date: Fri, 8 Nov 2013 00:26:45 +0100 >Subject: [PATCH] Bug 11218: Regression tests for Due notice generation > >Changes tests for GetUpcomingDueIssues: > >days_in_advance should be inclusive: > 2 should find items due in 2 days from now. > 1 should find items due tomorrow. > 0 should only find items due today. > >Adds new tests for Bug 11218: > >As the advance_notices.pl, the only script using GetUpcomingDueIssues >is not only used for PREDUE notices, but also for >DUE notices, we need to also select items due today. > >Signed-off-by: Liz Rea <liz@catalyst.net.nz> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/db_dependent/Circulation.t | 59 ++++++++++++++++++++++++++++++++++++++--- > 1 files changed, 54 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 60b93e2..3b2f7d6 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -9,7 +9,7 @@ use C4::Items; > use C4::Members; > use C4::Reserves; > >-use Test::More tests => 38; >+use Test::More tests => 44; > > BEGIN { > use_ok('C4::Circulation'); >@@ -336,8 +336,28 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > # GetUpcomingDueIssues tests > my $barcode = 'R00000342'; > my $barcode2 = 'R00000343'; >+ my $barcode3 = 'R00000344'; > my $branch = 'MPL'; > >+ #Create another record >+ my $biblio2 = MARC::Record->new(); >+ my $title2 = 'Something is worng here'; >+ $biblio2->append_fields( >+ MARC::Field->new('100', ' ', ' ', a => 'Anonymous'), >+ MARC::Field->new('245', ' ', ' ', a => $title2), >+ ); >+ my ($biblionumber2, $biblioitemnumber2) = AddBiblio($biblio2, ''); >+ >+ #Create third item >+ AddItem( >+ { >+ homebranch => $branch, >+ holdingbranch => $branch, >+ barcode => $barcode3 >+ }, >+ $biblionumber2 >+ ); >+ > # Create a borrower > my %a_borrower_data = ( > firstname => 'Fridolyn', >@@ -351,23 +371,52 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > > my $yesterday = DateTime->today(time_zone => C4::Context->tz())->add( days => -1 ); > my $two_days_ahead = DateTime->today(time_zone => C4::Context->tz())->add( days => 2 ); >+ my $today = DateTime->today(time_zone => C4::Context->tz()); > > my $datedue = AddIssue( $a_borrower, $barcode, $yesterday ); > my $datedue2 = AddIssue( $a_borrower, $barcode2, $two_days_ahead ); > >+ my $upcoming_dues; >+ > diag( "GetUpcomingDueIssues tests" ); > >- for my $i(0..2) { >- my $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => $i } ); >- is ( scalar( @$upcoming_dues ), 0, "No items due in less than two days ($i days in advance)" ); >+ for my $i(0..1) { >+ $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => $i } ); >+ is ( scalar( @$upcoming_dues ), 0, "No items due in less than one day ($i days in advance)" ); > } > >+ #days_in_advance needs to be inclusive, so 1 matches items due tomorrow, 0 items due today etc. >+ $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => 2 } ); >+ is ( scalar ( @$upcoming_dues), 1, "Only one item due in 2 days or less" ); >+ > for my $i(3..5) { >- my $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => $i } ); >+ $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => $i } ); > is ( scalar( @$upcoming_dues ), 1, > "Bug 9362: Only one item due in more than 2 days ($i days in advance)" ); > } > >+ # Bug 11218 - Due notices not generated - GetUpcomingDueIssues needs to select due today items as well >+ >+ my $datedue2 = AddIssue( $a_borrower, $barcode3, $today ); >+ >+ $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => -1 } ); >+ is ( scalar ( @$upcoming_dues), 0, "Overdues can not be selected" ); >+ >+ $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => 0 } ); >+ is ( scalar ( @$upcoming_dues), 1, "1 item is due today" ); >+ >+ $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => 1 } ); >+ is ( scalar ( @$upcoming_dues), 1, "1 item is due today, none tomorrow" ); >+ >+ $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => 2 } ); >+ is ( scalar ( @$upcoming_dues), 2, "2 items are due withing 2 days" ); >+ >+ $upcoming_dues = C4::Circulation::GetUpcomingDueIssues( { days_in_advance => 3 } ); >+ is ( scalar ( @$upcoming_dues), 2, "2 items are due withing 2 days" ); >+ >+ $upcoming_dues = C4::Circulation::GetUpcomingDueIssues(); >+ is ( scalar ( @$upcoming_dues), 2, "days_in_advance is 7 in GetUpcomingDueIssues if not provided" ); >+ > } > > $dbh->rollback; >-- >1.7.2.5
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 11218
:
22795
|
22796
|
22799
|
22802
|
22803
|
22804
| 22823 |
22824
|
22825
|
27531