Bugzilla – Attachment 106346 Details for
Bug 25850
CalcDateDue freezes with 'useDaysMode' set to 'Dayweek' and the due date lands on a Sunday
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25850: Add tests for weekday holidays
Bug-25850-Add-tests-for-weekday-holidays.patch (text/plain), 2.03 KB, created by
Martin Renvoize (ashimema)
on 2020-06-26 15:53:51 UTC
(
hide
)
Description:
Bug 25850: Add tests for weekday holidays
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-06-26 15:53:51 UTC
Size:
2.03 KB
patch
obsolete
>From 8d1120a98f92a1082ca5709cbfa26f2af8d253ac Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 26 Jun 2020 16:24:00 +0100 >Subject: [PATCH] Bug 25850: Add tests for weekday holidays > >--- > t/db_dependent/Calendar.t | 43 ++++++++++++++++++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Calendar.t b/t/db_dependent/Calendar.t >index 220f81f122..56b202b498 100644 >--- a/t/db_dependent/Calendar.t >+++ b/t/db_dependent/Calendar.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 4; >+use Test::More tests => 5; > use Time::Fake; > use t::lib::TestBuilder; > >@@ -289,6 +289,47 @@ subtest 'hours_between | days_between' => sub { > > }; > >+ Time::Fake->reset; >+}; >+ >+subtest 'is_holiday' => sub { >+ plan tests => 1; >+ >+ subtest 'weekday holidays' => sub { >+ plan tests => 7; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ >+ my $day = DateTime->now(); >+ my $dow = scalar $day->day_of_week; >+ $dow = 0 if $dow == 7; >+ >+ # Closed this day of the week >+ my $dbh = C4::Context->dbh; >+ $dbh->do( >+ q| >+ INSERT INTO repeatable_holidays (branchcode,weekday,day,month,title,description) >+ VALUES ( ?, ?, NULL, NULL, ?, '' ) >+ |, undef, $library->branchcode, $dow, "TEST" >+ ); >+ >+ # Iterate 7 days >+ my $sth = $dbh->prepare( >+"UPDATE repeatable_holidays SET weekday = ? WHERE branchcode = ? AND title = 'TEST'" >+ ); >+ for my $i ( 0 .. 6 ) { >+ my $calendar = >+ Koha::Calendar->new( branchcode => $library->branchcode ); >+ >+ is( $calendar->is_holiday($day), 1, $day->day_name() ." works as a repeatable holiday"); >+ >+ # Increment the date and holiday day >+ $day->add( days => 1 ); >+ $dow++; >+ $dow = 0 if $dow == 7; >+ $sth->execute($dow, $library->branchcode); >+ } >+ }; > }; > > $schema->storage->txn_rollback(); >-- >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 25850
:
106207
|
106346
|
106347
|
106348
|
106381
|
106382
|
106383
|
106384
|
106626
|
106627
|
106628
|
106629
|
106630