From da46215fbd6f6d0d8ca34504850ac69a41c3519b Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Wed, 6 Apr 2016 20:12:41 +1200 Subject: [PATCH 01/17] Adding base New Zealand holiday provider --- src/Yasumi/Provider/NewZealand.php | 169 +++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 src/Yasumi/Provider/NewZealand.php diff --git a/src/Yasumi/Provider/NewZealand.php b/src/Yasumi/Provider/NewZealand.php new file mode 100644 index 000000000..92a023180 --- /dev/null +++ b/src/Yasumi/Provider/NewZealand.php @@ -0,0 +1,169 @@ + + */ +namespace Yasumi\Provider; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; + +/** + * Provider for all holidays in New Zealand. + */ +class NewZealand extends AbstractProvider +{ + use CommonHolidays, ChristianHolidays; + + /** + * Initialize holidays for New Zealand. + */ + public function initialize() + { + $this->timezone = 'Pacific/Auckland'; + + // National Holidays + $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale)); + $this->calculateDayAfterNewYearsDay(); + $this->calculateWaitangiDay(); + $this->calculateAnzacDay(); + $this->calculateQueensBirthday(); + $this->calculateLabourDay(); + + // Add Christian holidays + $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->secondChristmasDay($this->year, $this->timezone, $this->locale)); + } + + /** + * Waitangi Day + * + * Waitangi Day (named after Waitangi, where the Treaty of Waitangi was first signed) + * commemorates a significant day in the history of New Zealand. It is observed as a public holiday each + * year on 6 February to celebrate the signing of the Treaty of Waitangi, New Zealand's founding document, + * on that date in 1840. In recent legislation, if 6 February falls on a Saturday or Sunday, + * the Monday that immediately follows becomes a public holiday. + * + * @link https://en.wikipedia.org/wiki/Waitangi_Day + */ + public function calculateWaitangiDay() + { + if ($this->year >= 1960) { + + $date = new DateTime("$this->year-02-6", new DateTimeZone($this->timezone)); + + if (!$this->isWorkingDay($date)) { + $date->modify('next monday'); + } + + $this->addHoliday(new Holiday('waitangiDay', [], $date, $this->locale)); + } + } + + /** + * Day After New Years Day + * + * @link https://en.wikipedia.org/wiki/Public_holidays_in_New_Zealand#Statutory_holidays + */ + public function calculateDayAfterNewYearsDay() + { + if ($this->year >= 1960) { + $date = new DateTime("$this->year-01-02", new DateTimeZone($this->timezone)); + + if (!$this->isWorkingDay($date)) { + $date->modify('next monday'); + } + + $this->addHoliday(new Holiday('dayAfterNewYearsDay', [], $date, $this->locale)); + } + } + + /** + * ANZAC Day + * + * Anzac Day is a national day of remembrance in Australia and New Zealand that broadly commemorates all Australians + * and New Zealanders "who served and died in all wars, conflicts, and peacekeeping operations" + * Observed on 25 April each year. + * + * @link https://en.wikipedia.org/wiki/Anzac_Day + */ + public function calculateAnzacDay() + { + if ($this->year >= 1945) { + return; + } + + $date = new DateTime("$this->year-04-25", new DateTimeZone($this->timezone)); + + if (!$this->isWorkingDay($date)) { + $date->modify('next monday'); + } + + $this->addHoliday(new Holiday('anzacDay', [], $date, $this->locale)); + + } + + /** + * Queens Birthday + * + * The official head of state of New Zealand is the Monarch of the Commonwealth Realms. + * The monarch's birthday is officially celebrated in many parts of New Zealand. + * On her accession in 1952 Queen Elizabeth II was proclaimed in New Zealand ‘Queen of this Realm and all her + * other Realms’. Her representative in New Zealand, the governor general, has symbolic and ceremonial roles + * and is not involved in the day-to-day running of the government, which is the domain of the prime minister. + * + * Her actual birthday is on April 21, but it's celebrated as a public holiday on the first Monday of June. + * + * @link http://www.timeanddate.com/holidays/new-zealand/queen-birthday + */ + public function calculateQueensBirthday() + { + if ($this->year >= 1952) { + return; + } + + $this->addHoliday(new Holiday( + 'queensBirthDay', + [], + new DateTime("first monday of june $this->year", new DateTimeZone($this->timezone)), + $this->locale + )); + } + + /** + * During the 19th century, workers in New Zealand tried to claim the right for an 8-hour working day. + * In 1840 carpenter Samuel Parnell fought for this right in Wellington, NZ, and won. + * Labour Day was first celebrated in New Zealand on October 28, 1890, when thousands of workers paraded in the + * main city centres. + * Government employees were given the day off to attend the parades and many businesses closed for at least part + * of the day. + * + * The first official Labour Day public holiday in New Zealand was celebrated on the + * second Wednesday in October in 1900. The holiday was moved to the fourth Monday of October in 1910 + * has remained on this date since then. + * + * @link http://www.timeanddate.com/holidays/new-zealand/labour-day + */ + public function calculateLabourDay() + { + if ($this->year < 1900) { + return; + } + + $date = new DateTime( + (($this->year < 1910) ? 'second wednesday of october' : 'fourth monday of october')." $this->year", + new DateTimeZone($this->timezone) + ); + + $this->addHoliday(new Holiday('labourDay', [], $date, $this->locale)); + } +} \ No newline at end of file From 19b67cbd8d1d2ab54d5e7504f145535a6fd5e349 Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Wed, 6 Apr 2016 21:38:19 +1200 Subject: [PATCH 02/17] Adding tests for ANZAC day, fixed ANZAC start date and "Mondayisation" --- src/Yasumi/Provider/NewZealand.php | 4 +- tests/NewZealand/AnzacDayTest.php | 151 ++++++++++++++++++++ tests/NewZealand/NewZealandBaseTestCase.php | 34 +++++ 3 files changed, 187 insertions(+), 2 deletions(-) create mode 100644 tests/NewZealand/AnzacDayTest.php create mode 100644 tests/NewZealand/NewZealandBaseTestCase.php diff --git a/src/Yasumi/Provider/NewZealand.php b/src/Yasumi/Provider/NewZealand.php index 92a023180..0dbad8e76 100644 --- a/src/Yasumi/Provider/NewZealand.php +++ b/src/Yasumi/Provider/NewZealand.php @@ -98,13 +98,13 @@ public function calculateDayAfterNewYearsDay() */ public function calculateAnzacDay() { - if ($this->year >= 1945) { + if ($this->year < 1921) { return; } $date = new DateTime("$this->year-04-25", new DateTimeZone($this->timezone)); - if (!$this->isWorkingDay($date)) { + if ($this->year >= 2015 && !$this->isWorkingDay($date)) { $date->modify('next monday'); } diff --git a/tests/NewZealand/AnzacDayTest.php b/tests/NewZealand/AnzacDayTest.php new file mode 100644 index 000000000..8c16f50c0 --- /dev/null +++ b/tests/NewZealand/AnzacDayTest.php @@ -0,0 +1,151 @@ + + */ + +namespace Yasumi\Tests\NewZealand; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing ANZAC day in the New Zealand. + */ +class AnzacDayTest extends NewZealandBaseTestCase +{ + /** + * The name of the holiday + */ + const HOLIDAY = 'anzacDay'; + + /** + * Tests ANZAC Day + * + * @dataProvider HolidayDataProvider + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param DateTime $expected the expected date + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, + new DateTime($expected, new DateTimeZone(self::TIMEZONE))); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider() + { + return [ + ['2148', '2148-04-25'], + ['2002', '2002-04-25'], + ['2105', '2105-04-27'], + ['2065', '2065-04-27'], + ['2052', '2052-04-25'], + ['2039', '2039-04-25'], + ['2047', '2047-04-25'], + ['2117', '2117-04-26'], + ['2122', '2122-04-27'], + ['2007', '2007-04-25'], + ['2089', '2089-04-25'], + ['2063', '2063-04-25'], + ['1992', '1992-04-25'], + ['1931', '1931-04-25'], + ['1941', '1941-04-25'], + ['1935', '1935-04-25'], + ['2044', '2044-04-25'], + ['2069', '2069-04-25'], + ['2101', '2101-04-25'], + ['2086', '2086-04-25'], + ['2094', '2094-04-26'], + ['2012', '2012-04-25'], + ['2082', '2082-04-27'], + ['2028', '2028-04-25'], + ['1934', '1934-04-25'], + ['2121', '2121-04-25'], + ['2107', '2107-04-25'], + ['2019', '2019-04-25'], + ['1999', '1999-04-25'], + ['2058', '2058-04-25'], + ['2033', '2033-04-25'], + ['2079', '2079-04-25'], + ['2069', '2069-04-25'], + ['2079', '2079-04-25'], + ['2105', '2105-04-27'], + ['2109', '2109-04-25'], + ['2065', '2065-04-27'], + ['2076', '2076-04-27'], + ['2017', '2017-04-25'], + ['2079', '2079-04-25'], + ['1963', '1963-04-25'], + ['2019', '2019-04-25'], + ['2109', '2109-04-25'], + ['2077', '2077-04-26'], + ['2058', '2058-04-25'], + ['2120', '2120-04-25'], + ['1960', '1960-04-25'], + ['2093', '2093-04-27'], + ['2011', '2011-04-25'], + ['2106', '2106-04-26'], + ['1946', '1946-04-25'], + ['1995', '1995-04-25'], + ['2005', '2005-04-25'], + ['1932', '1932-04-25'], + ['2030', '2030-04-25'], + ['2124', '2124-04-25'], + ['1980', '1980-04-25'], + ['1962', '1962-04-25'], + ['2136', '2136-04-25'], + ['2017', '2017-04-25'], + ['2098', '2098-04-25'], + ['2015', '2015-04-27'], + ['2016', '2016-04-25'], + ['2069', '2069-04-25'], + ['2102', '2102-04-25'], + ['2044', '2044-04-25'], + ['2008', '2008-04-25'], + ['2045', '2045-04-25'], + ['2093', '2093-04-27'], + ['2084', '2084-04-25'], + ['2052', '2052-04-25'], + ['2136', '2136-04-25'], + ['2034', '2034-04-25'], + ['2033', '2033-04-25'], + ['1924', '1924-04-25'], + ['1977', '1977-04-25'], + ['2024', '2024-04-25'], + ['2095', '2095-04-25'], + ['2087', '2087-04-25'], + ['2117', '2117-04-26'], + ['2003', '2003-04-25'], + ['2116', '2116-04-27'], + ['1986', '1986-04-25'], + ['1968', '1968-04-25'], + ['2068', '2068-04-25'], + ['2007', '2007-04-25'], + ['2068', '2068-04-25'], + ['2095', '2095-04-25'], + ['2013', '2013-04-25'], + ['1986', '1986-04-25'], + ['2032', '2032-04-26'], + ['1925', '1925-04-25'], + ['1969', '1969-04-25'], + ['2063', '2063-04-25'], + ['2043', '2043-04-27'], + ['2009', '2009-04-25'], + ['1939', '1939-04-25'], + ['2031', '2031-04-25'], + ['1929', '1929-04-25'], + ]; + } +} diff --git a/tests/NewZealand/NewZealandBaseTestCase.php b/tests/NewZealand/NewZealandBaseTestCase.php new file mode 100644 index 000000000..74b5dc2a0 --- /dev/null +++ b/tests/NewZealand/NewZealandBaseTestCase.php @@ -0,0 +1,34 @@ + + */ + +namespace Yasumi\Tests\NewZealand; + +use PHPUnit_Framework_TestCase; +use Yasumi\Tests\YasumiBase; + +/** + * Base class for test cases of the NewZealand holiday provider. + */ +abstract class NewZealandBaseTestCase extends PHPUnit_Framework_TestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + const REGION = 'NewZealand'; + + /** + * Timezone in which this provider has holidays defined + */ + const TIMEZONE = 'Pacific/Auckland'; +} From eba6df9938fac1421f3886423127a650b6ee1478 Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Wed, 6 Apr 2016 21:40:46 +1200 Subject: [PATCH 03/17] Fixing start date of Queens birthdat celebration --- src/Yasumi/Provider/NewZealand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Yasumi/Provider/NewZealand.php b/src/Yasumi/Provider/NewZealand.php index 0dbad8e76..535f7dc7d 100644 --- a/src/Yasumi/Provider/NewZealand.php +++ b/src/Yasumi/Provider/NewZealand.php @@ -127,12 +127,12 @@ public function calculateAnzacDay() */ public function calculateQueensBirthday() { - if ($this->year >= 1952) { + if ($this->year < 1952) { return; } $this->addHoliday(new Holiday( - 'queensBirthDay', + 'queensBirthday', [], new DateTime("first monday of june $this->year", new DateTimeZone($this->timezone)), $this->locale From 7ec4151676519fc263efc342750d8d6978519aef Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Wed, 6 Apr 2016 21:41:32 +1200 Subject: [PATCH 04/17] Adding tests for Queens Birthday --- tests/NewZealand/QueensBirthdayTest.php | 58 +++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 tests/NewZealand/QueensBirthdayTest.php diff --git a/tests/NewZealand/QueensBirthdayTest.php b/tests/NewZealand/QueensBirthdayTest.php new file mode 100644 index 000000000..d3f1c0bc2 --- /dev/null +++ b/tests/NewZealand/QueensBirthdayTest.php @@ -0,0 +1,58 @@ + + */ + +namespace Yasumi\Tests\NewZealand; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing Queens Birthday in the New Zealand. + */ +class QueensBirthdayTest extends NewZealandBaseTestCase +{ + /** + * The name of the holiday + */ + const HOLIDAY = 'queensBirthday'; + + /** + * Tests Queens Birthday + * + * @dataProvider HolidayDataProvider + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param DateTime $expected the expected date + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider() + { + $data = []; + + for ($y = 1; $y <= 100; $y ++) { + $year = $this->generateRandomYear(1952, 2100); + $expected = new DateTime("first monday of june $year", new DateTimeZone(self::TIMEZONE)); + $data[] = [$year, $expected]; + } + + return $data; + } +} From 42e9b0a4542531211d5449448b26dd3ca83c704e Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Wed, 6 Apr 2016 21:45:07 +1200 Subject: [PATCH 05/17] Adding Tests for Labour Day --- tests/NewZealand/LabourDayTest.php | 152 +++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 tests/NewZealand/LabourDayTest.php diff --git a/tests/NewZealand/LabourDayTest.php b/tests/NewZealand/LabourDayTest.php new file mode 100644 index 000000000..29a221e3a --- /dev/null +++ b/tests/NewZealand/LabourDayTest.php @@ -0,0 +1,152 @@ + + */ + +namespace Yasumi\Tests\NewZealand; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing Labour Day in the New Zealand. + */ +class LabourDayTest extends NewZealandBaseTestCase +{ + /** + * The name of the holiday + */ + const HOLIDAY = 'labourDay'; + + /** + * Tests Labour Day + * + * @dataProvider HolidayDataProvider + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param string $expected the expected date + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, + new DateTime($expected, new DateTimeZone(self::TIMEZONE))); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider() + { + return [ + [2061, '2061-10-24'], + [1957, '1957-10-28'], + [1999, '1999-10-25'], + [1902, '1902-10-08'], + [1900, '1900-10-10'], + [2018, '2018-10-22'], + [1921, '1921-10-24'], + [1915, '1915-10-25'], + [1997, '1997-10-27'], + [2076, '2076-10-26'], + [2111, '2111-10-26'], + [1968, '1968-10-28'], + [1967, '1967-10-23'], + [2092, '2092-10-27'], + [2005, '2005-10-24'], + [1912, '1912-10-28'], + [2115, '2115-10-28'], + [1967, '1967-10-23'], + [1962, '1962-10-22'], + [1983, '1983-10-24'], + [2026, '2026-10-26'], + [2055, '2055-10-25'], + [2100, '2100-10-25'], + [2021, '2021-10-25'], + [2085, '2085-10-22'], + [2097, '2097-10-28'], + [2023, '2023-10-23'], + [1927, '1927-10-24'], + [1935, '1935-10-28'], + [2087, '2087-10-27'], + [2103, '2103-10-22'], + [2037, '2037-10-26'], + [2093, '2093-10-26'], + [1911, '1911-10-23'], + [1988, '1988-10-24'], + [2060, '2060-10-25'], + [1993, '1993-10-25'], + [2048, '2048-10-26'], + [2032, '2032-10-25'], + [2074, '2074-10-22'], + [2099, '2099-10-26'], + [1906, '1906-10-10'], + [2010, '2010-10-25'], + [1994, '1994-10-24'], + [1948, '1948-10-25'], + [2008, '2008-10-27'], + [2054, '2054-10-26'], + [1997, '1997-10-27'], + [2016, '2016-10-24'], + [2108, '2108-10-22'], + [2100, '2100-10-25'], + [1968, '1968-10-28'], + [2005, '2005-10-24'], + [2000, '2000-10-23'], + [2085, '2085-10-22'], + [2073, '2073-10-23'], + [2075, '2075-10-28'], + [2101, '2101-10-24'], + [1906, '1906-10-10'], + [1996, '1996-10-28'], + [2030, '2030-10-28'], + [2114, '2114-10-22'], + [2076, '2076-10-26'], + [1923, '1923-10-22'], + [2049, '2049-10-25'], + [2014, '2014-10-27'], + [1914, '1914-10-26'], + [2035, '2035-10-22'], + [2108, '2108-10-22'], + [2010, '2010-10-25'], + [2023, '2023-10-23'], + [1991, '1991-10-28'], + [2053, '2053-10-27'], + [2049, '2049-10-25'], + [2070, '2070-10-27'], + [2063, '2063-10-22'], + [2113, '2113-10-23'], + [1973, '1973-10-22'], + [1912, '1912-10-28'], + [1965, '1965-10-25'], + [1994, '1994-10-24'], + [1989, '1989-10-23'], + [2046, '2046-10-22'], + [2038, '2038-10-25'], + [1975, '1975-10-27'], + [1939, '1939-10-23'], + [1909, '1909-10-13'], + [1957, '1957-10-28'], + [2063, '2063-10-22'], + [2011, '2011-10-24'], + [1971, '1971-10-25'], + [2013, '2013-10-28'], + [2112, '2112-10-24'], + [1977, '1977-10-24'], + [1982, '1982-10-25'], + [2089, '2089-10-24'], + [2070, '2070-10-27'], + [2036, '2036-10-27'], + [2068, '2068-10-22'], + [1913, '1913-10-27'], + ]; + } +} From 477929e0a778c4e2be81b79849d7a4857699c639 Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Wed, 6 Apr 2016 21:45:27 +1200 Subject: [PATCH 06/17] Adding NewZealand testsuite config --- phpunit.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpunit.xml b/phpunit.xml index b6e87d16a..0b77ec634 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -89,6 +89,10 @@ ./tests/Finland + + ./tests/NewZealand + + From f06d7f61f9ac4cadbd376724ed046ef40af370fa Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Wed, 6 Apr 2016 23:26:15 +1200 Subject: [PATCH 07/17] Updating Waitangi Day calculation and adding tests --- src/Yasumi/Provider/NewZealand.php | 15 +-- tests/NewZealand/WaitangiDayTest.php | 159 +++++++++++++++++++++++++++ 2 files changed, 167 insertions(+), 7 deletions(-) create mode 100644 tests/NewZealand/WaitangiDayTest.php diff --git a/src/Yasumi/Provider/NewZealand.php b/src/Yasumi/Provider/NewZealand.php index 535f7dc7d..76f64484a 100644 --- a/src/Yasumi/Provider/NewZealand.php +++ b/src/Yasumi/Provider/NewZealand.php @@ -57,16 +57,17 @@ public function initialize() */ public function calculateWaitangiDay() { - if ($this->year >= 1960) { - - $date = new DateTime("$this->year-02-6", new DateTimeZone($this->timezone)); + if ($this->year < 1974) { + return; + } - if (!$this->isWorkingDay($date)) { - $date->modify('next monday'); - } + $date = new DateTime("$this->year-02-6", new DateTimeZone($this->timezone)); - $this->addHoliday(new Holiday('waitangiDay', [], $date, $this->locale)); + if ($this->year >= 2015 && !$this->isWorkingDay($date)) { + $date->modify('next monday'); } + + $this->addHoliday(new Holiday('waitangiDay', [], $date, $this->locale)); } /** diff --git a/tests/NewZealand/WaitangiDayTest.php b/tests/NewZealand/WaitangiDayTest.php new file mode 100644 index 000000000..0e98837ec --- /dev/null +++ b/tests/NewZealand/WaitangiDayTest.php @@ -0,0 +1,159 @@ + + */ + +namespace Yasumi\Tests\NewZealand; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing Waitangi day in the New Zealand. + */ +class WaitangiDayTest extends NewZealandBaseTestCase +{ + /** + * The name of the holiday + */ + const HOLIDAY = 'waitangiDay'; + + /** + * Tests Waitangi Day + * + * @dataProvider HolidayDataProvider + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param DateTime $expected the expected date + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, + new DateTime($expected, new DateTimeZone(self::TIMEZONE))); + } + + /** + * Tests that Holiday is not present before 1974 + */ + public function testNotHoliday() + { + $this->assertNotHoliday(self::REGION, self::HOLIDAY, 1973); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider() + { + return [ + [2025, '2025-02-06'], + [2103, '2103-02-06'], + [2073, '2073-02-06'], + [2039, '2039-02-07'], + [1980, '1980-02-06'], + [1977, '1977-02-06'], + [2009, '2009-02-06'], + [2097, '2097-02-06'], + [2080, '2080-02-06'], + [2142, '2142-02-06'], + [2097, '2097-02-06'], + [2072, '2072-02-08'], + [2103, '2103-02-06'], + [2022, '2022-02-07'], + [2147, '2147-02-06'], + [2145, '2145-02-08'], + [2107, '2107-02-07'], + [2027, '2027-02-08'], + [1999, '1999-02-06'], + [2144, '2144-02-06'], + [2031, '2031-02-06'], + [2129, '2129-02-07'], + [2103, '2103-02-06'], + [2057, '2057-02-06'], + [2102, '2102-02-06'], + [2112, '2112-02-08'], + [2140, '2140-02-08'], + [2030, '2030-02-06'], + [2132, '2132-02-06'], + [1987, '1987-02-06'], + [2126, '2126-02-06'], + [1995, '1995-02-06'], + [2002, '2002-02-06'], + [2102, '2102-02-06'], + [2086, '2086-02-06'], + [2031, '2031-02-06'], + [2123, '2123-02-08'], + [2098, '2098-02-06'], + [2045, '2045-02-06'], + [2058, '2058-02-06'], + [2092, '2092-02-06'], + [2070, '2070-02-06'], + [1988, '1988-02-06'], + [1974, '1974-02-06'], + [2020, '2020-02-06'], + [2074, '2074-02-06'], + [1982, '1982-02-06'], + [2136, '2136-02-06'], + [2065, '2065-02-06'], + [1991, '1991-02-06'], + [2015, '2015-02-06'], + [2017, '2017-02-06'], + [2130, '2130-02-06'], + [2006, '2006-02-06'], + [2093, '2093-02-06'], + [2013, '2013-02-06'], + [2122, '2122-02-06'], + [2004, '2004-02-06'], + [1983, '1983-02-06'], + [2108, '2108-02-06'], + [1979, '1979-02-06'], + [2112, '2112-02-08'], + [2112, '2112-02-08'], + [2130, '2130-02-06'], + [1992, '1992-02-06'], + [2134, '2134-02-08'], + [2096, '2096-02-06'], + [2126, '2126-02-06'], + [2039, '2039-02-07'], + [2139, '2139-02-06'], + [2040, '2040-02-06'], + [1997, '1997-02-06'], + [2031, '2031-02-06'], + [2110, '2110-02-06'], + [2128, '2128-02-06'], + [2120, '2120-02-06'], + [2058, '2058-02-06'], + [2030, '2030-02-06'], + [2076, '2076-02-06'], + [2020, '2020-02-06'], + [2065, '2065-02-06'], + [2132, '2132-02-06'], + [2014, '2014-02-06'], + [2095, '2095-02-07'], + [2128, '2128-02-06'], + [2004, '2004-02-06'], + [2143, '2143-02-06'], + [2100, '2100-02-08'], + [2124, '2124-02-07'], + [2127, '2127-02-06'], + [2020, '2020-02-06'], + [2022, '2022-02-07'], + [2049, '2049-02-08'], + [1982, '1982-02-06'], + [2043, '2043-02-06'], + [2130, '2130-02-06'], + [2125, '2125-02-06'], + [2121, '2121-02-06'], + [2043, '2043-02-06'], + ]; + } +} From 535f0b9ed6cdf9feba0ef0fdc1ca6fc3c5aff6a9 Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Wed, 6 Apr 2016 23:26:56 +1200 Subject: [PATCH 08/17] Adding NotHoliday tests to national holidays --- tests/NewZealand/AnzacDayTest.php | 8 ++++++++ tests/NewZealand/LabourDayTest.php | 8 ++++++++ tests/NewZealand/QueensBirthdayTest.php | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/tests/NewZealand/AnzacDayTest.php b/tests/NewZealand/AnzacDayTest.php index 8c16f50c0..b2003f7ef 100644 --- a/tests/NewZealand/AnzacDayTest.php +++ b/tests/NewZealand/AnzacDayTest.php @@ -39,6 +39,14 @@ public function testHoliday($year, $expected) new DateTime($expected, new DateTimeZone(self::TIMEZONE))); } + /** + * Tests that Labour Day is not present before 1921 + */ + public function testNotHoliday() + { + $this->assertNotHoliday(self::REGION, self::HOLIDAY, 1920); + } + /** * Returns a list of test dates * diff --git a/tests/NewZealand/LabourDayTest.php b/tests/NewZealand/LabourDayTest.php index 29a221e3a..2f68691fe 100644 --- a/tests/NewZealand/LabourDayTest.php +++ b/tests/NewZealand/LabourDayTest.php @@ -39,6 +39,14 @@ public function testHoliday($year, $expected) new DateTime($expected, new DateTimeZone(self::TIMEZONE))); } + /** + * Tests that Labour Day is not present before 1900 + */ + public function testNotHoliday() + { + $this->assertNotHoliday(self::REGION, self::HOLIDAY, 1899); + } + /** * Returns a list of test dates * diff --git a/tests/NewZealand/QueensBirthdayTest.php b/tests/NewZealand/QueensBirthdayTest.php index d3f1c0bc2..dbda328e7 100644 --- a/tests/NewZealand/QueensBirthdayTest.php +++ b/tests/NewZealand/QueensBirthdayTest.php @@ -38,6 +38,14 @@ public function testHoliday($year, $expected) $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); } + /** + * Tests that Holiday is not present before 1952 + */ + public function testNotHoliday() + { + $this->assertNotHoliday(self::REGION, self::HOLIDAY, 1951); + } + /** * Returns a list of test dates * From 90822bef7cacc090b431281e07994f62b0a33bf7 Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Thu, 7 Apr 2016 09:39:27 +1200 Subject: [PATCH 09/17] Refactored New Year Holidays, Adding tests --- src/Yasumi/Provider/NewZealand.php | 38 +++++-- tests/NewZealand/DayAfterNewYearsDayTest.php | 101 ++++++++++++++++++ tests/NewZealand/NewYearsDayTest.php | 102 +++++++++++++++++++ 3 files changed, 230 insertions(+), 11 deletions(-) create mode 100644 tests/NewZealand/DayAfterNewYearsDayTest.php create mode 100644 tests/NewZealand/NewYearsDayTest.php diff --git a/src/Yasumi/Provider/NewZealand.php b/src/Yasumi/Provider/NewZealand.php index 76f64484a..d42f7c25f 100644 --- a/src/Yasumi/Provider/NewZealand.php +++ b/src/Yasumi/Provider/NewZealand.php @@ -13,6 +13,7 @@ use DateTime; use DateTimeZone; +use DateInterval; use Yasumi\Holiday; /** @@ -30,8 +31,7 @@ public function initialize() $this->timezone = 'Pacific/Auckland'; // National Holidays - $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale)); - $this->calculateDayAfterNewYearsDay(); + $this->calculateNewYearHolidays(); $this->calculateWaitangiDay(); $this->calculateAnzacDay(); $this->calculateQueensBirthday(); @@ -71,21 +71,37 @@ public function calculateWaitangiDay() } /** - * Day After New Years Day + * Holidays associated with the start of the modern Gregorian calendar + * + * New Zealanders celebrate New Years Day and The Day After New Years Day, + * if either of these holidays occur on a weekend, the dates need to be adjusted. * * @link https://en.wikipedia.org/wiki/Public_holidays_in_New_Zealand#Statutory_holidays + * @link http://www.timeanddate.com/holidays/new-zealand/new-year-day + * @link http://www.timeanddate.com/holidays/new-zealand/day-after-new-years-day */ - public function calculateDayAfterNewYearsDay() + public function calculateNewYearHolidays() { - if ($this->year >= 1960) { - $date = new DateTime("$this->year-01-02", new DateTimeZone($this->timezone)); + $newYearsDay = new DateTime("$this->year-01-01", new DateTimeZone($this->timezone)); - if (!$this->isWorkingDay($date)) { - $date->modify('next monday'); - } + if (!$this->isWorkingDay($newYearsDay)) { + $newYearsDay->modify('next monday'); + } - $this->addHoliday(new Holiday('dayAfterNewYearsDay', [], $date, $this->locale)); + $dayAfterNewYearsDay = new DateTime("$this->year-01-02", new DateTimeZone($this->timezone)); + + switch ($dayAfterNewYearsDay->format('w')) { + case 1: + $dayAfterNewYearsDay->add(new DateInterval('P1D')); + break; + case 6: + case 0: + $dayAfterNewYearsDay->add(new DateInterval('P2D')); + break; } + + $this->addHoliday(new Holiday('newYearsDay', [], $newYearsDay, $this->locale)); + $this->addHoliday(new Holiday('dayAfterNewYearsDay', [], $dayAfterNewYearsDay, $this->locale)); } /** @@ -161,7 +177,7 @@ public function calculateLabourDay() } $date = new DateTime( - (($this->year < 1910) ? 'second wednesday of october' : 'fourth monday of october')." $this->year", + (($this->year < 1910) ? 'second wednesday of october' : 'fourth monday of october') . " $this->year", new DateTimeZone($this->timezone) ); diff --git a/tests/NewZealand/DayAfterNewYearsDayTest.php b/tests/NewZealand/DayAfterNewYearsDayTest.php new file mode 100644 index 000000000..3019f0542 --- /dev/null +++ b/tests/NewZealand/DayAfterNewYearsDayTest.php @@ -0,0 +1,101 @@ + + */ + +namespace Yasumi\Tests\NewZealand; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing Day After New Years Day in the New Zealand. + */ +class DayAfterNewYearsDayTest extends NewZealandBaseTestCase +{ + /** + * The name of the holiday + */ + const HOLIDAY = 'dayAfterNewYearsDay'; + + /** + * Tests Day After New Years Day + * + * @dataProvider HolidayDataProvider + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param string $expected the expected date + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, + new DateTime($expected, new DateTimeZone(self::TIMEZONE))); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider() + { + return [ + [2114, '2114-01-02'], + [1923, '1923-01-02'], + [2210, '2210-01-02'], + [2191, '2191-01-04'], + [2087, '2087-01-02'], + [1800, '1800-01-02'], + [2936, '2936-01-03'], + [2607, '2607-01-02'], + [2476, '2476-01-02'], + [1806, '1806-01-02'], + [2036, '2036-01-02'], + [2043, '2043-01-02'], + [2103, '2103-01-02'], + [2062, '2062-01-03'], + [2556, '2556-01-02'], + [2217, '2217-01-02'], + [2262, '2262-01-02'], + [2840, '2840-01-03'], + [2975, '2975-01-03'], + [1883, '1883-01-02'], + [1868, '1868-01-02'], + [2748, '2748-01-02'], + [2390, '2390-01-02'], + [2645, '2645-01-02'], + [2201, '2201-01-02'], + [2727, '2727-01-04'], + [2699, '2699-01-03'], + [2258, '2258-01-04'], + [2713, '2713-01-02'], + [2499, '2499-01-02'], + [2670, '2670-01-04'], + [2328, '2328-01-03'], + [1960, '1960-01-04'], + [2489, '2489-01-04'], + [2907, '2907-01-04'], + [2960, '2960-01-02'], + [1899, '1899-01-03'], + [1997, '1997-01-02'], + [2671, '2671-01-03'], + [2851, '2851-01-03'], + [2329, '2329-01-02'], + [2598, '2598-01-02'], + [2682, '2682-01-03'], + [2135, '2135-01-04'], + [2313, '2313-01-02'], + [2692, '2692-01-04'], + [2596, '2596-01-04'], + [2024, '2024-01-02'], + [2854, '2854-01-02'], + ]; + } +} diff --git a/tests/NewZealand/NewYearsDayTest.php b/tests/NewZealand/NewYearsDayTest.php new file mode 100644 index 000000000..54387a9e0 --- /dev/null +++ b/tests/NewZealand/NewYearsDayTest.php @@ -0,0 +1,102 @@ + + */ + +namespace Yasumi\Tests\NewZealand; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing New Years Day in the New Zealand. + */ +class NewYearsDayTest extends NewZealandBaseTestCase +{ + /** + * The name of the holiday + */ + const HOLIDAY = 'newYearsDay'; + + /** + * Tests New Years Day + * + * @dataProvider HolidayDataProvider + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param string $expected the expected date + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, + new DateTime($expected, new DateTimeZone(self::TIMEZONE))); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider() + { + return [ + [2647, '2647-01-01'], + [1923, '1923-01-01'], + [2950, '2950-01-01'], + [2984, '2984-01-01'], + [2361, '2361-01-02'], + [1863, '1863-01-01'], + [1969, '1969-01-01'], + [2602, '2602-01-01'], + [2991, '2991-01-03'], + [2607, '2607-01-01'], + [2959, '2959-01-01'], + [1891, '1891-01-01'], + [2805, '2805-01-03'], + [1966, '1966-01-03'], + [1983, '1983-01-03'], + [2721, '2721-01-03'], + [2142, '2142-01-01'], + [2736, '2736-01-01'], + [2772, '2772-01-03'], + [2862, '2862-01-02'], + [2479, '2479-01-02'], + [2372, '2372-01-03'], + [1931, '1931-01-01'], + [1835, '1835-01-01'], + [2405, '2405-01-03'], + [2090, '2090-01-02'], + [2124, '2124-01-03'], + [1825, '1825-01-03'], + [2226, '2226-01-02'], + [2326, '2326-01-01'], + [1939, '1939-01-02'], + [1987, '1987-01-01'], + [2818, '2818-01-01'], + [2923, '2923-01-01'], + [2337, '2337-01-01'], + [1973, '1973-01-01'], + [1908, '1908-01-01'], + [2178, '2178-01-01'], + [2356, '2356-01-02'], + [2013, '2013-01-01'], + [1880, '1880-01-01'], + [2515, '2515-01-01'], + [2939, '2939-01-01'], + [2574, '2574-01-03'], + [2431, '2431-01-01'], + [2754, '2754-01-01'], + [2784, '2784-01-02'], + [2682, '2682-01-02'], + [2524, '2524-01-03'], + [2003, '2003-01-01'], + ]; + } +} From 1817028ca98bb7746b37d9e8e7fdcf05f5de14a9 Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Thu, 7 Apr 2016 10:46:13 +1200 Subject: [PATCH 10/17] Refactoring xmas holiday calculations and added tests. --- src/Yasumi/Provider/NewZealand.php | 28 ++++++- tests/NewZealand/BoxingDayTest.php | 101 ++++++++++++++++++++++++++ tests/NewZealand/ChristmasDayTest.php | 101 ++++++++++++++++++++++++++ 3 files changed, 228 insertions(+), 2 deletions(-) create mode 100644 tests/NewZealand/BoxingDayTest.php create mode 100644 tests/NewZealand/ChristmasDayTest.php diff --git a/src/Yasumi/Provider/NewZealand.php b/src/Yasumi/Provider/NewZealand.php index d42f7c25f..7e3ebc449 100644 --- a/src/Yasumi/Provider/NewZealand.php +++ b/src/Yasumi/Provider/NewZealand.php @@ -40,8 +40,7 @@ public function initialize() // Add Christian holidays $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale)); $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale)); - $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale)); - $this->addHoliday($this->secondChristmasDay($this->year, $this->timezone, $this->locale)); + $this->calculateChristmasHolidays(); } /** @@ -70,6 +69,31 @@ public function calculateWaitangiDay() $this->addHoliday(new Holiday('waitangiDay', [], $date, $this->locale)); } + /** + * + */ + public function calculateChristmasHolidays() + { + $christmasDay = new DateTime("$this->year-12-25", new DateTimeZone($this->timezone)); + $boxingDay = new DateTime("$this->year-12-26", new DateTimeZone($this->timezone)); + + switch ($christmasDay->format('w')) { + case 0: + $christmasDay->add(new DateInterval('P2D')); + break; + case 5: + $boxingDay->add(new DateInterval('P2D')); + break; + case 6: + $christmasDay->add(new DateInterval('P2D')); + $boxingDay->add(new DateInterval('P2D')); + break; + } + + $this->addHoliday(new Holiday('christmasDay', [], $christmasDay, $this->locale)); + $this->addHoliday(new Holiday('secondChristmasDay', [], $boxingDay, $this->locale)); + } + /** * Holidays associated with the start of the modern Gregorian calendar * diff --git a/tests/NewZealand/BoxingDayTest.php b/tests/NewZealand/BoxingDayTest.php new file mode 100644 index 000000000..43e31fe35 --- /dev/null +++ b/tests/NewZealand/BoxingDayTest.php @@ -0,0 +1,101 @@ + + */ + +namespace Yasumi\Tests\NewZealand; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing Boxing Day in the New Zealand. + */ +class BoxingDayTest extends NewZealandBaseTestCase +{ + /** + * The name of the holiday + */ + const HOLIDAY = 'secondChristmasDay'; + + /** + * Tests Boxing Day + * + * @dataProvider HolidayDataProvider + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param string $expected the expected date + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, + new DateTime($expected, new DateTimeZone(self::TIMEZONE))); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider() + { + return [ + [2448, '2448-12-28'], + [2798, '2798-12-28'], + [1929, '1929-12-26'], + [2360, '2360-12-26'], + [2929, '2929-12-26'], + [1910, '1910-12-26'], + [1867, '1867-12-26'], + [2163, '2163-12-26'], + [2782, '2782-12-28'], + [2472, '2472-12-26'], + [1952, '1952-12-26'], + [2642, '2642-12-26'], + [2606, '2606-12-26'], + [2953, '2953-12-26'], + [2748, '2748-12-28'], + [2476, '2476-12-28'], + [2354, '2354-12-28'], + [2178, '2178-12-28'], + [2476, '2476-12-28'], + [2789, '2789-12-26'], + [1843, '1843-12-26'], + [2734, '2734-12-26'], + [2866, '2866-12-28'], + [1830, '1830-12-28'], + [2724, '2724-12-26'], + [2656, '2656-12-26'], + [2184, '2184-12-28'], + [2573, '2573-12-28'], + [1809, '1809-12-26'], + [1867, '1867-12-26'], + [2113, '2113-12-26'], + [2249, '2249-12-26'], + [2631, '2631-12-26'], + [2633, '2633-12-26'], + [2448, '2448-12-28'], + [1970, '1970-12-28'], + [1855, '1855-12-26'], + [2901, '2901-12-26'], + [1942, '1942-12-28'], + [2610, '2610-12-26'], + [2568, '2568-12-26'], + [2212, '2212-12-28'], + [1833, '1833-12-26'], + [2778, '2778-12-26'], + [2393, '2393-12-28'], + [2699, '2699-12-26'], + [1992, '1992-12-28'], + [2882, '2882-12-28'], + [2324, '2324-12-26'], + ]; + } +} diff --git a/tests/NewZealand/ChristmasDayTest.php b/tests/NewZealand/ChristmasDayTest.php new file mode 100644 index 000000000..2420a9fc6 --- /dev/null +++ b/tests/NewZealand/ChristmasDayTest.php @@ -0,0 +1,101 @@ + + */ + +namespace Yasumi\Tests\NewZealand; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing Christmas Day in the New Zealand. + */ +class ChristmasDayTest extends NewZealandBaseTestCase +{ + /** + * The name of the holiday + */ + const HOLIDAY = 'christmasDay'; + + /** + * Tests Christmas Day + * + * @dataProvider HolidayDataProvider + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param string $expected the expected date + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, + new DateTime($expected, new DateTimeZone(self::TIMEZONE))); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider() + { + return [ + [1882, '1882-12-25'], + [1924, '1924-12-25'], + [2611, '2611-12-25'], + [2690, '2690-12-25'], + [1827, '1827-12-25'], + [2417, '2417-12-25'], + [2125, '2125-12-25'], + [2135, '2135-12-27'], + [2453, '2453-12-25'], + [1818, '1818-12-25'], + [2449, '2449-12-27'], + [2190, '2190-12-27'], + [2425, '2425-12-25'], + [2695, '2695-12-25'], + [2667, '2667-12-25'], + [2548, '2548-12-25'], + [2064, '2064-12-25'], + [2490, '2490-12-25'], + [1997, '1997-12-25'], + [2008, '2008-12-25'], + [2369, '2369-12-25'], + [2999, '2999-12-25'], + [2514, '2514-12-25'], + [2099, '2099-12-25'], + [3000, '3000-12-25'], + [2354, '2354-12-27'], + [2825, '2825-12-25'], + [2874, '2874-12-25'], + [2345, '2345-12-25'], + [2639, '2639-12-25'], + [2074, '2074-12-25'], + [2016, '2016-12-27'], + [2258, '2258-12-27'], + [1887, '1887-12-27'], + [2949, '2949-12-25'], + [2047, '2047-12-25'], + [2364, '2364-12-25'], + [2331, '2331-12-25'], + [2445, '2445-12-25'], + [2276, '2276-12-25'], + [2796, '2796-12-25'], + [2631, '2631-12-27'], + [2585, '2585-12-27'], + [2099, '2099-12-25'], + [2622, '2622-12-25'], + [2510, '2510-12-25'], + [2248, '2248-12-25'], + [2784, '2784-12-25'], + [2533, '2533-12-25'], + ]; + } +} From ff95546c0ad1a50ef519ae7fc024627e466367c1 Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Thu, 7 Apr 2016 10:52:29 +1200 Subject: [PATCH 11/17] cleaned up NewZealand::calculateNewYearHolidays() --- src/Yasumi/Provider/NewZealand.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Yasumi/Provider/NewZealand.php b/src/Yasumi/Provider/NewZealand.php index 7e3ebc449..12f716987 100644 --- a/src/Yasumi/Provider/NewZealand.php +++ b/src/Yasumi/Provider/NewZealand.php @@ -107,19 +107,18 @@ public function calculateChristmasHolidays() public function calculateNewYearHolidays() { $newYearsDay = new DateTime("$this->year-01-01", new DateTimeZone($this->timezone)); - - if (!$this->isWorkingDay($newYearsDay)) { - $newYearsDay->modify('next monday'); - } - $dayAfterNewYearsDay = new DateTime("$this->year-01-02", new DateTimeZone($this->timezone)); - switch ($dayAfterNewYearsDay->format('w')) { - case 1: + switch ($newYearsDay->format('w')) { + case 0: + $newYearsDay->add(new DateInterval('P1D')); $dayAfterNewYearsDay->add(new DateInterval('P1D')); break; + case 5: + $dayAfterNewYearsDay->add(new DateInterval('P2D')); + break; case 6: - case 0: + $newYearsDay->add(new DateInterval('P2D')); $dayAfterNewYearsDay->add(new DateInterval('P2D')); break; } From c02f284efdd97780ef77ab271cfbd16dad2e6fba Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Thu, 7 Apr 2016 11:07:30 +1200 Subject: [PATCH 12/17] updating doc blocks --- src/Yasumi/Provider/NewZealand.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Yasumi/Provider/NewZealand.php b/src/Yasumi/Provider/NewZealand.php index 12f716987..030285b87 100644 --- a/src/Yasumi/Provider/NewZealand.php +++ b/src/Yasumi/Provider/NewZealand.php @@ -53,6 +53,7 @@ public function initialize() * the Monday that immediately follows becomes a public holiday. * * @link https://en.wikipedia.org/wiki/Waitangi_Day + * @link http://employment.govt.nz/er/holidaysandleave/publicholidays/mondayisation.asp */ public function calculateWaitangiDay() { @@ -70,7 +71,14 @@ public function calculateWaitangiDay() } /** + * Christmas Day / Boxing Day * + * Christmas day, and Boxing day are public holidays in New Zealand, + * they are subject to mondayisation rules. + * + * @link http://www.timeanddate.com/holidays/new-zealand/boxing-day + * @link http://www.timeanddate.com/holidays/new-zealand/christmas-day + * @link http://employment.govt.nz/er/holidaysandleave/publicholidays/mondayisation.asp */ public function calculateChristmasHolidays() { @@ -103,6 +111,7 @@ public function calculateChristmasHolidays() * @link https://en.wikipedia.org/wiki/Public_holidays_in_New_Zealand#Statutory_holidays * @link http://www.timeanddate.com/holidays/new-zealand/new-year-day * @link http://www.timeanddate.com/holidays/new-zealand/day-after-new-years-day + * @link http://employment.govt.nz/er/holidaysandleave/publicholidays/mondayisation.asp */ public function calculateNewYearHolidays() { @@ -135,6 +144,7 @@ public function calculateNewYearHolidays() * Observed on 25 April each year. * * @link https://en.wikipedia.org/wiki/Anzac_Day + * @link http://employment.govt.nz/er/holidaysandleave/publicholidays/mondayisation.asp */ public function calculateAnzacDay() { From b84a8a5f6bce5c05c51ba5638affec4109aca218 Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Thu, 7 Apr 2016 11:44:01 +1200 Subject: [PATCH 13/17] More tests --- tests/NewZealand/EasterMondayTest.php | 102 ++++++++++++++++++++++++++ tests/NewZealand/GoodFridayTest.php | 102 ++++++++++++++++++++++++++ tests/NewZealand/NewZealandTest.php | 84 +++++++++++++++++++++ 3 files changed, 288 insertions(+) create mode 100644 tests/NewZealand/EasterMondayTest.php create mode 100644 tests/NewZealand/GoodFridayTest.php create mode 100644 tests/NewZealand/NewZealandTest.php diff --git a/tests/NewZealand/EasterMondayTest.php b/tests/NewZealand/EasterMondayTest.php new file mode 100644 index 000000000..7650e9cd7 --- /dev/null +++ b/tests/NewZealand/EasterMondayTest.php @@ -0,0 +1,102 @@ + + */ + +namespace Yasumi\Tests\NewZealand; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing Easter Monday in New Zealand. + */ +class EasterMondayTest extends NewZealandBaseTestCase +{ + /** + * The name of the holiday + */ + const HOLIDAY = 'easterMonday'; + + /** + * Tests Easter Monday + * + * @dataProvider HolidayDataProvider + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param string $expected the expected date + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, + new DateTime($expected, new DateTimeZone(self::TIMEZONE))); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider() + { + return [ + [2757, '2757-04-01'], + [1829, '1829-04-20'], + [2413, '2413-04-22'], + [2455, '2455-04-05'], + [2668, '2668-04-20'], + [2476, '2476-04-13'], + [2848, '2848-04-13'], + [2882, '2882-03-30'], + [2530, '2530-04-17'], + [2495, '2495-04-11'], + [1972, '1972-04-03'], + [2864, '2864-04-21'], + [2135, '2135-04-04'], + [1885, '1885-04-06'], + [2797, '2797-04-07'], + [2375, '2375-04-21'], + [2695, '2695-03-25'], + [1938, '1938-04-18'], + [2963, '2963-04-04'], + [2904, '2904-03-31'], + [2474, '2474-04-09'], + [2552, '2552-04-17'], + [1817, '1817-04-07'], + [2967, '2967-04-20'], + [2890, '2890-04-03'], + [2318, '2318-04-22'], + [2325, '2325-04-06'], + [2346, '2346-04-15'], + [2398, '2398-04-06'], + [2868, '2868-04-02'], + [1908, '1908-04-20'], + [2292, '2292-04-11'], + [1845, '1845-03-24'], + [2585, '2585-04-11'], + [2749, '2749-03-28'], + [2333, '2333-04-03'], + [1841, '1841-04-12'], + [2218, '2218-04-13'], + [2031, '2031-04-14'], + [2462, '2462-04-17'], + [2134, '2134-04-12'], + [2772, '2772-04-17'], + [2454, '2454-04-20'], + [2635, '2635-03-30'], + [2889, '2889-04-11'], + [2369, '2369-03-31'], + [1941, '1941-04-14'], + [2129, '2129-04-11'], + [2684, '2684-03-31'], + [2190, '2190-04-26'], + ]; + } +} diff --git a/tests/NewZealand/GoodFridayTest.php b/tests/NewZealand/GoodFridayTest.php new file mode 100644 index 000000000..9c640f3a6 --- /dev/null +++ b/tests/NewZealand/GoodFridayTest.php @@ -0,0 +1,102 @@ + + */ + +namespace Yasumi\Tests\NewZealand; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing Good Friday in New Zealand. + */ +class GoodFridayTest extends NewZealandBaseTestCase +{ + /** + * The name of the holiday + */ + const HOLIDAY = 'goodFriday'; + + /** + * Tests Good Friday + * + * @dataProvider HolidayDataProvider + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param string $expected the expected date + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, + new DateTime($expected, new DateTimeZone(self::TIMEZONE))); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider() + { + return [ + [2096, '2096-04-13'], + [2482, '2482-04-03'], + [2971, '2971-04-05'], + [2024, '2024-03-29'], + [2244, '2244-03-29'], + [1832, '1832-04-20'], + [2415, '2415-03-27'], + [2107, '2107-04-08'], + [2440, '2440-04-20'], + [2420, '2420-04-03'], + [2803, '2803-03-28'], + [2932, '2932-04-11'], + [2437, '2437-03-20'], + [2275, '2275-04-16'], + [2228, '2228-03-21'], + [2440, '2440-04-20'], + [2489, '2489-04-15'], + [2902, '2902-04-14'], + [2592, '2592-04-20'], + [2734, '2734-04-13'], + [1867, '1867-04-19'], + [2145, '2145-04-09'], + [2300, '2300-04-06'], + [1809, '1809-03-31'], + [1998, '1998-04-10'], + [1873, '1873-04-11'], + [2500, '2500-04-16'], + [2003, '2003-04-18'], + [2749, '2749-03-25'], + [1984, '1984-04-20'], + [2405, '2405-04-15'], + [2026, '2026-04-03'], + [2638, '2638-03-23'], + [2275, '2275-04-16'], + [2800, '2800-03-31'], + [1915, '1915-04-02'], + [1814, '1814-04-08'], + [1883, '1883-03-23'], + [1856, '1856-03-21'], + [2704, '2704-04-15'], + [2169, '2169-04-14'], + [2552, '2552-04-14'], + [2082, '2082-04-17'], + [2907, '2907-04-22'], + [2268, '2268-04-03'], + [2900, '2900-04-09'], + [2027, '2027-03-26'], + [2915, '2915-03-22'], + [2885, '2885-03-23'], + [2199, '2199-04-12'], + ]; + } +} diff --git a/tests/NewZealand/NewZealandTest.php b/tests/NewZealand/NewZealandTest.php new file mode 100644 index 000000000..61ece5aa4 --- /dev/null +++ b/tests/NewZealand/NewZealandTest.php @@ -0,0 +1,84 @@ + + */ + +namespace Yasumi\Tests\NewZealand; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in New Zealand. + */ +class NewZealandTest extends NewZealandBaseTestCase +{ + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all national holidays in New Zealand are defined by the provider class + */ + public function testNationalHolidays() + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'waitangiDay', + 'anzacDay', + 'queensBirthday', + 'labourDay', + ], self::REGION, $this->year, Holiday::TYPE_NATIONAL); + } + + /** + * Tests if all observed holidays in New Zealand are defined by the provider class + */ + public function testObservedHolidays() + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); + } + + /** + * Tests if all seasonal holidays in New Zealand are defined by the provider class + */ + public function testSeasonalHolidays() + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); + } + + /** + * Tests if all bank holidays in New Zealand are defined by the provider class + */ + public function testBankHolidays() + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); + } + + /** + * Tests if all other holidays in New Zealand are defined by the provider class + */ + public function testOtherHolidays() + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1987); + } +} From e092a68b50ca5e6cfb8f65c8c053f4972e646a8d Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Thu, 7 Apr 2016 12:47:56 +1200 Subject: [PATCH 14/17] Adding translations for unique holiday names --- src/Yasumi/data/translations/anzacDay.php | 16 ++++++++++++++++ .../data/translations/dayAfterNewYearsDay.php | 16 ++++++++++++++++ src/Yasumi/data/translations/waitangiDay.php | 16 ++++++++++++++++ tests/NewZealand/AnzacDayTest.php | 13 +++++++++++++ tests/NewZealand/DayAfterNewYearsDayTest.php | 13 +++++++++++++ tests/NewZealand/WaitangiDayTest.php | 13 +++++++++++++ 6 files changed, 87 insertions(+) create mode 100644 src/Yasumi/data/translations/anzacDay.php create mode 100644 src/Yasumi/data/translations/dayAfterNewYearsDay.php create mode 100644 src/Yasumi/data/translations/waitangiDay.php diff --git a/src/Yasumi/data/translations/anzacDay.php b/src/Yasumi/data/translations/anzacDay.php new file mode 100644 index 000000000..f7043a67b --- /dev/null +++ b/src/Yasumi/data/translations/anzacDay.php @@ -0,0 +1,16 @@ + + */ + +// Translation for ANZAC Day +return [ + 'en_US' => 'ANZAC Day', +]; \ No newline at end of file diff --git a/src/Yasumi/data/translations/dayAfterNewYearsDay.php b/src/Yasumi/data/translations/dayAfterNewYearsDay.php new file mode 100644 index 000000000..83dede297 --- /dev/null +++ b/src/Yasumi/data/translations/dayAfterNewYearsDay.php @@ -0,0 +1,16 @@ + + */ + +// Translation for Day after New Year's Day +return [ + 'en_US' => 'Day after New Year\'s Day', +]; \ No newline at end of file diff --git a/src/Yasumi/data/translations/waitangiDay.php b/src/Yasumi/data/translations/waitangiDay.php new file mode 100644 index 000000000..c7669f07a --- /dev/null +++ b/src/Yasumi/data/translations/waitangiDay.php @@ -0,0 +1,16 @@ + + */ + +// Translation for Waitangi Day +return [ + 'en_US' => 'Waitangi Day', +]; \ No newline at end of file diff --git a/tests/NewZealand/AnzacDayTest.php b/tests/NewZealand/AnzacDayTest.php index b2003f7ef..6682bf866 100644 --- a/tests/NewZealand/AnzacDayTest.php +++ b/tests/NewZealand/AnzacDayTest.php @@ -47,6 +47,19 @@ public function testNotHoliday() $this->assertNotHoliday(self::REGION, self::HOLIDAY, 1920); } + /** + * Tests the translated name of the holiday defined in this test. + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(1921), + ['en_US' => 'ANZAC Day'] + ); + } + /** * Returns a list of test dates * diff --git a/tests/NewZealand/DayAfterNewYearsDayTest.php b/tests/NewZealand/DayAfterNewYearsDayTest.php index 3019f0542..09ca7c1cd 100644 --- a/tests/NewZealand/DayAfterNewYearsDayTest.php +++ b/tests/NewZealand/DayAfterNewYearsDayTest.php @@ -39,6 +39,19 @@ public function testHoliday($year, $expected) new DateTime($expected, new DateTimeZone(self::TIMEZONE))); } + /** + * Tests the translated name of the holiday defined in this test. + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(1921), + ['en_US' => 'Day after New Year\'s Day'] + ); + } + /** * Returns a list of test dates * diff --git a/tests/NewZealand/WaitangiDayTest.php b/tests/NewZealand/WaitangiDayTest.php index 0e98837ec..9c7773f58 100644 --- a/tests/NewZealand/WaitangiDayTest.php +++ b/tests/NewZealand/WaitangiDayTest.php @@ -47,6 +47,19 @@ public function testNotHoliday() $this->assertNotHoliday(self::REGION, self::HOLIDAY, 1973); } + /** + * Tests the translated name of the holiday defined in this test. + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(1921), + ['en_US' => 'Waitangi Day'] + ); + } + /** * Returns a list of test dates * From 21a402d61c8a497ddd5de17173b0055d64cf8f8b Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Fri, 8 Apr 2016 09:28:37 +1200 Subject: [PATCH 15/17] Replacing hardcoded list of ANZAC dates --- tests/NewZealand/AnzacDayTest.php | 116 ++++-------------------------- 1 file changed, 15 insertions(+), 101 deletions(-) diff --git a/tests/NewZealand/AnzacDayTest.php b/tests/NewZealand/AnzacDayTest.php index 6682bf866..87b974ca6 100644 --- a/tests/NewZealand/AnzacDayTest.php +++ b/tests/NewZealand/AnzacDayTest.php @@ -67,106 +67,20 @@ public function testTranslation() */ public function HolidayDataProvider() { - return [ - ['2148', '2148-04-25'], - ['2002', '2002-04-25'], - ['2105', '2105-04-27'], - ['2065', '2065-04-27'], - ['2052', '2052-04-25'], - ['2039', '2039-04-25'], - ['2047', '2047-04-25'], - ['2117', '2117-04-26'], - ['2122', '2122-04-27'], - ['2007', '2007-04-25'], - ['2089', '2089-04-25'], - ['2063', '2063-04-25'], - ['1992', '1992-04-25'], - ['1931', '1931-04-25'], - ['1941', '1941-04-25'], - ['1935', '1935-04-25'], - ['2044', '2044-04-25'], - ['2069', '2069-04-25'], - ['2101', '2101-04-25'], - ['2086', '2086-04-25'], - ['2094', '2094-04-26'], - ['2012', '2012-04-25'], - ['2082', '2082-04-27'], - ['2028', '2028-04-25'], - ['1934', '1934-04-25'], - ['2121', '2121-04-25'], - ['2107', '2107-04-25'], - ['2019', '2019-04-25'], - ['1999', '1999-04-25'], - ['2058', '2058-04-25'], - ['2033', '2033-04-25'], - ['2079', '2079-04-25'], - ['2069', '2069-04-25'], - ['2079', '2079-04-25'], - ['2105', '2105-04-27'], - ['2109', '2109-04-25'], - ['2065', '2065-04-27'], - ['2076', '2076-04-27'], - ['2017', '2017-04-25'], - ['2079', '2079-04-25'], - ['1963', '1963-04-25'], - ['2019', '2019-04-25'], - ['2109', '2109-04-25'], - ['2077', '2077-04-26'], - ['2058', '2058-04-25'], - ['2120', '2120-04-25'], - ['1960', '1960-04-25'], - ['2093', '2093-04-27'], - ['2011', '2011-04-25'], - ['2106', '2106-04-26'], - ['1946', '1946-04-25'], - ['1995', '1995-04-25'], - ['2005', '2005-04-25'], - ['1932', '1932-04-25'], - ['2030', '2030-04-25'], - ['2124', '2124-04-25'], - ['1980', '1980-04-25'], - ['1962', '1962-04-25'], - ['2136', '2136-04-25'], - ['2017', '2017-04-25'], - ['2098', '2098-04-25'], - ['2015', '2015-04-27'], - ['2016', '2016-04-25'], - ['2069', '2069-04-25'], - ['2102', '2102-04-25'], - ['2044', '2044-04-25'], - ['2008', '2008-04-25'], - ['2045', '2045-04-25'], - ['2093', '2093-04-27'], - ['2084', '2084-04-25'], - ['2052', '2052-04-25'], - ['2136', '2136-04-25'], - ['2034', '2034-04-25'], - ['2033', '2033-04-25'], - ['1924', '1924-04-25'], - ['1977', '1977-04-25'], - ['2024', '2024-04-25'], - ['2095', '2095-04-25'], - ['2087', '2087-04-25'], - ['2117', '2117-04-26'], - ['2003', '2003-04-25'], - ['2116', '2116-04-27'], - ['1986', '1986-04-25'], - ['1968', '1968-04-25'], - ['2068', '2068-04-25'], - ['2007', '2007-04-25'], - ['2068', '2068-04-25'], - ['2095', '2095-04-25'], - ['2013', '2013-04-25'], - ['1986', '1986-04-25'], - ['2032', '2032-04-26'], - ['1925', '1925-04-25'], - ['1969', '1969-04-25'], - ['2063', '2063-04-25'], - ['2043', '2043-04-27'], - ['2009', '2009-04-25'], - ['1939', '1939-04-25'], - ['2031', '2031-04-25'], - ['1929', '1929-04-25'], - ]; + $data = []; + + for ($i = 0; $i < 100; $i++) { + $year = $this->generateRandomYear(1921, 2100); + $date = new DateTime("$year-04-25", new DateTimeZone(self::TIMEZONE)); + + // in 2015 some policy was introduced to make sure this holiday was celebrated during the working week. + if ($year >= 2015 && in_array($date->format('w'), [0, 6])) { + $date->modify('next monday'); + } + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; } } From 07010c2e010d15c292f62f9ec0ac98879f222f51 Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Fri, 8 Apr 2016 10:54:10 +1200 Subject: [PATCH 16/17] Refactoring HolidayDataProvider implementations in NZ test suite --- tests/NewZealand/BoxingDayTest.php | 66 +++-------- tests/NewZealand/ChristmasDayTest.php | 66 +++-------- tests/NewZealand/DayAfterNewYearsDayTest.php | 71 ++++------- tests/NewZealand/EasterMondayTest.php | 64 ++-------- tests/NewZealand/GoodFridayTest.php | 64 ++-------- tests/NewZealand/LabourDayTest.php | 115 ++---------------- tests/NewZealand/NewYearsDayTest.php | 72 ++++------- tests/NewZealand/WaitangiDayTest.php | 118 +++---------------- 8 files changed, 123 insertions(+), 513 deletions(-) diff --git a/tests/NewZealand/BoxingDayTest.php b/tests/NewZealand/BoxingDayTest.php index 43e31fe35..f4c79fd3a 100644 --- a/tests/NewZealand/BoxingDayTest.php +++ b/tests/NewZealand/BoxingDayTest.php @@ -14,6 +14,7 @@ use DateTime; use DateTimeZone; +use DateInterval; /** * Class for testing Boxing Day in the New Zealand. @@ -46,56 +47,19 @@ public function testHoliday($year, $expected) */ public function HolidayDataProvider() { - return [ - [2448, '2448-12-28'], - [2798, '2798-12-28'], - [1929, '1929-12-26'], - [2360, '2360-12-26'], - [2929, '2929-12-26'], - [1910, '1910-12-26'], - [1867, '1867-12-26'], - [2163, '2163-12-26'], - [2782, '2782-12-28'], - [2472, '2472-12-26'], - [1952, '1952-12-26'], - [2642, '2642-12-26'], - [2606, '2606-12-26'], - [2953, '2953-12-26'], - [2748, '2748-12-28'], - [2476, '2476-12-28'], - [2354, '2354-12-28'], - [2178, '2178-12-28'], - [2476, '2476-12-28'], - [2789, '2789-12-26'], - [1843, '1843-12-26'], - [2734, '2734-12-26'], - [2866, '2866-12-28'], - [1830, '1830-12-28'], - [2724, '2724-12-26'], - [2656, '2656-12-26'], - [2184, '2184-12-28'], - [2573, '2573-12-28'], - [1809, '1809-12-26'], - [1867, '1867-12-26'], - [2113, '2113-12-26'], - [2249, '2249-12-26'], - [2631, '2631-12-26'], - [2633, '2633-12-26'], - [2448, '2448-12-28'], - [1970, '1970-12-28'], - [1855, '1855-12-26'], - [2901, '2901-12-26'], - [1942, '1942-12-28'], - [2610, '2610-12-26'], - [2568, '2568-12-26'], - [2212, '2212-12-28'], - [1833, '1833-12-26'], - [2778, '2778-12-26'], - [2393, '2393-12-28'], - [2699, '2699-12-26'], - [1992, '1992-12-28'], - [2882, '2882-12-28'], - [2324, '2324-12-26'], - ]; + $data = []; + + for ($y = 0; $y < 50; $y++) { + $year = $this->generateRandomYear(1800, 2100); + $date = new DateTime("$year-12-26", new DateTimeZone(self::TIMEZONE)); + + if (in_array($date->format('w'), [0, 6])) { + $date->add(new DateInterval('P2D')); + } + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; } } diff --git a/tests/NewZealand/ChristmasDayTest.php b/tests/NewZealand/ChristmasDayTest.php index 2420a9fc6..b5a6bf287 100644 --- a/tests/NewZealand/ChristmasDayTest.php +++ b/tests/NewZealand/ChristmasDayTest.php @@ -14,6 +14,7 @@ use DateTime; use DateTimeZone; +use DateInterval; /** * Class for testing Christmas Day in the New Zealand. @@ -46,56 +47,19 @@ public function testHoliday($year, $expected) */ public function HolidayDataProvider() { - return [ - [1882, '1882-12-25'], - [1924, '1924-12-25'], - [2611, '2611-12-25'], - [2690, '2690-12-25'], - [1827, '1827-12-25'], - [2417, '2417-12-25'], - [2125, '2125-12-25'], - [2135, '2135-12-27'], - [2453, '2453-12-25'], - [1818, '1818-12-25'], - [2449, '2449-12-27'], - [2190, '2190-12-27'], - [2425, '2425-12-25'], - [2695, '2695-12-25'], - [2667, '2667-12-25'], - [2548, '2548-12-25'], - [2064, '2064-12-25'], - [2490, '2490-12-25'], - [1997, '1997-12-25'], - [2008, '2008-12-25'], - [2369, '2369-12-25'], - [2999, '2999-12-25'], - [2514, '2514-12-25'], - [2099, '2099-12-25'], - [3000, '3000-12-25'], - [2354, '2354-12-27'], - [2825, '2825-12-25'], - [2874, '2874-12-25'], - [2345, '2345-12-25'], - [2639, '2639-12-25'], - [2074, '2074-12-25'], - [2016, '2016-12-27'], - [2258, '2258-12-27'], - [1887, '1887-12-27'], - [2949, '2949-12-25'], - [2047, '2047-12-25'], - [2364, '2364-12-25'], - [2331, '2331-12-25'], - [2445, '2445-12-25'], - [2276, '2276-12-25'], - [2796, '2796-12-25'], - [2631, '2631-12-27'], - [2585, '2585-12-27'], - [2099, '2099-12-25'], - [2622, '2622-12-25'], - [2510, '2510-12-25'], - [2248, '2248-12-25'], - [2784, '2784-12-25'], - [2533, '2533-12-25'], - ]; + $data = []; + + for ($y = 0; $y < 50; $y ++) { + $year = $this->generateRandomYear(1800, 2100); + $date = new DateTime("$year-12-25", new DateTimeZone(self::TIMEZONE)); + + if (in_array($date->format('w'), [0, 6])) { + $date->add(new DateInterval('P2D')); + } + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; } } diff --git a/tests/NewZealand/DayAfterNewYearsDayTest.php b/tests/NewZealand/DayAfterNewYearsDayTest.php index 09ca7c1cd..c7b9ffde4 100644 --- a/tests/NewZealand/DayAfterNewYearsDayTest.php +++ b/tests/NewZealand/DayAfterNewYearsDayTest.php @@ -14,6 +14,7 @@ use DateTime; use DateTimeZone; +use DateInterval; /** * Class for testing Day After New Years Day in the New Zealand. @@ -59,56 +60,24 @@ public function testTranslation() */ public function HolidayDataProvider() { - return [ - [2114, '2114-01-02'], - [1923, '1923-01-02'], - [2210, '2210-01-02'], - [2191, '2191-01-04'], - [2087, '2087-01-02'], - [1800, '1800-01-02'], - [2936, '2936-01-03'], - [2607, '2607-01-02'], - [2476, '2476-01-02'], - [1806, '1806-01-02'], - [2036, '2036-01-02'], - [2043, '2043-01-02'], - [2103, '2103-01-02'], - [2062, '2062-01-03'], - [2556, '2556-01-02'], - [2217, '2217-01-02'], - [2262, '2262-01-02'], - [2840, '2840-01-03'], - [2975, '2975-01-03'], - [1883, '1883-01-02'], - [1868, '1868-01-02'], - [2748, '2748-01-02'], - [2390, '2390-01-02'], - [2645, '2645-01-02'], - [2201, '2201-01-02'], - [2727, '2727-01-04'], - [2699, '2699-01-03'], - [2258, '2258-01-04'], - [2713, '2713-01-02'], - [2499, '2499-01-02'], - [2670, '2670-01-04'], - [2328, '2328-01-03'], - [1960, '1960-01-04'], - [2489, '2489-01-04'], - [2907, '2907-01-04'], - [2960, '2960-01-02'], - [1899, '1899-01-03'], - [1997, '1997-01-02'], - [2671, '2671-01-03'], - [2851, '2851-01-03'], - [2329, '2329-01-02'], - [2598, '2598-01-02'], - [2682, '2682-01-03'], - [2135, '2135-01-04'], - [2313, '2313-01-02'], - [2692, '2692-01-04'], - [2596, '2596-01-04'], - [2024, '2024-01-02'], - [2854, '2854-01-02'], - ]; + $data = []; + + for ($y = 0; $y < 50; $y ++) { + $year = $this->generateRandomYear(1800, 2100); + $date = new DateTime("$year-01-02", new DateTimeZone(self::TIMEZONE)); + + switch ($date->format('w')) { + case 0: + case 6: + $date->add(new DateInterval('P2D')); + break; + case 1: + $date->add(new DateInterval('P1D')); + } + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; } } diff --git a/tests/NewZealand/EasterMondayTest.php b/tests/NewZealand/EasterMondayTest.php index 7650e9cd7..b6e314e39 100644 --- a/tests/NewZealand/EasterMondayTest.php +++ b/tests/NewZealand/EasterMondayTest.php @@ -14,6 +14,7 @@ use DateTime; use DateTimeZone; +use DateInterval; /** * Class for testing Easter Monday in New Zealand. @@ -46,57 +47,16 @@ public function testHoliday($year, $expected) */ public function HolidayDataProvider() { - return [ - [2757, '2757-04-01'], - [1829, '1829-04-20'], - [2413, '2413-04-22'], - [2455, '2455-04-05'], - [2668, '2668-04-20'], - [2476, '2476-04-13'], - [2848, '2848-04-13'], - [2882, '2882-03-30'], - [2530, '2530-04-17'], - [2495, '2495-04-11'], - [1972, '1972-04-03'], - [2864, '2864-04-21'], - [2135, '2135-04-04'], - [1885, '1885-04-06'], - [2797, '2797-04-07'], - [2375, '2375-04-21'], - [2695, '2695-03-25'], - [1938, '1938-04-18'], - [2963, '2963-04-04'], - [2904, '2904-03-31'], - [2474, '2474-04-09'], - [2552, '2552-04-17'], - [1817, '1817-04-07'], - [2967, '2967-04-20'], - [2890, '2890-04-03'], - [2318, '2318-04-22'], - [2325, '2325-04-06'], - [2346, '2346-04-15'], - [2398, '2398-04-06'], - [2868, '2868-04-02'], - [1908, '1908-04-20'], - [2292, '2292-04-11'], - [1845, '1845-03-24'], - [2585, '2585-04-11'], - [2749, '2749-03-28'], - [2333, '2333-04-03'], - [1841, '1841-04-12'], - [2218, '2218-04-13'], - [2031, '2031-04-14'], - [2462, '2462-04-17'], - [2134, '2134-04-12'], - [2772, '2772-04-17'], - [2454, '2454-04-20'], - [2635, '2635-03-30'], - [2889, '2889-04-11'], - [2369, '2369-03-31'], - [1941, '1941-04-14'], - [2129, '2129-04-11'], - [2684, '2684-03-31'], - [2190, '2190-04-26'], - ]; + $data = []; + + for ($y = 0; $y < 50; $y ++) { + $year = $this->generateRandomYear(1800, 3000); + $date = new DateTime("$year-3-21", new DateTimeZone(self::TIMEZONE)); + $date->add(new DateInterval('P' . (easter_days($year)+1) . 'D')); + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; } } diff --git a/tests/NewZealand/GoodFridayTest.php b/tests/NewZealand/GoodFridayTest.php index 9c640f3a6..02cf8c20f 100644 --- a/tests/NewZealand/GoodFridayTest.php +++ b/tests/NewZealand/GoodFridayTest.php @@ -14,6 +14,7 @@ use DateTime; use DateTimeZone; +use DateInterval; /** * Class for testing Good Friday in New Zealand. @@ -46,57 +47,16 @@ public function testHoliday($year, $expected) */ public function HolidayDataProvider() { - return [ - [2096, '2096-04-13'], - [2482, '2482-04-03'], - [2971, '2971-04-05'], - [2024, '2024-03-29'], - [2244, '2244-03-29'], - [1832, '1832-04-20'], - [2415, '2415-03-27'], - [2107, '2107-04-08'], - [2440, '2440-04-20'], - [2420, '2420-04-03'], - [2803, '2803-03-28'], - [2932, '2932-04-11'], - [2437, '2437-03-20'], - [2275, '2275-04-16'], - [2228, '2228-03-21'], - [2440, '2440-04-20'], - [2489, '2489-04-15'], - [2902, '2902-04-14'], - [2592, '2592-04-20'], - [2734, '2734-04-13'], - [1867, '1867-04-19'], - [2145, '2145-04-09'], - [2300, '2300-04-06'], - [1809, '1809-03-31'], - [1998, '1998-04-10'], - [1873, '1873-04-11'], - [2500, '2500-04-16'], - [2003, '2003-04-18'], - [2749, '2749-03-25'], - [1984, '1984-04-20'], - [2405, '2405-04-15'], - [2026, '2026-04-03'], - [2638, '2638-03-23'], - [2275, '2275-04-16'], - [2800, '2800-03-31'], - [1915, '1915-04-02'], - [1814, '1814-04-08'], - [1883, '1883-03-23'], - [1856, '1856-03-21'], - [2704, '2704-04-15'], - [2169, '2169-04-14'], - [2552, '2552-04-14'], - [2082, '2082-04-17'], - [2907, '2907-04-22'], - [2268, '2268-04-03'], - [2900, '2900-04-09'], - [2027, '2027-03-26'], - [2915, '2915-03-22'], - [2885, '2885-03-23'], - [2199, '2199-04-12'], - ]; + $data = []; + + for ($y = 0; $y < 50; $y ++) { + $year = $this->generateRandomYear(1800, 3000); + $date = new DateTime("$year-3-21", new DateTimeZone(self::TIMEZONE)); + $date->add(new DateInterval('P' . easter_days($year) . 'D')); + $date->modify('previous friday'); + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; } } diff --git a/tests/NewZealand/LabourDayTest.php b/tests/NewZealand/LabourDayTest.php index 2f68691fe..06903301f 100644 --- a/tests/NewZealand/LabourDayTest.php +++ b/tests/NewZealand/LabourDayTest.php @@ -54,107 +54,18 @@ public function testNotHoliday() */ public function HolidayDataProvider() { - return [ - [2061, '2061-10-24'], - [1957, '1957-10-28'], - [1999, '1999-10-25'], - [1902, '1902-10-08'], - [1900, '1900-10-10'], - [2018, '2018-10-22'], - [1921, '1921-10-24'], - [1915, '1915-10-25'], - [1997, '1997-10-27'], - [2076, '2076-10-26'], - [2111, '2111-10-26'], - [1968, '1968-10-28'], - [1967, '1967-10-23'], - [2092, '2092-10-27'], - [2005, '2005-10-24'], - [1912, '1912-10-28'], - [2115, '2115-10-28'], - [1967, '1967-10-23'], - [1962, '1962-10-22'], - [1983, '1983-10-24'], - [2026, '2026-10-26'], - [2055, '2055-10-25'], - [2100, '2100-10-25'], - [2021, '2021-10-25'], - [2085, '2085-10-22'], - [2097, '2097-10-28'], - [2023, '2023-10-23'], - [1927, '1927-10-24'], - [1935, '1935-10-28'], - [2087, '2087-10-27'], - [2103, '2103-10-22'], - [2037, '2037-10-26'], - [2093, '2093-10-26'], - [1911, '1911-10-23'], - [1988, '1988-10-24'], - [2060, '2060-10-25'], - [1993, '1993-10-25'], - [2048, '2048-10-26'], - [2032, '2032-10-25'], - [2074, '2074-10-22'], - [2099, '2099-10-26'], - [1906, '1906-10-10'], - [2010, '2010-10-25'], - [1994, '1994-10-24'], - [1948, '1948-10-25'], - [2008, '2008-10-27'], - [2054, '2054-10-26'], - [1997, '1997-10-27'], - [2016, '2016-10-24'], - [2108, '2108-10-22'], - [2100, '2100-10-25'], - [1968, '1968-10-28'], - [2005, '2005-10-24'], - [2000, '2000-10-23'], - [2085, '2085-10-22'], - [2073, '2073-10-23'], - [2075, '2075-10-28'], - [2101, '2101-10-24'], - [1906, '1906-10-10'], - [1996, '1996-10-28'], - [2030, '2030-10-28'], - [2114, '2114-10-22'], - [2076, '2076-10-26'], - [1923, '1923-10-22'], - [2049, '2049-10-25'], - [2014, '2014-10-27'], - [1914, '1914-10-26'], - [2035, '2035-10-22'], - [2108, '2108-10-22'], - [2010, '2010-10-25'], - [2023, '2023-10-23'], - [1991, '1991-10-28'], - [2053, '2053-10-27'], - [2049, '2049-10-25'], - [2070, '2070-10-27'], - [2063, '2063-10-22'], - [2113, '2113-10-23'], - [1973, '1973-10-22'], - [1912, '1912-10-28'], - [1965, '1965-10-25'], - [1994, '1994-10-24'], - [1989, '1989-10-23'], - [2046, '2046-10-22'], - [2038, '2038-10-25'], - [1975, '1975-10-27'], - [1939, '1939-10-23'], - [1909, '1909-10-13'], - [1957, '1957-10-28'], - [2063, '2063-10-22'], - [2011, '2011-10-24'], - [1971, '1971-10-25'], - [2013, '2013-10-28'], - [2112, '2112-10-24'], - [1977, '1977-10-24'], - [1982, '1982-10-25'], - [2089, '2089-10-24'], - [2070, '2070-10-27'], - [2036, '2036-10-27'], - [2068, '2068-10-22'], - [1913, '1913-10-27'], - ]; + $data = []; + + for ($y = 0; $y < 100; $y ++) { + $year = $this->generateRandomYear(1900, 2100); + $expected = new DateTime( + (($year < 1910) ? 'second wednesday of october' : 'fourth monday of october') . " $year", + new DateTimeZone(self::TIMEZONE) + ); + + $data[] = [$year, $expected->format('Y-m-d')]; + } + + return $data; } } diff --git a/tests/NewZealand/NewYearsDayTest.php b/tests/NewZealand/NewYearsDayTest.php index 54387a9e0..80576fc39 100644 --- a/tests/NewZealand/NewYearsDayTest.php +++ b/tests/NewZealand/NewYearsDayTest.php @@ -14,6 +14,7 @@ use DateTime; use DateTimeZone; +use DateInterval; /** * Class for testing New Years Day in the New Zealand. @@ -46,57 +47,24 @@ public function testHoliday($year, $expected) */ public function HolidayDataProvider() { - return [ - [2647, '2647-01-01'], - [1923, '1923-01-01'], - [2950, '2950-01-01'], - [2984, '2984-01-01'], - [2361, '2361-01-02'], - [1863, '1863-01-01'], - [1969, '1969-01-01'], - [2602, '2602-01-01'], - [2991, '2991-01-03'], - [2607, '2607-01-01'], - [2959, '2959-01-01'], - [1891, '1891-01-01'], - [2805, '2805-01-03'], - [1966, '1966-01-03'], - [1983, '1983-01-03'], - [2721, '2721-01-03'], - [2142, '2142-01-01'], - [2736, '2736-01-01'], - [2772, '2772-01-03'], - [2862, '2862-01-02'], - [2479, '2479-01-02'], - [2372, '2372-01-03'], - [1931, '1931-01-01'], - [1835, '1835-01-01'], - [2405, '2405-01-03'], - [2090, '2090-01-02'], - [2124, '2124-01-03'], - [1825, '1825-01-03'], - [2226, '2226-01-02'], - [2326, '2326-01-01'], - [1939, '1939-01-02'], - [1987, '1987-01-01'], - [2818, '2818-01-01'], - [2923, '2923-01-01'], - [2337, '2337-01-01'], - [1973, '1973-01-01'], - [1908, '1908-01-01'], - [2178, '2178-01-01'], - [2356, '2356-01-02'], - [2013, '2013-01-01'], - [1880, '1880-01-01'], - [2515, '2515-01-01'], - [2939, '2939-01-01'], - [2574, '2574-01-03'], - [2431, '2431-01-01'], - [2754, '2754-01-01'], - [2784, '2784-01-02'], - [2682, '2682-01-02'], - [2524, '2524-01-03'], - [2003, '2003-01-01'], - ]; + $data = []; + + for ($y = 0; $y < 50; $y ++) { + $year = $this->generateRandomYear(1800, 2100); + $date = new DateTime("$year-01-01", new DateTimeZone(self::TIMEZONE)); + + switch ($date->format('w')) { + case 0: + $date->add(new DateInterval('P1D')); + break; + case 6: + $date->add(new DateInterval('P2D')); + break; + } + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; } } diff --git a/tests/NewZealand/WaitangiDayTest.php b/tests/NewZealand/WaitangiDayTest.php index 9c7773f58..712041d39 100644 --- a/tests/NewZealand/WaitangiDayTest.php +++ b/tests/NewZealand/WaitangiDayTest.php @@ -55,7 +55,7 @@ public function testTranslation() $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1921), + $this->generateRandomYear(1974), ['en_US' => 'Waitangi Day'] ); } @@ -67,106 +67,20 @@ public function testTranslation() */ public function HolidayDataProvider() { - return [ - [2025, '2025-02-06'], - [2103, '2103-02-06'], - [2073, '2073-02-06'], - [2039, '2039-02-07'], - [1980, '1980-02-06'], - [1977, '1977-02-06'], - [2009, '2009-02-06'], - [2097, '2097-02-06'], - [2080, '2080-02-06'], - [2142, '2142-02-06'], - [2097, '2097-02-06'], - [2072, '2072-02-08'], - [2103, '2103-02-06'], - [2022, '2022-02-07'], - [2147, '2147-02-06'], - [2145, '2145-02-08'], - [2107, '2107-02-07'], - [2027, '2027-02-08'], - [1999, '1999-02-06'], - [2144, '2144-02-06'], - [2031, '2031-02-06'], - [2129, '2129-02-07'], - [2103, '2103-02-06'], - [2057, '2057-02-06'], - [2102, '2102-02-06'], - [2112, '2112-02-08'], - [2140, '2140-02-08'], - [2030, '2030-02-06'], - [2132, '2132-02-06'], - [1987, '1987-02-06'], - [2126, '2126-02-06'], - [1995, '1995-02-06'], - [2002, '2002-02-06'], - [2102, '2102-02-06'], - [2086, '2086-02-06'], - [2031, '2031-02-06'], - [2123, '2123-02-08'], - [2098, '2098-02-06'], - [2045, '2045-02-06'], - [2058, '2058-02-06'], - [2092, '2092-02-06'], - [2070, '2070-02-06'], - [1988, '1988-02-06'], - [1974, '1974-02-06'], - [2020, '2020-02-06'], - [2074, '2074-02-06'], - [1982, '1982-02-06'], - [2136, '2136-02-06'], - [2065, '2065-02-06'], - [1991, '1991-02-06'], - [2015, '2015-02-06'], - [2017, '2017-02-06'], - [2130, '2130-02-06'], - [2006, '2006-02-06'], - [2093, '2093-02-06'], - [2013, '2013-02-06'], - [2122, '2122-02-06'], - [2004, '2004-02-06'], - [1983, '1983-02-06'], - [2108, '2108-02-06'], - [1979, '1979-02-06'], - [2112, '2112-02-08'], - [2112, '2112-02-08'], - [2130, '2130-02-06'], - [1992, '1992-02-06'], - [2134, '2134-02-08'], - [2096, '2096-02-06'], - [2126, '2126-02-06'], - [2039, '2039-02-07'], - [2139, '2139-02-06'], - [2040, '2040-02-06'], - [1997, '1997-02-06'], - [2031, '2031-02-06'], - [2110, '2110-02-06'], - [2128, '2128-02-06'], - [2120, '2120-02-06'], - [2058, '2058-02-06'], - [2030, '2030-02-06'], - [2076, '2076-02-06'], - [2020, '2020-02-06'], - [2065, '2065-02-06'], - [2132, '2132-02-06'], - [2014, '2014-02-06'], - [2095, '2095-02-07'], - [2128, '2128-02-06'], - [2004, '2004-02-06'], - [2143, '2143-02-06'], - [2100, '2100-02-08'], - [2124, '2124-02-07'], - [2127, '2127-02-06'], - [2020, '2020-02-06'], - [2022, '2022-02-07'], - [2049, '2049-02-08'], - [1982, '1982-02-06'], - [2043, '2043-02-06'], - [2130, '2130-02-06'], - [2125, '2125-02-06'], - [2121, '2121-02-06'], - [2043, '2043-02-06'], - ]; + $data = []; + + for ($i = 0; $i < 100; $i++) { + $year = $this->generateRandomYear(1974, 2100); + $date = new DateTime("$year-02-06", new DateTimeZone(self::TIMEZONE)); + + // in 2015 some policy was introduced to make sure this holiday was celebrated during the working week. + if ($year >= 2015 && in_array($date->format('w'), [0, 6])) { + $date->modify('next monday'); + } + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; } } From 8b42aa64b1349516135e2fe719bc32ba52c1a7fb Mon Sep 17 00:00:00 2001 From: Byron Adams Date: Sat, 9 Apr 2016 01:10:08 +1200 Subject: [PATCH 17/17] Code style fixes --- src/Yasumi/Provider/NewZealand.php | 3 +-- src/Yasumi/data/translations/anzacDay.php | 2 +- src/Yasumi/data/translations/dayAfterNewYearsDay.php | 2 +- src/Yasumi/data/translations/waitangiDay.php | 2 +- tests/NewZealand/AnzacDayTest.php | 2 +- tests/NewZealand/BoxingDayTest.php | 2 +- tests/NewZealand/ChristmasDayTest.php | 2 +- tests/NewZealand/DayAfterNewYearsDayTest.php | 2 +- tests/NewZealand/EasterMondayTest.php | 2 +- tests/NewZealand/GoodFridayTest.php | 2 +- tests/NewZealand/LabourDayTest.php | 2 +- tests/NewZealand/NewYearsDayTest.php | 2 +- tests/NewZealand/NewZealandBaseTestCase.php | 2 +- tests/NewZealand/NewZealandTest.php | 2 +- tests/NewZealand/QueensBirthdayTest.php | 2 +- tests/NewZealand/WaitangiDayTest.php | 2 +- 16 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/Yasumi/Provider/NewZealand.php b/src/Yasumi/Provider/NewZealand.php index 030285b87..fc398b5e9 100644 --- a/src/Yasumi/Provider/NewZealand.php +++ b/src/Yasumi/Provider/NewZealand.php @@ -159,7 +159,6 @@ public function calculateAnzacDay() } $this->addHoliday(new Holiday('anzacDay', [], $date, $this->locale)); - } /** @@ -216,4 +215,4 @@ public function calculateLabourDay() $this->addHoliday(new Holiday('labourDay', [], $date, $this->locale)); } -} \ No newline at end of file +} diff --git a/src/Yasumi/data/translations/anzacDay.php b/src/Yasumi/data/translations/anzacDay.php index f7043a67b..01d5916e9 100644 --- a/src/Yasumi/data/translations/anzacDay.php +++ b/src/Yasumi/data/translations/anzacDay.php @@ -13,4 +13,4 @@ // Translation for ANZAC Day return [ 'en_US' => 'ANZAC Day', -]; \ No newline at end of file +]; diff --git a/src/Yasumi/data/translations/dayAfterNewYearsDay.php b/src/Yasumi/data/translations/dayAfterNewYearsDay.php index 83dede297..d0b73f136 100644 --- a/src/Yasumi/data/translations/dayAfterNewYearsDay.php +++ b/src/Yasumi/data/translations/dayAfterNewYearsDay.php @@ -13,4 +13,4 @@ // Translation for Day after New Year's Day return [ 'en_US' => 'Day after New Year\'s Day', -]; \ No newline at end of file +]; diff --git a/src/Yasumi/data/translations/waitangiDay.php b/src/Yasumi/data/translations/waitangiDay.php index c7669f07a..d0ed31c43 100644 --- a/src/Yasumi/data/translations/waitangiDay.php +++ b/src/Yasumi/data/translations/waitangiDay.php @@ -13,4 +13,4 @@ // Translation for Waitangi Day return [ 'en_US' => 'Waitangi Day', -]; \ No newline at end of file +]; diff --git a/tests/NewZealand/AnzacDayTest.php b/tests/NewZealand/AnzacDayTest.php index 87b974ca6..a1ed32f28 100644 --- a/tests/NewZealand/AnzacDayTest.php +++ b/tests/NewZealand/AnzacDayTest.php @@ -10,7 +10,7 @@ * @author Sacha Telgenhof */ -namespace Yasumi\Tests\NewZealand; +namespace Yasumi\tests\NewZealand; use DateTime; use DateTimeZone; diff --git a/tests/NewZealand/BoxingDayTest.php b/tests/NewZealand/BoxingDayTest.php index f4c79fd3a..81d01365f 100644 --- a/tests/NewZealand/BoxingDayTest.php +++ b/tests/NewZealand/BoxingDayTest.php @@ -10,7 +10,7 @@ * @author Sacha Telgenhof */ -namespace Yasumi\Tests\NewZealand; +namespace Yasumi\tests\NewZealand; use DateTime; use DateTimeZone; diff --git a/tests/NewZealand/ChristmasDayTest.php b/tests/NewZealand/ChristmasDayTest.php index b5a6bf287..937dca39c 100644 --- a/tests/NewZealand/ChristmasDayTest.php +++ b/tests/NewZealand/ChristmasDayTest.php @@ -10,7 +10,7 @@ * @author Sacha Telgenhof */ -namespace Yasumi\Tests\NewZealand; +namespace Yasumi\tests\NewZealand; use DateTime; use DateTimeZone; diff --git a/tests/NewZealand/DayAfterNewYearsDayTest.php b/tests/NewZealand/DayAfterNewYearsDayTest.php index c7b9ffde4..9e6e8eeda 100644 --- a/tests/NewZealand/DayAfterNewYearsDayTest.php +++ b/tests/NewZealand/DayAfterNewYearsDayTest.php @@ -10,7 +10,7 @@ * @author Sacha Telgenhof */ -namespace Yasumi\Tests\NewZealand; +namespace Yasumi\tests\NewZealand; use DateTime; use DateTimeZone; diff --git a/tests/NewZealand/EasterMondayTest.php b/tests/NewZealand/EasterMondayTest.php index b6e314e39..083e30f6e 100644 --- a/tests/NewZealand/EasterMondayTest.php +++ b/tests/NewZealand/EasterMondayTest.php @@ -10,7 +10,7 @@ * @author Sacha Telgenhof */ -namespace Yasumi\Tests\NewZealand; +namespace Yasumi\tests\NewZealand; use DateTime; use DateTimeZone; diff --git a/tests/NewZealand/GoodFridayTest.php b/tests/NewZealand/GoodFridayTest.php index 02cf8c20f..28edf69c8 100644 --- a/tests/NewZealand/GoodFridayTest.php +++ b/tests/NewZealand/GoodFridayTest.php @@ -10,7 +10,7 @@ * @author Sacha Telgenhof */ -namespace Yasumi\Tests\NewZealand; +namespace Yasumi\tests\NewZealand; use DateTime; use DateTimeZone; diff --git a/tests/NewZealand/LabourDayTest.php b/tests/NewZealand/LabourDayTest.php index 06903301f..46cc3a1d7 100644 --- a/tests/NewZealand/LabourDayTest.php +++ b/tests/NewZealand/LabourDayTest.php @@ -10,7 +10,7 @@ * @author Sacha Telgenhof */ -namespace Yasumi\Tests\NewZealand; +namespace Yasumi\tests\NewZealand; use DateTime; use DateTimeZone; diff --git a/tests/NewZealand/NewYearsDayTest.php b/tests/NewZealand/NewYearsDayTest.php index 80576fc39..9c60b4c80 100644 --- a/tests/NewZealand/NewYearsDayTest.php +++ b/tests/NewZealand/NewYearsDayTest.php @@ -10,7 +10,7 @@ * @author Sacha Telgenhof */ -namespace Yasumi\Tests\NewZealand; +namespace Yasumi\tests\NewZealand; use DateTime; use DateTimeZone; diff --git a/tests/NewZealand/NewZealandBaseTestCase.php b/tests/NewZealand/NewZealandBaseTestCase.php index 74b5dc2a0..36a442b67 100644 --- a/tests/NewZealand/NewZealandBaseTestCase.php +++ b/tests/NewZealand/NewZealandBaseTestCase.php @@ -10,7 +10,7 @@ * @author Sacha Telgenhof */ -namespace Yasumi\Tests\NewZealand; +namespace Yasumi\tests\NewZealand; use PHPUnit_Framework_TestCase; use Yasumi\Tests\YasumiBase; diff --git a/tests/NewZealand/NewZealandTest.php b/tests/NewZealand/NewZealandTest.php index 61ece5aa4..3af01f08e 100644 --- a/tests/NewZealand/NewZealandTest.php +++ b/tests/NewZealand/NewZealandTest.php @@ -10,7 +10,7 @@ * @author Sacha Telgenhof */ -namespace Yasumi\Tests\NewZealand; +namespace Yasumi\tests\NewZealand; use Yasumi\Holiday; diff --git a/tests/NewZealand/QueensBirthdayTest.php b/tests/NewZealand/QueensBirthdayTest.php index dbda328e7..44873bb85 100644 --- a/tests/NewZealand/QueensBirthdayTest.php +++ b/tests/NewZealand/QueensBirthdayTest.php @@ -10,7 +10,7 @@ * @author Sacha Telgenhof */ -namespace Yasumi\Tests\NewZealand; +namespace Yasumi\tests\NewZealand; use DateTime; use DateTimeZone; diff --git a/tests/NewZealand/WaitangiDayTest.php b/tests/NewZealand/WaitangiDayTest.php index 712041d39..f957deb90 100644 --- a/tests/NewZealand/WaitangiDayTest.php +++ b/tests/NewZealand/WaitangiDayTest.php @@ -10,7 +10,7 @@ * @author Sacha Telgenhof */ -namespace Yasumi\Tests\NewZealand; +namespace Yasumi\tests\NewZealand; use DateTime; use DateTimeZone;