Skip to content

Commit

Permalink
Fronleichnam fix (azuyalabs#259)
Browse files Browse the repository at this point in the history
Corpus Christi (German: 'Fronleichnam') was classified as `Other` for states celebrating this day. This was incorrect
and has been changed to `Official`.
  • Loading branch information
stelgenhof authored Oct 5, 2021
1 parent 64ab366 commit f4a8f47
Show file tree
Hide file tree
Showing 19 changed files with 79 additions and 91 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ to [Semantic Versioning](https://semver.org).

### Fixed

- Corpus Christi (German: 'Fronleichnam') was classified as `Other` for states celebrating this day. This was incorrect
and has been changed to `Official`. [\#252](https://github.com/azuyalabs/yasumi/issues/252)
- The test for the USA in that juneteenthDay was considered for all years: it is only celebrated since 2021.
- Definition of Canada Day in Canada [\#257](https://github.com/azuyalabs/yasumi/pull/257) in that, Canada Day is July 1
if that day is not Sunday, and July 2 if July 1 is a Sunday.([Owen V. Gray](https://github.com/adrx))
Expand Down
6 changes: 3 additions & 3 deletions src/Yasumi/Provider/Germany/BadenWurttemberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
/**
* Provider for all holidays in Baden-Württemberg (Germany).
*
* Baden-Württemberg is a state in Germany located in the southwest, east of the Upper Rhine. It is Germany’s third
* largest state in terms of size and population, with an area of 36,410 square kilometres (14,060 sq mi) and 10.7
* Baden-Württemberg is a state in Germany located in the southwest, east of the Upper Rhine. It is Germany’s
* third-largest state in terms of size and population, with an area of 36,410 square kilometres (14,060 sq mi) and 10.7
* million inhabitants. The state capital and largest city is Stuttgart.
*
* @see https://en.wikipedia.org/wiki/Baden-W%C3%BCrttemberg
Expand All @@ -50,7 +50,7 @@ public function initialize(): void

// Add custom Christian holidays
$this->addHoliday($this->epiphany($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL));
$this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
}
}
8 changes: 3 additions & 5 deletions src/Yasumi/Provider/Germany/Bavaria.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
*
* Bavaria is a federal state of Germany. In the southeast of the country with an area of 70,548 square kilometres
* (27,200 sq mi), it is the largest state, making up almost a fifth of the total land area of Germany, and, with 12.6
* million inhabitants, Germany's second most populous state. Munich, Bavaria's capital and largest city, is the third
* largest city in Germany.
* million inhabitants, Germany's second most populous state. Munich, Bavaria's capital and largest city, is the
* third-largest city in Germany.
*
* @see https://en.wikipedia.org/wiki/Bavaria
*/
Expand All @@ -38,8 +38,6 @@ class Bavaria extends Germany
public const ID = 'DE-BY';

/**
* Initialize holidays for Bavaria (Germany).
*
* @throws InvalidDateException
* @throws \InvalidArgumentException
* @throws UnknownLocaleException
Expand All @@ -51,7 +49,7 @@ public function initialize(): void

// Add custom Christian holidays
$this->addHoliday($this->epiphany($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL));
$this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
}
}
3 changes: 2 additions & 1 deletion src/Yasumi/Provider/Germany/Hesse.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use Yasumi\Exception\InvalidDateException;
use Yasumi\Exception\UnknownLocaleException;
use Yasumi\Holiday;
use Yasumi\Provider\Germany;

/**
Expand Down Expand Up @@ -50,6 +51,6 @@ public function initialize(): void
parent::initialize();

// Add custom Christian holidays
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL));
}
}
4 changes: 2 additions & 2 deletions src/Yasumi/Provider/Germany/NorthRhineWestphalia.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Provider for all holidays in North Rhine-Westphalia (Germany).
*
* North Rhine-Westphalia (German: Nordrhein-Westfalen), commonly shortened NRW) is the most populous state of Germany,
* with a population of approximately 18 million, and the fourth largest by area. Its capital is Düsseldorf; the biggest
* with a population of approximately 18 million, and the fourth-largest by area. Its capital is Düsseldorf; the biggest
* city is Cologne. Four of Germany's ten biggest cities—Cologne, Düsseldorf, Dortmund, and Essen—are located within the
* state, as well as the biggest metropolitan area of the European continent, Rhine-Ruhr.
*
Expand All @@ -50,7 +50,7 @@ public function initialize(): void
parent::initialize();

// Add custom Christian holidays
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL));
$this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
}
}
2 changes: 1 addition & 1 deletion src/Yasumi/Provider/Germany/RhinelandPalatinate.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function initialize(): void
parent::initialize();

// Add custom Christian holidays
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL));
$this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
}
}
2 changes: 1 addition & 1 deletion src/Yasumi/Provider/Germany/Saarland.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function initialize(): void
parent::initialize();

// Add custom Christian holidays
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL));
$this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
$this->addHoliday($this->assumptionOfMary($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Germany/BadenWurttemberg/BadenWurttembergTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function testOfficialHolidays(): void
'internationalWorkersDay',
'ascensionDay',
'pentecostMonday',
'corpusChristi',
'germanUnityDay',
'christmasDay',
'secondChristmasDay',
Expand Down Expand Up @@ -94,7 +95,7 @@ public function testBankHolidays(): void
public function testOtherHolidays(): void
{
$this->assertDefinedHolidays(
['epiphany', 'corpusChristi', 'allSaintsDay'],
['epiphany', 'allSaintsDay'],
self::REGION,
$this->year,
Holiday::TYPE_OTHER
Expand Down
21 changes: 9 additions & 12 deletions tests/Germany/BadenWurttemberg/CorpusChristiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,41 @@

namespace Yasumi\tests\Germany\BadenWurttemberg;

use DateInterval;
use Exception;
use ReflectionException;
use Yasumi\Holiday;
use Yasumi\Provider\ChristianHolidays;
use Yasumi\tests\HolidayTestCase;

/**
* Class for testing Corpus Christi in Baden-Württemberg (Germany).
* Class for testing Corpus Christi ('Fronleichnam') in Baden-Württemberg (Germany).
*/
class CorpusChristiTest extends BadenWurttembergBaseTestCase implements HolidayTestCase
{
use ChristianHolidays;

/**
* The name of the holiday.
* The name of the holiday to be tested.
*/
public const HOLIDAY = 'corpusChristi';

/**
* Tests Corpus Christi.
* Tests the holiday defined in this test.
*
* @throws Exception
* @throws ReflectionException
*/
public function testCorpusChristi(): void
public function testHoliday(): void
{
$year = 2016;
$year = $this->generateRandomYear();

$this->assertHoliday(
self::REGION,
self::HOLIDAY,
$year,
$this->calculateEaster($year, self::TIMEZONE)->add(new DateInterval('P60D'))
$this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D'))
);
}

/**
* Tests translated name of the holiday defined in this test.
* Tests the translated name of the holiday defined in this test.
*
* @throws ReflectionException
*/
Expand All @@ -72,6 +69,6 @@ public function testTranslation(): void
*/
public function testHolidayType(): void
{
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER);
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL);
}
}
3 changes: 2 additions & 1 deletion tests/Germany/Bavaria/BavariaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function testOfficialHolidays(): void
'easterMonday',
'internationalWorkersDay',
'ascensionDay',
'corpusChristi',
'pentecostMonday',
'germanUnityDay',
'christmasDay',
Expand Down Expand Up @@ -94,7 +95,7 @@ public function testBankHolidays(): void
public function testOtherHolidays(): void
{
$this->assertDefinedHolidays(
['epiphany', 'corpusChristi', 'allSaintsDay'],
['epiphany', 'allSaintsDay'],
self::REGION,
$this->year,
Holiday::TYPE_OTHER
Expand Down
21 changes: 9 additions & 12 deletions tests/Germany/Bavaria/CorpusChristiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,41 @@

namespace Yasumi\tests\Germany\Bavaria;

use DateInterval;
use Exception;
use ReflectionException;
use Yasumi\Holiday;
use Yasumi\Provider\ChristianHolidays;
use Yasumi\tests\HolidayTestCase;

/**
* Class for testing Corpus Christi in Bavaria (Germany).
* Class for testing Corpus Christi ('Fronleichnam') in Bavaria (Germany).
*/
class CorpusChristiTest extends BavariaBaseTestCase implements HolidayTestCase
{
use ChristianHolidays;

/**
* The name of the holiday.
* The name of the holiday to be tested.
*/
public const HOLIDAY = 'corpusChristi';

/**
* Tests Corpus Christi.
* Tests the holiday defined in this test.
*
* @throws Exception
* @throws ReflectionException
*/
public function testCorpusChristi(): void
public function testHoliday(): void
{
$year = 2016;
$year = $this->generateRandomYear();

$this->assertHoliday(
self::REGION,
self::HOLIDAY,
$year,
$this->calculateEaster($year, self::TIMEZONE)->add(new DateInterval('P60D'))
$this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D'))
);
}

/**
* Tests translated name of the holiday defined in this test.
* Tests the translated name of the holiday defined in this test.
*
* @throws ReflectionException
*/
Expand All @@ -72,6 +69,6 @@ public function testTranslation(): void
*/
public function testHolidayType(): void
{
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER);
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL);
}
}
21 changes: 9 additions & 12 deletions tests/Germany/Hesse/CorpusChristiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,41 @@

namespace Yasumi\tests\Germany\Hesse;

use DateInterval;
use Exception;
use ReflectionException;
use Yasumi\Holiday;
use Yasumi\Provider\ChristianHolidays;
use Yasumi\tests\HolidayTestCase;

/**
* Class for testing Corpus Christi in Hesse (Germany).
* Class for testing Corpus Christi ('Fronleichnam') in Hesse (Germany).
*/
class CorpusChristiTest extends HesseBaseTestCase implements HolidayTestCase
{
use ChristianHolidays;

/**
* The name of the holiday.
* The name of the holiday to be tested.
*/
public const HOLIDAY = 'corpusChristi';

/**
* Tests Corpus Christi.
* Tests the holiday defined in this test.
*
* @throws Exception
* @throws ReflectionException
*/
public function testCorpusChristi(): void
public function testHoliday(): void
{
$year = 2016;
$year = $this->generateRandomYear();

$this->assertHoliday(
self::REGION,
self::HOLIDAY,
$year,
$this->calculateEaster($year, self::TIMEZONE)->add(new DateInterval('P60D'))
$this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D'))
);
}

/**
* Tests translated name of the holiday defined in this test.
* Tests the translated name of the holiday defined in this test.
*
* @throws ReflectionException
*/
Expand All @@ -72,6 +69,6 @@ public function testTranslation(): void
*/
public function testHolidayType(): void
{
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER);
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL);
}
}
3 changes: 2 additions & 1 deletion tests/Germany/Hesse/HesseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function testOfficialHolidays(): void
'easterMonday',
'internationalWorkersDay',
'ascensionDay',
'corpusChristi',
'pentecostMonday',
'germanUnityDay',
'christmasDay',
Expand Down Expand Up @@ -93,7 +94,7 @@ public function testBankHolidays(): void
*/
public function testOtherHolidays(): void
{
$this->assertDefinedHolidays(['corpusChristi'], self::REGION, $this->year, Holiday::TYPE_OTHER);
$this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER);
}

/**
Expand Down
Loading

0 comments on commit f4a8f47

Please sign in to comment.