Bugzilla – Attachment 13451 Details for
Bug 9074
DB dependent tests for is_holiday
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9074 - DB dependent tests for is_holiday
Bug-9074---DB-dependent-tests-for-isholiday.patch (text/plain), 14.50 KB, created by
Tomás Cohen Arazi (tcohen)
on 2012-11-14 17:29:13 UTC
(
hide
)
Description:
Bug 9074 - DB dependent tests for is_holiday
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2012-11-14 17:29:13 UTC
Size:
14.50 KB
patch
obsolete
>From e6c6ba8ae67344304ab7ad1362cb5e4f75c4f880 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Wed, 14 Nov 2012 14:21:47 -0300 >Subject: [PATCH] Bug 9074 - DB dependent tests for is_holiday >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Some DB dependent tests for: > >- Special holidays >- Exception holidays > >I added a test for a bug introduced by 8966. > >Sponsored-by: Universidad Nacional de Córdoba >--- > .../data/mysql/de-DE/optional/sample_holidays.sql | 2 ++ > .../data/mysql/de-DE/optional/sample_holidays.txt | 4 +++ > .../data/mysql/en/optional/sample_holidays.sql | 2 ++ > .../data/mysql/en/optional/sample_holidays.txt | 6 +++- > .../data/mysql/es-ES/optional/sample_holidays.sql | 2 ++ > .../data/mysql/es-ES/optional/sample_holidays.txt | 6 +++- > .../mysql/fr-FR/2-Optionel/sample_holidays.sql | 6 ++++ > .../mysql/fr-FR/2-Optionel/sample_holidays.txt | 8 +++++ > .../data/mysql/it-IT/necessari/sample_holidays.sql | 4 ++- > .../data/mysql/it-IT/necessari/sample_holidays.txt | 4 +++ > .../mysql/nb-NO/2-Valgfritt/sample_holidays.sql | 2 ++ > .../mysql/nb-NO/2-Valgfritt/sample_holidays.txt | 7 +++++ > .../data/mysql/pl-PL/optional/sample_holidays.sql | 2 ++ > .../data/mysql/pl-PL/optional/sample_holidays.txt | 4 +++ > installer/data/mysql/ru-RU/optional/holidays.sql | 2 ++ > installer/data/mysql/ru-RU/optional/holidays.txt | 9 +++++- > installer/data/mysql/uk-UA/optional/holidays.sql | 6 ++++ > installer/data/mysql/uk-UA/optional/holidays.txt | 8 +++++ > t/db_dependent/Holidays.t | 33 +++++++++++++++++++- > 19 files changed, 112 insertions(+), 5 deletions(-) > create mode 100644 installer/data/mysql/fr-FR/2-Optionel/sample_holidays.sql > create mode 100644 installer/data/mysql/fr-FR/2-Optionel/sample_holidays.txt > >diff --git a/installer/data/mysql/de-DE/optional/sample_holidays.sql b/installer/data/mysql/de-DE/optional/sample_holidays.sql >index cae733b..5acf560 100644 >--- a/installer/data/mysql/de-DE/optional/sample_holidays.sql >+++ b/installer/data/mysql/de-DE/optional/sample_holidays.sql >@@ -3,3 +3,5 @@ INSERT INTO `repeatable_holidays` VALUES > (3,'',NULL,1,1,'','Neujahr'), > (4,'',NULL,25,12,'','1. Weihnachtsfeiertag'), > (5,'',NULL,26,12,'','2. Weihnachtsfeiertag'); >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); >diff --git a/installer/data/mysql/de-DE/optional/sample_holidays.txt b/installer/data/mysql/de-DE/optional/sample_holidays.txt >index 947baea..cc8e127 100644 >--- a/installer/data/mysql/de-DE/optional/sample_holidays.txt >+++ b/installer/data/mysql/de-DE/optional/sample_holidays.txt >@@ -2,3 +2,7 @@ Beispiele für SchlieÃtage: > Sonntag > 1. und 2. Weihnachtsfeiertag > Neujahr >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/installer/data/mysql/en/optional/sample_holidays.sql b/installer/data/mysql/en/optional/sample_holidays.sql >index 33b6ff6..781ce2c 100644 >--- a/installer/data/mysql/en/optional/sample_holidays.sql >+++ b/installer/data/mysql/en/optional/sample_holidays.sql >@@ -2,3 +2,5 @@ INSERT INTO `repeatable_holidays` VALUES > (2,'MPL',0,NULL,NULL,'','Sundays'), > (3,'MPL',NULL,1,1,'','New Year\'s Day'), > (4,'MPL',NULL,25,12,'','Christmas'); >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); >diff --git a/installer/data/mysql/en/optional/sample_holidays.txt b/installer/data/mysql/en/optional/sample_holidays.txt >index dacc9b3..e28df43 100644 >--- a/installer/data/mysql/en/optional/sample_holidays.txt >+++ b/installer/data/mysql/en/optional/sample_holidays.txt >@@ -1,4 +1,8 @@ >-Sample Holidays: >+Sample repeatable holidays: > Sundays > Christmas > New Year's >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/installer/data/mysql/es-ES/optional/sample_holidays.sql b/installer/data/mysql/es-ES/optional/sample_holidays.sql >index e323317..77daf35 100644 >--- a/installer/data/mysql/es-ES/optional/sample_holidays.sql >+++ b/installer/data/mysql/es-ES/optional/sample_holidays.sql >@@ -2,3 +2,5 @@ INSERT INTO `repeatable_holidays` VALUES > (2,'',0,NULL,NULL,'','Sundays'), > (3,'',NULL,1,1,'','New Year\'s Day'), > (4,'',NULL,25,12,'','Christmas'); >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); >diff --git a/installer/data/mysql/es-ES/optional/sample_holidays.txt b/installer/data/mysql/es-ES/optional/sample_holidays.txt >index 1767301..3ed73bb 100644 >--- a/installer/data/mysql/es-ES/optional/sample_holidays.txt >+++ b/installer/data/mysql/es-ES/optional/sample_holidays.txt >@@ -1,4 +1,8 @@ >-Feriados de ejemplo: >+Feriados repetibles de ejemplo: > Domingos > Navidad > Año nuevo >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/installer/data/mysql/fr-FR/2-Optionel/sample_holidays.sql b/installer/data/mysql/fr-FR/2-Optionel/sample_holidays.sql >new file mode 100644 >index 0000000..781ce2c >--- /dev/null >+++ b/installer/data/mysql/fr-FR/2-Optionel/sample_holidays.sql >@@ -0,0 +1,6 @@ >+INSERT INTO `repeatable_holidays` VALUES >+(2,'MPL',0,NULL,NULL,'','Sundays'), >+(3,'MPL',NULL,1,1,'','New Year\'s Day'), >+(4,'MPL',NULL,25,12,'','Christmas'); >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); >diff --git a/installer/data/mysql/fr-FR/2-Optionel/sample_holidays.txt b/installer/data/mysql/fr-FR/2-Optionel/sample_holidays.txt >new file mode 100644 >index 0000000..e28df43 >--- /dev/null >+++ b/installer/data/mysql/fr-FR/2-Optionel/sample_holidays.txt >@@ -0,0 +1,8 @@ >+Sample repeatable holidays: >+ Sundays >+ Christmas >+ New Year's >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/installer/data/mysql/it-IT/necessari/sample_holidays.sql b/installer/data/mysql/it-IT/necessari/sample_holidays.sql >index 67640a9..d28053c 100644 >--- a/installer/data/mysql/it-IT/necessari/sample_holidays.sql >+++ b/installer/data/mysql/it-IT/necessari/sample_holidays.sql >@@ -4,5 +4,7 @@ INSERT INTO `repeatable_holidays` VALUES > (2,'',0,NULL,NULL,'','Domenica'), > (3,'',NULL,1,1,'','Nuovo anno'), > (4,'',NULL,25,12,'','Natale'); >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); > >-SET FOREIGN_KEY_CHECKS=1; >\ No newline at end of file >+SET FOREIGN_KEY_CHECKS=1;INSERT INTO `repeatable_holidays` VALUES >diff --git a/installer/data/mysql/it-IT/necessari/sample_holidays.txt b/installer/data/mysql/it-IT/necessari/sample_holidays.txt >index 44ac7c7..4493a99 100644 >--- a/installer/data/mysql/it-IT/necessari/sample_holidays.txt >+++ b/installer/data/mysql/it-IT/necessari/sample_holidays.txt >@@ -2,3 +2,7 @@ Esempio vacanze: > Domenica > Natale > Nuovo anno >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.sql b/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.sql >index 7df9e67..0a70f95 100644 >--- a/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.sql >+++ b/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.sql >@@ -26,3 +26,5 @@ INSERT INTO `repeatable_holidays` VALUES > (5,'',NULL,17,5,'','17. mai'), > (6,'',NULL,25,12,'','1. juledag'), > (7,'',NULL,26,12,'','2. juledag'); >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); >diff --git a/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.txt b/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.txt >index 33b1e12..7755275 100644 >--- a/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.txt >+++ b/installer/data/mysql/nb-NO/2-Valgfritt/sample_holidays.txt >@@ -1 +1,8 @@ > Eksempler pÃ¥ fridager. >+ Sundays >+ Christmas >+ New Year's >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/installer/data/mysql/pl-PL/optional/sample_holidays.sql b/installer/data/mysql/pl-PL/optional/sample_holidays.sql >index bee37b5..77da0a5 100644 >--- a/installer/data/mysql/pl-PL/optional/sample_holidays.sql >+++ b/installer/data/mysql/pl-PL/optional/sample_holidays.sql >@@ -2,3 +2,5 @@ INSERT INTO `repeatable_holidays` VALUES > (2,'',0,NULL,NULL,'','Niedziele'), > (3,'',NULL,1,1,'','Nowy Rok'), > (4,'',NULL,25,12,'','Boże Narodzenie'); >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); >diff --git a/installer/data/mysql/pl-PL/optional/sample_holidays.txt b/installer/data/mysql/pl-PL/optional/sample_holidays.txt >index 520d200..63e8b9e 100644 >--- a/installer/data/mysql/pl-PL/optional/sample_holidays.txt >+++ b/installer/data/mysql/pl-PL/optional/sample_holidays.txt >@@ -2,3 +2,7 @@ PrzykÅadowe dni wolne: > Niedziele > Boże Narodzenie > Nowy Rok >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/installer/data/mysql/ru-RU/optional/holidays.sql b/installer/data/mysql/ru-RU/optional/holidays.sql >index 42f3311..8e9f55f 100644 >--- a/installer/data/mysql/ru-RU/optional/holidays.sql >+++ b/installer/data/mysql/ru-RU/optional/holidays.sql >@@ -21,3 +21,5 @@ VALUES (7, '',NULL,2,5,'','ÐÐµÐ½Ñ Ð¢ÑÑда'); > INSERT INTO `repeatable_holidays` (`id`, `branchcode`, `weekday`, `day`, `month`, `title`, `description`) > VALUES (8, '',NULL,9,5,'','ÐÐµÐ½Ñ ÐобедÑ'); > >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); >diff --git a/installer/data/mysql/ru-RU/optional/holidays.txt b/installer/data/mysql/ru-RU/optional/holidays.txt >index a17a295..f0beb26 100644 >--- a/installer/data/mysql/ru-RU/optional/holidays.txt >+++ b/installer/data/mysql/ru-RU/optional/holidays.txt >@@ -1 +1,8 @@ >-ÐовÑоÑÑемÑе пÑаздники. >\ No newline at end of file >+ÐовÑоÑÑемÑе пÑаздники.: >+ Sundays >+ Christmas >+ New Year's >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/installer/data/mysql/uk-UA/optional/holidays.sql b/installer/data/mysql/uk-UA/optional/holidays.sql >index 55f45be..60f428b 100644 >--- a/installer/data/mysql/uk-UA/optional/holidays.sql >+++ b/installer/data/mysql/uk-UA/optional/holidays.sql >@@ -22,3 +22,9 @@ INSERT INTO `repeatable_holidays` (`branchcode`, `weekday`, `day`, `month`, `tit > ('LNSL', NULL, 28, 6, '', 'ÐÐµÐ½Ñ ÐонÑÑиÑÑÑÑÑ'), > ('LNSL', NULL, 24, 8, '', 'ÐÐµÐ½Ñ ÐезалежноÑÑÑ'); > >+INSERT INTO `repeatable_holidays` VALUES >+('','MPL',0,NULL,NULL,'','Sundays'), >+('','MPL',NULL,1,1,'','New Year\'s Day'), >+('','MPL',NULL,25,12,'','Christmas'); >+INSERT INTO `special_holidays` VALUES ('','MPL',16,11,2012,0,'Sample single holiday','This holiday is here for testing purposes only.'); >+INSERT INTO `special_holidays` VALUES ('','MPL',11,11,2012,1,'Sample sunday exception','This holiday exception is here for testing purposes only.'); >diff --git a/installer/data/mysql/uk-UA/optional/holidays.txt b/installer/data/mysql/uk-UA/optional/holidays.txt >index 0bdd5d5..3b4ffea 100644 >--- a/installer/data/mysql/uk-UA/optional/holidays.txt >+++ b/installer/data/mysql/uk-UA/optional/holidays.txt >@@ -1 +1,9 @@ > ÐÑÑÑÑÐ¹Ð½Ñ Ð¿Ð¾Ð²ÑоÑÑвалÑÐ½Ñ ÑвÑÑа в УкÑаÑнÑ. >+Sample repeatable holidays: >+ Sundays >+ Christmas >+ New Year's >+Sample single holidays: >+ 16-11-2012 >+Sample holiday exceptions: >+ 11-11-2012 (Sunday exception) >diff --git a/t/db_dependent/Holidays.t b/t/db_dependent/Holidays.t >index 5c4da1b..c6674a8 100755 >--- a/t/db_dependent/Holidays.t >+++ b/t/db_dependent/Holidays.t >@@ -5,7 +5,7 @@ use DateTime; > use DateTime::TimeZone; > > use C4::Context; >-use Test::More tests => 8; >+use Test::More tests => 11; > > BEGIN { use_ok('Koha::Calendar'); } > BEGIN { use_ok('C4::Calendar'); } >@@ -39,7 +39,38 @@ my $newyear = DateTime->new( > day => 1, > ); > >+my $special_holiday = DateTime->new( >+ year => 2012, >+ month => 11, >+ day => 16 >+); >+ >+my $exception_sunday = DateTime->new( >+ year => 2012, >+ month => 11, >+ day => 11 >+); >+ > is( $koha_calendar->is_holiday($sunday), 1, 'Sunday is a closed day' ); > is( $koha_calendar->is_holiday($monday), 0, 'Monday is not a closed day' ); > is( $koha_calendar->is_holiday($christmas), 1, 'Christmas is a closed day' ); > is( $koha_calendar->is_holiday($newyear), 1, 'New Years day is a closed day' ); >+is( $koha_calendar->is_holiday($special_holiday), 1, 'Sample single holiday is a closed day' ); >+is( $koha_calendar->is_holiday($exception_sunday), 0, 'Sample sunday exception is not a closed day' ); >+ >+ >+# is_holiday truncates the date to day as that's >+# how they are stored/retreived from db. This is a >+# regression test for a bug introduced by 8966, fixed in 8800 >+my $special_holiday_time = DateTime->new( >+ year => 2012, >+ month => 11, >+ day => 16, >+ hour => 11, >+ minute => 2 >+); >+ >+is( $koha_calendar->is_holiday($special_holiday_time), >+ $koha_calendar->is_holiday($special_holiday) , >+ 'is_holiday should truncate the date for holiday validation' ); >+ >-- >1.7.9.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 9074
:
13451
|
13586
|
13587
|
13609
|
13634