Skip to content

Commit

Permalink
Remove Summertime and Wintertime.
Browse files Browse the repository at this point in the history
For rationale see: #321

Signed-off-by: Sacha Telgenhof <[email protected]>
  • Loading branch information
stelgenhof committed Oct 11, 2023
1 parent 5a94ca9 commit 126cf71
Show file tree
Hide file tree
Showing 11 changed files with 8 additions and 629 deletions.
10 changes: 0 additions & 10 deletions src/Yasumi/Provider/Denmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ public function initialize(): void
$this->addHoliday($this->christmasEve($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->newYearsEve($this->year, $this->timezone, $this->locale, Holiday::TYPE_OBSERVANCE));
$this->calculateConstitutionDay();

$summerTime = $this->summerTime($this->year, $this->timezone, $this->locale);
if ($summerTime instanceof Holiday) {
$this->addHoliday($summerTime);
}

$winterTime = $this->winterTime($this->year, $this->timezone, $this->locale);
if ($winterTime instanceof Holiday) {
$this->addHoliday($winterTime);
}
}

public function getSources(): array
Expand Down
36 changes: 0 additions & 36 deletions src/Yasumi/Provider/Netherlands.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ public function initialize(): void

// Calculate other holidays
$this->calculateCarnival();
$this->calculateWinterTime();
$this->calculateSummerTime();
$this->calculateStNicholasDay();
$this->calculateHalloween();
$this->calculatePrincesDay();
Expand Down Expand Up @@ -129,40 +127,6 @@ private function calculateCarnival(): void
}
}

/**
* Winter Time.
*
* The beginning of winter time. Winter time is also known as standard time.
*
* @throws \Exception
*
* @see \Yasumi\Provider\CommonHolidays::winterTime()
*/
private function calculateWinterTime(): void
{
$winterTime = $this->winterTime($this->year, $this->timezone, $this->locale);
if ($winterTime instanceof Holiday) {
$this->addHoliday($winterTime);
}
}

/**
* Summer Time.
*
* The beginning of summer time. Summer time is also known as day lights saving time.
*
* @throws \Exception
*
* @see \Yasumi\Provider\CommonHolidays::summerTime()
*/
private function calculateSummerTime(): void
{
$summerTime = $this->summerTime($this->year, $this->timezone, $this->locale);
if ($summerTime instanceof Holiday) {
$this->addHoliday($summerTime);
}
}

/**
* St. Nicholas' Day.
*
Expand Down
18 changes: 6 additions & 12 deletions tests/Base/HolidayBetweenFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function testHolidaysBetweenDateRange(): void

self::assertArrayHasKey('goodFriday', $betweenHolidays);
self::assertArrayHasKey('easter', $betweenHolidays);
self::assertArrayHasKey('summerTime', $betweenHolidays);
self::assertArrayHasKey('easterMonday', $betweenHolidays);
self::assertArrayHasKey('kingsDay', $betweenHolidays);
self::assertArrayHasKey('internationalWorkersDay', $betweenHolidays);
Expand All @@ -58,17 +57,16 @@ public function testHolidaysBetweenDateRange(): void
self::assertArrayNotHasKey('valentinesDay', $betweenHolidays);
self::assertArrayNotHasKey('princesDay', $betweenHolidays);
self::assertArrayNotHasKey('worldAnimalDay', $betweenHolidays);
self::assertArrayNotHasKey('winterTime', $betweenHolidays);
self::assertArrayNotHasKey('halloween', $betweenHolidays);
self::assertArrayNotHasKey('stMartinsDay', $betweenHolidays);
self::assertArrayNotHasKey('stNicholasDay', $betweenHolidays);
self::assertArrayNotHasKey('christmasDay', $betweenHolidays);
self::assertArrayNotHasKey('secondChristmasDay', $betweenHolidays);

self::assertCount(13, $between);
self::assertCount(12, $between);
self::assertNotCount(\count($holidays), $between);

self::assertEquals(13, $between->count());
self::assertEquals(12, $between->count());
self::assertNotEquals(\count($holidays), $between->count());
}

Expand All @@ -87,7 +85,6 @@ public function testHolidaysBetweenDateRangeWithDateTimeImmutable(): void

self::assertArrayHasKey('goodFriday', $betweenHolidays);
self::assertArrayHasKey('easter', $betweenHolidays);
self::assertArrayHasKey('summerTime', $betweenHolidays);
self::assertArrayHasKey('easterMonday', $betweenHolidays);
self::assertArrayHasKey('kingsDay', $betweenHolidays);
self::assertArrayHasKey('internationalWorkersDay', $betweenHolidays);
Expand All @@ -108,17 +105,16 @@ public function testHolidaysBetweenDateRangeWithDateTimeImmutable(): void
self::assertArrayNotHasKey('valentinesDay', $betweenHolidays);
self::assertArrayNotHasKey('princesDay', $betweenHolidays);
self::assertArrayNotHasKey('worldAnimalDay', $betweenHolidays);
self::assertArrayNotHasKey('winterTime', $betweenHolidays);
self::assertArrayNotHasKey('halloween', $betweenHolidays);
self::assertArrayNotHasKey('stMartinsDay', $betweenHolidays);
self::assertArrayNotHasKey('stNicholasDay', $betweenHolidays);
self::assertArrayNotHasKey('christmasDay', $betweenHolidays);
self::assertArrayNotHasKey('secondChristmasDay', $betweenHolidays);

self::assertCount(13, $between);
self::assertCount(12, $between);
self::assertNotCount(\count($holidays), $between);

self::assertEquals(13, $between->count());
self::assertEquals(12, $between->count());
self::assertNotEquals(\count($holidays), $between->count());
}

Expand Down Expand Up @@ -166,7 +162,6 @@ public function testHolidaysBetweenDateRangeExclusiveStartEndDate(): void
self::assertArrayHasKey('valentinesDay', $betweenHolidays);
self::assertArrayHasKey('goodFriday', $betweenHolidays);
self::assertArrayHasKey('easter', $betweenHolidays);
self::assertArrayHasKey('summerTime', $betweenHolidays);
self::assertArrayHasKey('easterMonday', $betweenHolidays);
self::assertArrayHasKey('kingsDay', $betweenHolidays);
self::assertArrayHasKey('internationalWorkersDay', $betweenHolidays);
Expand All @@ -181,17 +176,16 @@ public function testHolidaysBetweenDateRangeExclusiveStartEndDate(): void
self::assertArrayNotHasKey('newYearsDay', $betweenHolidays);
self::assertArrayNotHasKey('princesDay', $betweenHolidays);
self::assertArrayNotHasKey('worldAnimalDay', $betweenHolidays);
self::assertArrayNotHasKey('winterTime', $betweenHolidays);
self::assertArrayNotHasKey('halloween', $betweenHolidays);
self::assertArrayNotHasKey('stMartinsDay', $betweenHolidays);
self::assertArrayNotHasKey('stNicholasDay', $betweenHolidays);
self::assertArrayNotHasKey('christmasDay', $betweenHolidays);
self::assertArrayNotHasKey('secondChristmasDay', $betweenHolidays);

self::assertCount(19, $between);
self::assertCount(18, $between);
self::assertNotCount(\count($holidays), $between);

self::assertEquals(19, $between->count());
self::assertEquals(18, $between->count());
self::assertNotEquals(\count($holidays), $between->count());
}

Expand Down
8 changes: 2 additions & 6 deletions tests/Base/HolidayFiltersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ public function testSeasonalHolidaysFilter(): void
$filteredHolidaysArray = iterator_to_array($filteredHolidays);

// Assert array definitions
self::assertArrayHasKey('summerTime', $filteredHolidaysArray);
self::assertArrayHasKey('winterTime', $filteredHolidaysArray);
self::assertArrayNotHasKey('newYearsDay', $filteredHolidaysArray);
self::assertArrayNotHasKey('easter', $filteredHolidaysArray);
self::assertArrayNotHasKey('easterMonday', $filteredHolidaysArray);
Expand Down Expand Up @@ -155,9 +153,9 @@ public function testSeasonalHolidaysFilter(): void
self::assertArrayNotHasKey('princesDay', $filteredHolidaysArray);

// Assert number of results returned
self::assertCount(2, $filteredHolidays);
self::assertCount(0, $filteredHolidays);
self::assertNotCount(\count($holidays), $filteredHolidays);
self::assertEquals(2, $filteredHolidays->count());
self::assertEquals(0, $filteredHolidays->count());
self::assertNotEquals(\count($holidays), $filteredHolidays->count());
}

Expand All @@ -176,8 +174,6 @@ public function testOtherHolidaysFilter(): void
self::assertArrayHasKey('mothersDay', $filteredHolidaysArray);
self::assertArrayHasKey('epiphany', $filteredHolidaysArray);
self::assertArrayHasKey('princesDay', $filteredHolidaysArray);
self::assertArrayNotHasKey('summerTime', $filteredHolidaysArray);
self::assertArrayNotHasKey('winterTime', $filteredHolidaysArray);
self::assertArrayNotHasKey('newYearsDay', $filteredHolidaysArray);
self::assertArrayNotHasKey('easter', $filteredHolidaysArray);
self::assertArrayNotHasKey('easterMonday', $filteredHolidaysArray);
Expand Down
6 changes: 0 additions & 6 deletions tests/Base/HolidayOnFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public function testHolidaysOnDate(): void
$holidayDates = [
'goodFriday' => new \DateTime('03/25/2016', new \DateTimeZone($timezone)),
'easter' => new \DateTime('03/27/2016', new \DateTimeZone($timezone)),
'summerTime' => new \DateTime('03/27/2016', new \DateTimeZone($timezone)),
];

foreach ($holidayDates as $name => $date) {
Expand All @@ -52,7 +51,6 @@ public function testHolidaysNotOnDate(): void
$holidayWrongDates = [
'goodFriday' => new \DateTime('04/25/2016', new \DateTimeZone($timezone)),
'easter' => new \DateTime('03/22/2016', new \DateTimeZone($timezone)),
'summerTime' => new \DateTime('12/27/2016', new \DateTimeZone($timezone)),
];

foreach ($holidayWrongDates as $name => $date) {
Expand All @@ -77,9 +75,5 @@ public function testCorrectNumberOfHolidaysOnDate(): void
// One holiday
$holidaysOnDate = $holidays->on(new \DateTime('12/25/2016', new \DateTimeZone($timezone)));
self::assertEquals(1, $holidaysOnDate->count());

// Multiple holidays
$holidaysOnDate = $holidays->on(new \DateTime('03/27/2016', new \DateTimeZone($timezone)));
self::assertGreaterThan(1, $holidaysOnDate->count());
}
}
11 changes: 0 additions & 11 deletions tests/Denmark/DenmarkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,6 @@ public function testObservedHolidays(): void
], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE);
}

/**
* Tests if all seasonal holidays in Denmark are defined by the provider class.
*
* @throws \Exception
*/
public function testSeasonalHolidays(): void
{
$year = $this->generateRandomYear(1980, 2037);
$this->assertDefinedHolidays(['summerTime', 'winterTime'], self::REGION, $year, Holiday::TYPE_SEASON);
}

/**
* Tests if all bank holidays in Denmark are defined by the provider class.
*/
Expand Down
127 changes: 0 additions & 127 deletions tests/Denmark/SummerTimeTest.php

This file was deleted.

Loading

0 comments on commit 126cf71

Please sign in to comment.