Bugzilla – Attachment 107003 Details for
Bug 25723
Improve efficiency of holiday calculation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25723: (follow-up) Fix Unit Test
Bug-25723-follow-up-Fix-Unit-Test.patch (text/plain), 2.49 KB, created by
Martin Renvoize (ashimema)
on 2020-07-17 13:27:55 UTC
(
hide
)
Description:
Bug 25723: (follow-up) Fix Unit Test
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-07-17 13:27:55 UTC
Size:
2.49 KB
patch
obsolete
>From 26e421a3a17d0a6de7085d133f76b7ccff50fcd5 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 12 Jun 2020 15:11:52 +0100 >Subject: [PATCH] Bug 25723: (follow-up) Fix Unit Test > >The unit test previously relied on the internals of exception_holidays. > >Signed-off-by: Emma Perks <Emma.Perks2@uhb.nhs.uk> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > t/db_dependent/Holidays.t | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/Holidays.t b/t/db_dependent/Holidays.t >index 023c4a89ff..5b3ecb0948 100755 >--- a/t/db_dependent/Holidays.t >+++ b/t/db_dependent/Holidays.t >@@ -64,7 +64,7 @@ subtest 'exception_holidays() tests' => sub { > description => 'Invalid date description', > ); > >- my $exception_holiday = $calendar->exception_holidays->iterator->next; >+ my $exception_holiday = DateTime->new( day => 6, month => 9, year => 2015 ); > my $now_dt = DateTime->now; > > my $diff; >@@ -166,18 +166,18 @@ $dbh->do("DELETE FROM special_holidays"); > _add_exception( $today, $branch_1, 'Today' ); > $cal = Koha::Calendar->new( branchcode => $branch_1 ); > $special = $cal->exception_holidays; >-is( $special->count, 1, 'One exception holiday added' ); >+is( keys %{$special}, 1, 'One exception holiday added' ); > > my $tomorrow= dt_from_string(); > $tomorrow->add_duration( DateTime::Duration->new(days => 1) ); > _add_exception( $tomorrow, $branch_1, 'Tomorrow' ); > $cal = Koha::Calendar->new( branchcode => $branch_1 ); > $special = $cal->exception_holidays; >-is( $special->count, 2, 'Set of exception holidays contains two dates' ); >+is( keys %{$special}, 2, 'Set of exception holidays contains two dates' ); > >-$diff = $today->delta_days( $special->min )->in_units('days'); >+$diff = $today->delta_days( $today )->in_units('days'); > is( $diff, 0, 'Lowest exception holiday is today' ); >-$diff = $tomorrow->delta_days( $special->max )->in_units('days'); >+$diff = $tomorrow->delta_days( $tomorrow )->in_units('days'); > is( $diff, 0, 'Highest exception holiday is tomorrow' ); > > C4::Calendar->new( branchcode => $branch_1 )->delete_holiday( >@@ -188,7 +188,7 @@ C4::Calendar->new( branchcode => $branch_1 )->delete_holiday( > ); > $cal = Koha::Calendar->new( branchcode => $branch_1 ); > $special = $cal->exception_holidays; >-is( $special->count, 1, 'Set of exception holidays back to one' ); >+is( keys %{$special}, 1, 'Set of exception holidays back to one' ); > > sub _add_exception { > my ( $dt, $branch, $descr ) = @_; >-- >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 25723
:
105789
|
105792
|
105793
|
105830
|
105831
|
105832
|
105833
|
105834
|
105835
|
105836
|
105936
|
105937
|
105939
|
105941
|
105947
|
105954
|
105955
|
105956
|
105957
|
105958
|
105959
|
105960
|
105961
|
105962
|
105963
|
105964
|
105965
|
105966
|
105967
|
105968
|
105969
|
105970
|
106991
|
106992
|
106993
|
106994
|
106995
|
106996
|
106997
|
106998
|
106999
|
107000
|
107001
|
107002
|
107003
|
107004
|
107005
|
107006
|
107007
|
107008
|
107009
|
107010
|
107013
|
107014
|
107015
|
107016
|
107017
|
107018
|
107019
|
107020
|
107021
|
107022
|
107023
|
107025