diff --git a/.php_cs b/.php_cs index a11f6aa6d..8a3e9dce8 100644 --- a/.php_cs +++ b/.php_cs @@ -2,14 +2,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ $finder = PhpCsFixer\Finder::create()->in(__DIR__); -return PhpCsFixer\Config::create()->setRules(['@PSR2' => true])->setFinder($finder); \ No newline at end of file +return PhpCsFixer\Config::create()->setRiskyAllowed(true)->setRules([ + '@PSR2' => true, + 'native_function_invocation' => true + ])->setFinder($finder); \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index d8926198e..c206d55c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,28 @@ language: php php: - - 5.6 - - 7.0 - 7.1 - - hhvm + - 7.2 + - 7.3 - nightly +dist: trusty +sudo: required + cache: directories: - $HOME/.composer/cache +before_install: + - if [[ $HHVM == true ]]; then sudo apt-get update; fi + - if [[ $HHVM == true ]]; then sudo apt-get install hhvm=3.\*; fi + before_script: - composer self-update - composer install --no-interaction script: - - if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan:^0.9 && vendor/bin/phpstan analyse -l 7 src; fi + - if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan:^0.10 && vendor/bin/phpstan analyse -l 5 src; fi - ./vendor/bin/phpunit - phpenv config-rm xdebug.ini || return 0 - ./vendor/bin/php-cs-fixer --diff --dry-run -v fix @@ -29,3 +35,9 @@ matrix: include: - php: 7.1 env: PHPSTAN=1 + - php: 7.2 + env: PHPSTAN=1 + - php: 7.3 + env: PHPSTAN=1 + - php: hhvm + env: HHVM=true diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ed5460dc..48b948f1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,44 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Removed + +## [2.0.0] - 2019-01-11 + +### Added +- New filter to select holidays that happen on a given date [\#119](https://github.com/azuyalabs/yasumi/pull/119) ([cruxicheiros](https://github.com/cruxicheiros)) +- Holiday Providers for all Australian states and territories. [\#112](https://github.com/azuyalabs/yasumi/pull/112) ([Milamber33](https://github.com/Milamber33)) +- Holiday Provider for Bosnia. [\#94](https://github.com/azuyalabs/yasumi/pull/94) ([TheAdnan](https://github.com/TheAdnan)) +- Added Reformation Day as offical holiday since 2018 in Lower Saxony (Germany). [#115](https://github.com/azuyalabs/yasumi/issues/115) ([Taxcamp](https://github.com/Taxcamp)) +- Added Reformation Day as offical holiday since 2018 in Schleswig-Holstein (Germany). [#106](https://github.com/azuyalabs/yasumi/pull/106) ([HenningCash](https://github.com/HenningCash)) +- Added Reformation Day as offical holiday since 2018 in Hamburg (Germany). [#108](https://github.com/azuyalabs/yasumi/pull/108) ([HenningCash](https://github.com/HenningCash)) +- Added Reformation Day as offical holiday since 2018 in Bremen (Germany). [#116](https://github.com/azuyalabs/yasumi/issues/116) ([TalonTR](https://github.com/TalonTR)) +- The (observed) holidays Lukkeloven, Constitution Day, New Year's Eve and Labour Day, as well as summertime and wintertime are included for Denmark [\#104](https://github.com/azuyalabs/yasumi/pull/104) ([c960657](https://github.com/c960657)) + +### Changed +- Upgraded entirely to PHP version 7 with PHP 7.1 being the minimum required version. Base code and all unit tests have been reworked to compatibility with PHP 7. +- Upgraded to PHPUnit to version 7.5. +- Changed Japanese holiday for the 2020 Olympic Games. Marine Day, Mountain Day and Health And Sports Day. [\#113](https://github.com/azuyalabs/yasumi/pull/113) ([cookie-maker](https://github.com/cookie-maker)) +- Summer/winter time is now fetched from PHP's tz database. [\#103](https://github.com/azuyalabs/yasumi/pull/103) ([c960657](https://github.com/c960657)) +- Changed translation for Norway's national day. [\#98](https://github.com/azuyalabs/yasumi/pull/98) ([c960657](https://github.com/c960657)) +- Applied proper null checks in the summertime and wintertime calculations for Denmark and The Netherlands. +- Corrected some namespaces for Australia and Germany. +- Updated copyright year. +- Upgraded various dependency packages. +- Internal locale list updated based on CLDR v34. +- Refactored the Japan and USA Holiday Provider by moving the holiday calculations to private methods. This reduced the complexity of the initialize method. + +### Fixed +- Translation for Russia showed in English (except New Year's Day) as the proper locale was not in place. +- Fixed issue for summertime in Denmark in 1980. By default summertime in Denmark is set for the last day of March since 1980, however in 1980 itself, it started on April, 6th. +- Fixed spelling issue in the Swedish translation. [\#97](https://github.com/azuyalabs/yasumi/pull/97) ([c960657](https://github.com/c960657)) +- Fixed spelling issues in the Danish translation. [\#96](https://github.com/azuyalabs/yasumi/pull/96) ([c960657](https://github.com/c960657)) +- Fixed German Easter Sunday and Pentecost Sunday holidays (not nationwide, only in Brandenburg). [\#100](https://github.com/azuyalabs/yasumi/pull/100) ([TalonTR](https://github.com/TalonTR)) +- Fixed BetweenFilter to ignore time part and timezone. [\#101](https://github.com/azuyalabs/yasumi/pull/101) ([c960657](https://github.com/c960657)) +- Fixed bug in provider list generation related to variable order of files returned by the filesystem [\#107](https://github.com/azuyalabs/yasumi/pull/107) ([leafnode](https://github.com/leafnode)) + +### Removed + + ## [1.8.0] - 2018-02-21 ### Added diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 6a5aad5bf..4bc9e7d97 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at stelgenhof@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at me@sachatelgenhof.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c88e43bee..c8df34d53 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ When contributing there are a few guidelines we'd like you to keep in mind: Please use the following command after you have completed your work: ``` bash - $ composer php-cs-fixer + $ composer format ``` This will check/correct all the code for the PSR-2 Coding Standard using the wonderful [php-cs-fixer](http://cs.sensiolabs.org/) . diff --git a/LICENSE b/LICENSE index 57c9b9a99..9ffbc6f6b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 - 2018 AzuyaLabs +Copyright (c) 2015 - 2019 AzuyaLabs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 661537ae7..0e34142c5 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,16 @@ [![StyleCI](https://styleci.io/repos/32797151/shield?branch=master)](https://styleci.io/repos/32797151) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/azuyalabs/yasumi/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/azuyalabs/yasumi/?branch=master) +Important! +----------- +Yasumi version 2.0 has been released with support for PHP 7 only. As of January 2019 support for PHP 5 has ended. -***!!Update!!*** -A new [blog](https://azuyalabs.github.io/yasumi/blog/) section has been added to the documentation site. Keeping you informed about any news, releases, etc. in a handy blog post format! +For the previous code base (1.8.0) a separate support branch has been created that will only receive the most critical bug fixes (for those still using PHP 5). Please note that although v1.8.x works both in PHP 5 and PHP 7, the code base hasn't been upgraded to PHP 7. +It is highly recommended to upgrade to PHP7 and Yasumi v2.0.0 to enjoy the latest changes and improvements. More information can be found on the blog here: [Yasumi Release v2](https://azuyalabs.github.io/yasumi/blog/release_v2) + +Introduction +------------ Yasumi (Japanese for 'Holiday'「休み」) is an easy PHP library to help you calculate the dates and names of holidays and other special celebrations from various countries/states. Many services exist on the internet that provide holidays, however are either not free or offer only limited information. In addition, no complete PHP library seems to exist today @@ -25,6 +31,9 @@ Documentation Yasumi’s documentation is available on [https://azuyalabs.github.io/yasumi/](https://azuyalabs.github.io/yasumi/). You will find all the necessary information how to install Yasumi and also recipes how you can use Yasumi in your project. +Blog +---- +Checkout the [blog](https://azuyalabs.github.io/yasumi/blog/) section on documentation site regularly for latest updates. Keeping you informed about any news, releases, etc. in a handy blog post format! License ------- diff --git a/composer.json b/composer.json index 821f2278b..29538c08c 100755 --- a/composer.json +++ b/composer.json @@ -16,17 +16,17 @@ "authors": [ { "name": "Sacha Telgenhof", - "email": "me@sachatelgenhof.nl" + "email": "me@sachatelgenhof.com" } ], "require": { - "php": ">=5.6.0" + "php": ">=7.1" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.6", - "fzaninotto/faker": "~1.7", + "friendsofphp/php-cs-fixer": "^2.14", + "fzaninotto/faker": "~1.8", "mikey179/vfsStream": "~1.6", - "phpunit/phpunit": "~5.7" + "phpunit/phpunit": "~7.5" }, "autoload": { "psr-4": { @@ -39,7 +39,7 @@ } }, "scripts": { - "php-cs-fixer": "./vendor/bin/php-cs-fixer fix .", + "format": "./vendor/bin/php-cs-fixer fix .", "test": "vendor/bin/phpunit" }, "config": { diff --git a/phpunit.xml b/phpunit.xml index e6d1f6a19..158eff6e8 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -2,16 +2,17 @@ @@ -48,6 +48,11 @@ ./tests/Belgium + + + ./tests/Bosnia + + ./tests/Brazil diff --git a/src/Yasumi/Exception/Exception.php b/src/Yasumi/Exception/Exception.php index 3a63137eb..2405ddde7 100644 --- a/src/Yasumi/Exception/Exception.php +++ b/src/Yasumi/Exception/Exception.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Exception; diff --git a/src/Yasumi/Exception/InvalidDateException.php b/src/Yasumi/Exception/InvalidDateException.php index dac74b781..202497327 100644 --- a/src/Yasumi/Exception/InvalidDateException.php +++ b/src/Yasumi/Exception/InvalidDateException.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Exception; @@ -27,7 +27,7 @@ class InvalidDateException extends InvalidArgumentException implements Exception */ public function __construct($argumentValue) { - $type = gettype($argumentValue); + $type = \gettype($argumentValue); switch ($type) { case 'boolean': $displayName = $argumentValue ? 'true' : 'false'; @@ -40,13 +40,13 @@ public function __construct($argumentValue) $displayName = $argumentValue; break; case 'object': - $displayName = get_class($argumentValue); + $displayName = \get_class($argumentValue); break; default: $displayName = $type; break; } - parent::__construct(sprintf(sprintf('\'%s\' is not a valid DateTime(Immutable) instance', $displayName))); + parent::__construct(\sprintf(\sprintf('\'%s\' is not a valid DateTime(Immutable) instance', $displayName))); } } diff --git a/src/Yasumi/Exception/UnknownLocaleException.php b/src/Yasumi/Exception/UnknownLocaleException.php index b8e55e450..5e64dcc07 100644 --- a/src/Yasumi/Exception/UnknownLocaleException.php +++ b/src/Yasumi/Exception/UnknownLocaleException.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Exception; diff --git a/src/Yasumi/Filters/BankHolidaysFilter.php b/src/Yasumi/Filters/BankHolidaysFilter.php index 25ead8535..edd1bc2f9 100644 --- a/src/Yasumi/Filters/BankHolidaysFilter.php +++ b/src/Yasumi/Filters/BankHolidaysFilter.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Filters; @@ -33,7 +33,7 @@ class BankHolidaysFilter extends FilterIterator implements Countable * * @return bool */ - public function accept() + public function accept(): bool { return $this->getInnerIterator()->current()->getType() === Holiday::TYPE_BANK; } @@ -41,14 +41,14 @@ public function accept() /** * @return integer Returns the number of filtered holidays. */ - public function count() + public function count(): int { - $days = array_keys(iterator_to_array($this)); + $days = \array_keys(\iterator_to_array($this)); - array_walk($days, function (&$day) { - $day = str_replace('substituteHoliday:', '', $day); + \array_walk($days, function (&$day) { + $day = \str_replace('substituteHoliday:', '', $day); }); - return count(array_unique($days)); + return \count(\array_unique($days)); } } diff --git a/src/Yasumi/Filters/BetweenFilter.php b/src/Yasumi/Filters/BetweenFilter.php index 0b31c801d..8153c24a9 100644 --- a/src/Yasumi/Filters/BetweenFilter.php +++ b/src/Yasumi/Filters/BetweenFilter.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Filters; @@ -30,12 +30,12 @@ class BetweenFilter extends FilterIterator implements Countable { /** - * @var \DateTimeInterface start date of the time frame to check against + * @var string start date of the time frame to check against */ private $start_date; /** - * @var \DateTimeInterface end date of the time frame to check against + * @var string end date of the time frame to check against */ private $end_date; @@ -61,16 +61,16 @@ public function __construct( ) { parent::__construct($iterator); $this->equal = $equal; - $this->start_date = $start_date; - $this->end_date = $end_date; + $this->start_date = $start_date->format('Y-m-d'); + $this->end_date = $end_date->format('Y-m-d'); } /** * @return bool Check whether the current element of the iterator is acceptable */ - public function accept() + public function accept(): bool { - $holiday = $this->getInnerIterator()->current(); + $holiday = $this->getInnerIterator()->current()->format('Y-m-d'); if ($this->equal && $holiday >= $this->start_date && $holiday <= $this->end_date) { return true; @@ -82,14 +82,14 @@ public function accept() /** * @return integer Returns the number of holidays between the given start and end date. */ - public function count() + public function count(): int { - $days = array_keys(iterator_to_array($this)); + $days = \array_keys(\iterator_to_array($this)); - array_walk($days, function (&$day) { - $day = str_replace('substituteHoliday:', '', $day); + \array_walk($days, function (&$day) { + $day = \str_replace('substituteHoliday:', '', $day); }); - return count(array_unique($days)); + return \count(\array_unique($days)); } } diff --git a/src/Yasumi/Filters/ObservedHolidaysFilter.php b/src/Yasumi/Filters/ObservedHolidaysFilter.php index 66a59f5fa..58550e700 100644 --- a/src/Yasumi/Filters/ObservedHolidaysFilter.php +++ b/src/Yasumi/Filters/ObservedHolidaysFilter.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Filters; @@ -33,7 +33,7 @@ class ObservedHolidaysFilter extends FilterIterator implements Countable * * @return bool */ - public function accept() + public function accept(): bool { return $this->getInnerIterator()->current()->getType() === Holiday::TYPE_OBSERVANCE; } @@ -41,14 +41,14 @@ public function accept() /** * @return integer Returns the number of filtered holidays. */ - public function count() + public function count(): int { - $days = array_keys(iterator_to_array($this)); + $days = \array_keys(\iterator_to_array($this)); - array_walk($days, function (&$day) { - $day = str_replace('substituteHoliday:', '', $day); + \array_walk($days, function (&$day) { + $day = \str_replace('substituteHoliday:', '', $day); }); - return count(array_unique($days)); + return \count(\array_unique($days)); } } diff --git a/src/Yasumi/Filters/OfficialHolidaysFilter.php b/src/Yasumi/Filters/OfficialHolidaysFilter.php index d5c29b231..94e315702 100644 --- a/src/Yasumi/Filters/OfficialHolidaysFilter.php +++ b/src/Yasumi/Filters/OfficialHolidaysFilter.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Filters; @@ -33,7 +33,7 @@ class OfficialHolidaysFilter extends FilterIterator implements Countable * * @return bool */ - public function accept() + public function accept(): bool { return $this->getInnerIterator()->current()->getType() === Holiday::TYPE_OFFICIAL; } @@ -41,14 +41,14 @@ public function accept() /** * @return integer Returns the number of filtered holidays. */ - public function count() + public function count(): int { - $days = array_keys(iterator_to_array($this)); + $days = \array_keys(\iterator_to_array($this)); - array_walk($days, function (&$day) { - $day = str_replace('substituteHoliday:', '', $day); + \array_walk($days, function (&$day) { + $day = \str_replace('substituteHoliday:', '', $day); }); - return count(array_unique($days)); + return \count(\array_unique($days)); } } diff --git a/src/Yasumi/Filters/OnFilter.php b/src/Yasumi/Filters/OnFilter.php new file mode 100644 index 000000000..41fc4053f --- /dev/null +++ b/src/Yasumi/Filters/OnFilter.php @@ -0,0 +1,74 @@ + + */ + +namespace Yasumi\Filters; + +use Countable; +use FilterIterator; +use Iterator; + +/** + * OnFilter is a class used for filtering holidays based on a given date. + * + * Filters for all holidays that happen on the given date. + * + * Note: this class can be used separately, however is implemented by the AbstractProvider::on method. + * + * @package Yasumi\Filters + */ +class OnFilter extends FilterIterator implements Countable +{ + /** + * @var string date to check for holidays + */ + private $date; + + + /** + * Construct the On FilterIterator Object + * + * @param \Iterator $iterator Iterator object of the Holidays Provider + * @param \DateTimeInterface $date Start date of the time frame to check against + */ + + public function __construct( + Iterator $iterator, + \DateTimeInterface $date + ) { + parent::__construct($iterator); + $this->date = $date->format('Y-m-d'); + } + + /** + * @return bool Check whether the current element of the iterator is acceptable + */ + public function accept(): bool + { + $holiday = $this->getInnerIterator()->current()->format('Y-m-d'); + return $holiday === $this->date; + } + + /** + * @return integer Returns the number of holidays that happen on the specified date + */ + public function count(): int + { + $days = \array_keys(\iterator_to_array($this)); + + \array_walk($days, function (&$day) { + $day = \str_replace('substituteHoliday:', '', $day); + }); + + return \count(\array_unique($days)); + } +} diff --git a/src/Yasumi/Filters/OtherHolidaysFilter.php b/src/Yasumi/Filters/OtherHolidaysFilter.php index 6a2d7efa2..1349a23c7 100644 --- a/src/Yasumi/Filters/OtherHolidaysFilter.php +++ b/src/Yasumi/Filters/OtherHolidaysFilter.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Filters; @@ -33,7 +33,7 @@ class OtherHolidaysFilter extends FilterIterator implements Countable * * @return bool */ - public function accept() + public function accept(): bool { return $this->getInnerIterator()->current()->getType() === Holiday::TYPE_OTHER; } @@ -41,14 +41,14 @@ public function accept() /** * @return integer Returns the number of filtered holidays. */ - public function count() + public function count(): int { - $days = array_keys(iterator_to_array($this)); + $days = \array_keys(\iterator_to_array($this)); - array_walk($days, function (&$day) { - $day = str_replace('substituteHoliday:', '', $day); + \array_walk($days, function (&$day) { + $day = \str_replace('substituteHoliday:', '', $day); }); - return count(array_unique($days)); + return \count(\array_unique($days)); } } diff --git a/src/Yasumi/Filters/SeasonalHolidaysFilter.php b/src/Yasumi/Filters/SeasonalHolidaysFilter.php index d92b3e6f6..5eebaa59e 100644 --- a/src/Yasumi/Filters/SeasonalHolidaysFilter.php +++ b/src/Yasumi/Filters/SeasonalHolidaysFilter.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Filters; @@ -33,7 +33,7 @@ class SeasonalHolidaysFilter extends FilterIterator implements Countable * * @return bool */ - public function accept() + public function accept(): bool { return $this->getInnerIterator()->current()->getType() === Holiday::TYPE_SEASON; } @@ -41,14 +41,14 @@ public function accept() /** * @return integer Returns the number of filtered holidays. */ - public function count() + public function count(): int { - $days = array_keys(iterator_to_array($this)); + $days = \array_keys(\iterator_to_array($this)); - array_walk($days, function (&$day) { - $day = str_replace('substituteHoliday:', '', $day); + \array_walk($days, function (&$day) { + $day = \str_replace('substituteHoliday:', '', $day); }); - return count(array_unique($days)); + return \count(\array_unique($days)); } } diff --git a/src/Yasumi/Holiday.php b/src/Yasumi/Holiday.php index 8ade60d09..1a72e145e 100755 --- a/src/Yasumi/Holiday.php +++ b/src/Yasumi/Holiday.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi; @@ -15,7 +15,6 @@ use DateTime; use InvalidArgumentException; use JsonSerializable; -use Yasumi\Exception\InvalidDateException; use Yasumi\Exception\UnknownLocaleException; /** @@ -26,37 +25,37 @@ class Holiday extends DateTime implements JsonSerializable /** * Type definition for Official (i.e. National/Federal) holidays. */ - const TYPE_OFFICIAL = 'official'; + public const TYPE_OFFICIAL = 'official'; /** * Type definition for Observance holidays. */ - const TYPE_OBSERVANCE = 'observance'; + public const TYPE_OBSERVANCE = 'observance'; /** * Type definition for seasonal holidays. */ - const TYPE_SEASON = 'season'; + public const TYPE_SEASON = 'season'; /** * Type definition for Bank holidays. */ - const TYPE_BANK = 'bank'; + public const TYPE_BANK = 'bank'; /** * Type definition for other type of holidays. */ - const TYPE_OTHER = 'other'; + public const TYPE_OTHER = 'other'; /** * The default locale. Used for translations of holiday names and other text strings. */ - const DEFAULT_LOCALE = 'en_US'; + public const DEFAULT_LOCALE = 'en_US'; /** * @var array list of all defined locales */ - private static $locales; + private static $locales = []; /** * @var string short name (internal name) of this holiday @@ -97,32 +96,28 @@ class Holiday extends DateTime implements JsonSerializable * @throws \Yasumi\Exception\InvalidDateException * @throws UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ public function __construct( - $shortName, + string $shortName, array $names, \DateTimeInterface $date, - $displayLocale = self::DEFAULT_LOCALE, - $type = self::TYPE_OFFICIAL + string $displayLocale = self::DEFAULT_LOCALE, + string $type = self::TYPE_OFFICIAL ) { // Validate if short name is not empty if (empty($shortName)) { throw new InvalidArgumentException('Holiday name can not be blank.'); } - // Validate if date parameter is instance of DateTimeInterface - if (! ($date instanceof \DateTimeInterface)) { - throw new InvalidDateException($date); - } - // Load internal locales variable - if (null === static::$locales) { - static::$locales = Yasumi::getAvailableLocales(); + if (empty(self::$locales)) { + self::$locales = Yasumi::getAvailableLocales(); } // Assert display locale input - if (! in_array($displayLocale, static::$locales, true)) { - throw new UnknownLocaleException(sprintf('Locale "%s" is not a valid locale.', $displayLocale)); + if (! \in_array($displayLocale, self::$locales, true)) { + throw new UnknownLocaleException(\sprintf('Locale "%s" is not a valid locale.', $displayLocale)); } // Set additional attributes @@ -140,7 +135,7 @@ public function __construct( * * @return string the type of holiday (official, observance, season, bank or other). */ - public function getType() + public function getType(): string { return $this->type; } @@ -150,7 +145,7 @@ public function getType() * * @return $this */ - public function jsonSerialize() + public function jsonSerialize(): self { return $this; } @@ -162,17 +157,9 @@ public function jsonSerialize() * defined, the name in the default locale ('en_US') is returned. In case there is no translation at all, the short * internal name is returned. */ - public function getName() + public function getName(): string { - if (isset($this->translations[$this->displayLocale])) { - return $this->translations[$this->displayLocale]; - } - - if (isset($this->translations[self::DEFAULT_LOCALE])) { - return $this->translations[self::DEFAULT_LOCALE]; - } - - return $this->shortName; + return $this->translations[$this->displayLocale] ?? $this->translations[self::DEFAULT_LOCALE] ?? $this->shortName; } /** @@ -183,16 +170,16 @@ public function getName() public function mergeGlobalTranslations(TranslationsInterface $globalTranslations) { $holidayGlobalTranslations = $globalTranslations->getTranslations($this->shortName); - $this->translations = array_merge($holidayGlobalTranslations, $this->translations); + $this->translations = \array_merge($holidayGlobalTranslations, $this->translations); } /** * Format the instance as a string using the set format. * - * @return string + * @return string this instance as a string using the set format. */ - public function __toString() + public function __toString(): string { - return (string)$this->format('Y-m-d'); + return $this->format('Y-m-d'); } } diff --git a/src/Yasumi/Provider/AbstractProvider.php b/src/Yasumi/Provider/AbstractProvider.php index 3f9ab7ee3..8ac7e3305 100755 --- a/src/Yasumi/Provider/AbstractProvider.php +++ b/src/Yasumi/Provider/AbstractProvider.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -16,8 +16,8 @@ use Countable; use InvalidArgumentException; use IteratorAggregate; -use Yasumi\Exception\InvalidDateException; use Yasumi\Filters\BetweenFilter; +use Yasumi\Filters\OnFilter; use Yasumi\Holiday; use Yasumi\ProviderInterface; use Yasumi\TranslationsInterface; @@ -32,13 +32,14 @@ abstract class AbstractProvider implements ProviderInterface, Countable, Iterato * Code to identify the Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'US'; + public const ID = 'US'; + /** * @var array list of the days of the week (the index of the weekdays) that are considered weekend days. * This list only concerns those countries that deviate from the global common definition, * where the weekend starts on Saturday and ends on Sunday (0 = Sunday, 1 = Monday, etc.). */ - const WEEKEND_DATA = [ + public const WEEKEND_DATA = [ // Thursday and Friday 'AF' => [4, 5], // Afghanistan @@ -68,18 +69,22 @@ abstract class AbstractProvider implements ProviderInterface, Countable, Iterato // Friday 'IN' => [0], // India ]; + /** * @var int the object's current year */ protected $year; + /** * @var string the object's current timezone */ protected $timezone; + /** * @var string the object's current locale */ protected $locale; + /** * @var Holiday[] list of dates of the available holidays */ @@ -102,7 +107,7 @@ public function __construct($year, $locale = 'en_US', TranslationsInterface $glo { $this->clearHolidays(); - $this->year = $year ?: date('Y'); + $this->year = $year ?: \getdate()['year']; $this->locale = $locale; $this->globalTranslations = $globalTranslations; @@ -126,7 +131,7 @@ protected function clearHolidays() * @return int result where 0 means dates are equal, -1 the first date is before the second date, and 1 if the * second date is after the first. */ - private static function compareDates(\DateTimeInterface $dateA, \DateTimeInterface $dateB) + private static function compareDates(\DateTimeInterface $dateA, \DateTimeInterface $dateB): int { if ($dateA === $dateB) { return 0; @@ -148,7 +153,7 @@ public function addHoliday(Holiday $holiday) } $this->holidays[$holiday->shortName] = $holiday; - uasort($this->holidays, [__CLASS__, 'compareDates']); + \uasort($this->holidays, [__CLASS__, 'compareDates']); } @@ -162,7 +167,7 @@ public function addHoliday(Holiday $holiday) * * @return void */ - public function removeHoliday($shortName) + public function removeHoliday($shortName): void { unset($this->holidays[$shortName]); } @@ -180,13 +185,8 @@ public function removeHoliday($shortName) * * @return bool true if date represents a working day, otherwise false */ - public function isWorkingDay($date) + public function isWorkingDay(\DateTimeInterface $date): bool { - // Return false if given date is invalid - if (! $date instanceof \DateTimeInterface) { - throw new InvalidDateException($date); - } - // First check if the given date is a holiday if ($this->isHoliday($date)) { return false; @@ -195,13 +195,11 @@ public function isWorkingDay($date) // Check if given date is a falls in the weekend or not // If no data is defined for this Holiday Provider, the function falls back to the global weekend definition. // @TODO Ideally avoid late static binding here (static::ID) - if ($date instanceof \DateTimeInterface) { - $weekend_data = self::WEEKEND_DATA; - $weekend_days = isset($weekend_data[$this::ID]) ? $weekend_data[$this::ID] : [0, 6]; + $weekend_data = self::WEEKEND_DATA; + $weekend_days = $weekend_data[$this::ID] ?? [0, 6]; - if (in_array((int)$date->format('w'), $weekend_days, true)) { - return false; - } + if (\in_array((int)$date->format('w'), $weekend_days, true)) { + return false; } return true; @@ -217,15 +215,10 @@ public function isWorkingDay($date) * * @return bool true if date represents a holiday, otherwise false */ - public function isHoliday($date) + public function isHoliday(\DateTimeInterface $date): bool { - // Return false if given date is invalid - if (! $date instanceof \DateTimeInterface) { - throw new InvalidDateException($date); - } - // Check if given date is a holiday or not - if (in_array($date->format('Y-m-d'), array_values($this->getHolidayDates()), true)) { + if (\in_array($date->format('Y-m-d'), \array_values($this->getHolidayDates()), true)) { return true; } @@ -237,9 +230,9 @@ public function isHoliday($date) * * @return array list of all holiday dates defined for the given year */ - public function getHolidayDates() + public function getHolidayDates(): array { - return array_map(function ($holiday) { + return \array_map(function ($holiday) { return (string)$holiday; }, $this->holidays); } @@ -253,7 +246,7 @@ public function getHolidayDates() * * @return string the date of the requested holiday */ - public function whenIs($shortName) + public function whenIs($shortName): string { $this->isHolidayNameNotEmpty($shortName); // Validate if short name is not empty @@ -269,7 +262,7 @@ public function whenIs($shortName) * * @return true upon success, otherwise an InvalidArgumentException is thrown */ - protected function isHolidayNameNotEmpty($shortName) + protected function isHolidayNameNotEmpty($shortName): bool { if (empty($shortName)) { throw new InvalidArgumentException('Holiday name can not be blank.'); @@ -290,7 +283,7 @@ protected function isHolidayNameNotEmpty($shortName) * * @return int the index of the weekdays of the requested holiday (0 = Sunday, 1 = Monday, etc.) */ - public function whatWeekDayIs($shortName) + public function whatWeekDayIs($shortName): int { $this->isHolidayNameNotEmpty($shortName); // Validate if short name is not empty @@ -303,15 +296,15 @@ public function whatWeekDayIs($shortName) * * @return int number of holidays */ - public function count() + public function count(): int { $list = $this->getHolidayNames(); - array_walk($list, function (&$holiday) { - $holiday = str_replace('substituteHoliday:', '', $holiday); + \array_walk($list, function (&$holiday) { + $holiday = \str_replace('substituteHoliday:', '', $holiday); }); - return count(array_unique($list)); + return \count(\array_unique($list)); } /** @@ -319,9 +312,9 @@ public function count() * * @return array list of all holiday names defined for the given year */ - public function getHolidayNames() + public function getHolidayNames(): array { - return array_keys($this->holidays); + return \array_keys($this->holidays); } /** @@ -329,7 +322,7 @@ public function getHolidayNames() * * @return int the year set for this Holiday calendar */ - public function getYear() + public function getYear(): int { return $this->year; } @@ -339,16 +332,16 @@ public function getYear() * * @param string $shortName the name of the holiday for which the next occurrence need to be retrieved. * - * @return Holiday|null a Holiday instance for the given holiday + * @return \Yasumi\Holiday|null a Holiday instance for the given holiday * + * @throws \ReflectionException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \RuntimeException * @throws \InvalidArgumentException - * @throws \ReflectionException * * @covers AbstractProvider::anotherTime */ - public function next($shortName) + public function next($shortName): ?Holiday { return $this->anotherTime($this->year + 1, $shortName); } @@ -359,19 +352,19 @@ public function next($shortName) * @param int $year the year to get the holiday date for * @param string $shortName the name of the holiday for which the date needs to be fetched * - * @return Holiday|null a Holiday instance for the given holiday and year + * @return \Yasumi\Holiday|null a Holiday instance for the given holiday and year * + * @throws \ReflectionException * @throws InvalidArgumentException when the given name is blank or empty. * @throws \Yasumi\Exception\UnknownLocaleException * @throws \RuntimeException - * @throws \ReflectionException */ - private function anotherTime($year, $shortName) + private function anotherTime($year, $shortName): ?Holiday { $this->isHolidayNameNotEmpty($shortName); // Validate if short name is not empty // Get calling class name - $hReflectionClass = new \ReflectionClass(get_class($this)); + $hReflectionClass = new \ReflectionClass(\get_class($this)); return Yasumi::create($hReflectionClass->getShortName(), $year, $this->locale)->getHoliday($shortName); } @@ -383,23 +376,23 @@ private function anotherTime($year, $shortName) * * @throws InvalidArgumentException when the given name is blank or empty. * - * @return Holiday|null a Holiday instance for the given holiday + * @return \Yasumi\Holiday|null a Holiday instance for the given holiday */ - public function getHoliday($shortName) + public function getHoliday($shortName): ?Holiday { $this->isHolidayNameNotEmpty($shortName); // Validate if short name is not empty $holidays = $this->getHolidays(); - return isset($holidays[$shortName]) ? $holidays[$shortName] : null; + return $holidays[$shortName] ?? null; } /** * Gets all of the holidays defined by this holiday provider (for the given year). * - * @return Holiday[] list of all holidays defined for the given year + * @return \Yasumi\Holiday[] list of all holidays defined for the given year */ - public function getHolidays() + public function getHolidays(): array { return $this->holidays; } @@ -409,16 +402,16 @@ public function getHolidays() * * @param string $shortName the name of the holiday for which the previous occurrence need to be retrieved. * - * @return Holiday|null a Holiday instance for the given holiday + * @return \Yasumi\Holiday|null a Holiday instance for the given holiday * + * @throws \ReflectionException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \RuntimeException * @throws \InvalidArgumentException - * @throws \ReflectionException * * @covers AbstractProvider::anotherTime */ - public function previous($shortName) + public function previous($shortName): ?Holiday { return $this->anotherTime($this->year - 1, $shortName); } @@ -445,7 +438,7 @@ public function previous($shortName) * * @return \Yasumi\Filters\BetweenFilter */ - public function between(\DateTimeInterface $start_date, \DateTimeInterface $end_date, $equals = true) + public function between(\DateTimeInterface $start_date, \DateTimeInterface $end_date, $equals = true): BetweenFilter { if ($start_date > $end_date) { throw new InvalidArgumentException('Start date must be a date before the end date.'); @@ -454,12 +447,30 @@ public function between(\DateTimeInterface $start_date, \DateTimeInterface $end_ return new BetweenFilter($this->getIterator(), $start_date, $end_date, $equals); } + /** + * Retrieves a list of all holidays that happen on the given date. + * + * Yasumi only calculates holidays for a single year, so a date outside of the given year will not appear to + * contain any holidays. + * + * Please take care to use the appropriate timezone for the date parameters. If there is a different timezone used + * for these parameters versus the instantiated Holiday Provider, the outcome might be unexpected (but correct). + * + * @param \DateTimeInterface $date Date to check for holidays on. + * + * @return \Yasumi\Filters\OnFilter + */ + public function on(\DateTimeInterface $date): OnFilter + { + return new OnFilter($this->getIterator(), $date); + } + /** * Get an iterator for the holidays. * * @return ArrayIterator iterator for the holidays of this calendar */ - public function getIterator() + public function getIterator(): ArrayIterator { return new ArrayIterator($this->getHolidays()); } diff --git a/src/Yasumi/Provider/Australia.php b/src/Yasumi/Provider/Australia.php index f6318de6a..11d3c1a11 100755 --- a/src/Yasumi/Provider/Australia.php +++ b/src/Yasumi/Provider/Australia.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -28,7 +28,7 @@ class Australia extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'AU'; + public const ID = 'AU'; public $timezone = 'Australia/Melbourne'; @@ -39,14 +39,12 @@ class Australia extends AbstractProvider * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { // Official Holidays - $this->calculateAustraliaDay(); $this->calculateNewYearHolidays(); + $this->calculateAustraliaDay(); $this->calculateAnzacDay(); - //$this->calculateQueensBirthday(); - //$this->calculateLabourDay(); // Add Christian holidays $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale)); @@ -72,21 +70,22 @@ public function initialize() * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateAustraliaDay() + public function calculateAustraliaDay(): void { $date = new DateTime("$this->year-01-26", new DateTimeZone($this->timezone)); - $this->calculateHoliday('australiaDay', [], $date); + $this->calculateHoliday('australiaDay', ['en_AU' => 'Australia Day'], $date); } /** * Function to simplify moving holidays to mondays if required * - * @param string $shortName - * @param array $names - * @param string|DateTime $date - * @param bool $moveFromSaturday - * @param bool $moveFromSunday + * @param string $shortName + * @param array $names + * @param DateTime $date + * @param bool $moveFromSaturday + * @param bool $moveFromSunday + * @param string $type * * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException @@ -94,23 +93,19 @@ public function calculateAustraliaDay() * @throws \Exception */ public function calculateHoliday( - $shortName, + string $shortName, array $names = [], $date, $moveFromSaturday = true, - $moveFromSunday = true - ) { - $holidayDate = $date instanceof \DateTimeInterface ? $date : new \DateTime( - $date, - new \DateTimeZone($this->timezone) - ); - - $day = (int)$holidayDate->format('w'); + $moveFromSunday = true, + $type = Holiday::TYPE_OFFICIAL + ): void { + $day = (int)$date->format('w'); if (($day === 0 && $moveFromSunday) || ($day === 6 && $moveFromSaturday)) { - $holidayDate = $holidayDate->add($day === 0 ? new DateInterval('P1D') : new DateInterval('P2D')); + $date = $date->add($day === 0 ? new DateInterval('P1D') : new DateInterval('P2D')); } - $this->addHoliday(new Holiday($shortName, $names, $holidayDate, $this->locale)); + $this->addHoliday(new Holiday($shortName, $names, $date, $this->locale, $type)); } /** @@ -118,8 +113,8 @@ public function calculateHoliday( * * New Year's Day is on January 1 and is the first day of a new year in the Gregorian calendar, * which is used in Australia and many other countries. Due to its geographical position close - * to the International Date Line, Australia is one of the first countries in the world to - * welcome the New Year. + * to the International Date Line, Australia is one of the first countries in the world to welcome the New Year. + * If it falls on a weekend an additional public holiday is held on the next available weekday. * * @link https://www.timeanddate.com/holidays/australia/new-year-day * @@ -127,13 +122,20 @@ public function calculateHoliday( * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateNewYearHolidays() + public function calculateNewYearHolidays(): void { - $this->calculateHoliday( - 'newYearsDay', - [], - new DateTime("$this->year-01-01", new DateTimeZone($this->timezone)) - ); + $newyearsday = new DateTime("$this->year-01-01", new DateTimeZone($this->timezone)); + $this->calculateHoliday('newYearsDay', ['en_AU' => 'New Year\'s Day'], $newyearsday, false, false); + switch ($newyearsday->format('w')) { + case 0: // sunday + $newyearsday->add(new DateInterval('P1D')); + $this->calculateHoliday('newYearsHoliday', ['en_AU' => 'New Year\'s Holiday'], $newyearsday, false, false); + break; + case 6: // saturday + $newyearsday->add(new DateInterval('P2D')); + $this->calculateHoliday('newYearsHoliday', ['en_AU' => 'New Year\'s Holiday'], $newyearsday, false, false); + break; + } } /** @@ -141,7 +143,9 @@ public function calculateNewYearHolidays() * * 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. + * Observed on 25 April each year. Unlike most other Australian public holidays, If it falls on a weekend it is NOT moved + * to the next available weekday, nor is there an additional public holiday held. However, if it clashes with Easter, + * an additional public holiday is held for Easter. * * @link https://en.wikipedia.org/wiki/Anzac_Day * @link https://www.timeanddate.com/holidays/australia/anzac-day @@ -150,22 +154,32 @@ public function calculateNewYearHolidays() * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateAnzacDay() + public function calculateAnzacDay(): void { if ($this->year < 1921) { return; } $date = new DateTime("$this->year-04-25", new DateTimeZone($this->timezone)); + $this->calculateHoliday('anzacDay', ['en_AU' => 'ANZAC Day'], $date, false, false); + $easter = $this->calculateEaster($this->year, $this->timezone); + + $easterMonday = $this->calculateEaster($this->year, $this->timezone); + $easterMonday->add(new DateInterval('P1D')); - $this->calculateHoliday('anzacDay', [], $date); + $fDate = $date->format('Y-m-d'); + if ($fDate === $easter->format('Y-m-d') || $fDate === $easterMonday->format('Y-m-d')) { + $easterMonday->add(new DateInterval('P1D')); + $this->calculateHoliday('easterTuesday', ['en_AU' => 'Easter Tuesday'], $easterMonday, false, false); + } + unset($fDate); } /** * Christmas Day / Boxing Day. * * Christmas day, and Boxing day are public holidays in Australia, - * if they fall on the weekend they are moved to the next available weekday. + * if they fall on the weekend an additional public holiday is held on the next available weekday. * * @link https://www.timeanddate.com/holidays/australia/christmas-day-holiday * @@ -173,63 +187,28 @@ public function calculateAnzacDay() * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateChristmasDay() + public function calculateChristmasDay(): void { $christmasDay = new DateTime("$this->year-12-25", new DateTimeZone($this->timezone)); $boxingDay = new DateTime("$this->year-12-26", new DateTimeZone($this->timezone)); + $this->calculateHoliday('christmasDay', ['en_AU' => 'Christmas Day'], $christmasDay, false, false); + $this->calculateHoliday('secondChristmasDay', ['en_AU' => 'Boxing Day'], $boxingDay, false, false); switch ($christmasDay->format('w')) { case 0: // sunday - $christmasDay->add(new \DateInterval('P2D')); + $christmasDay->add(new DateInterval('P2D')); + $this->calculateHoliday('christmasHoliday', ['en_AU' => 'Christmas Holiday'], $christmasDay, false, false); break; case 5: // friday - $boxingDay->add(new \DateInterval('P2D')); + $boxingDay->add(new DateInterval('P2D')); + $this->calculateHoliday('secondChristmasHoliday', ['en_AU' => 'Boxing Day Holiday'], $boxingDay, false, false); break; case 6: // saturday - $christmasDay->add(new \DateInterval('P2D')); - $boxingDay->add(new \DateInterval('P2D')); + $christmasDay->add(new DateInterval('P2D')); + $boxingDay->add(new DateInterval('P2D')); + $this->calculateHoliday('christmasHoliday', ['en_AU' => 'Christmas Holiday'], $christmasDay, false, false); + $this->calculateHoliday('secondChristmasHoliday', ['en_AU' => 'Boxing Day Holiday'], $boxingDay, false, false); break; } - $this->calculateHoliday('christmasDay', [], $christmasDay); - $this->calculateHoliday('secondChristmasDay', [], $boxingDay); - } - - /** - * Queens Birthday. - * - * The Queen's Birthday is an Australian public holiday but the date varies across - * states and territories. Australia celebrates this holiday because it is a constitutional - * monarchy, with the English monarch as head of state. - * - * Her actual birthday is on April 21, but it's celebrated as a public holiday on the second Monday of June. - * (Except QLD & WA) - * - * @link https://www.timeanddate.com/holidays/australia/queens-birthday - * - * @throws \InvalidArgumentException - * @throws \Exception - */ - public function calculateQueensBirthday() - { - $this->calculateHoliday( - 'queensBirthday', - ['en_AU' => 'Queens Birthday'], - 'second monday of june ' . $this->year, - false, - false - ); - } - - /** - * @link https://www.timeanddate.com/holidays/australia/labour-day - * - * @throws \InvalidArgumentException - * @throws \Yasumi\Exception\UnknownLocaleException - */ - public function calculateLabourDay() - { - $date = new DateTime('first Monday in October' . " $this->year", new DateTimeZone($this->timezone)); - - $this->addHoliday(new Holiday('labourDay', [], $date, $this->locale)); } } diff --git a/src/Yasumi/Provider/Australia/ACT.php b/src/Yasumi/Provider/Australia/ACT.php new file mode 100644 index 000000000..bd50aa21b --- /dev/null +++ b/src/Yasumi/Provider/Australia/ACT.php @@ -0,0 +1,189 @@ + + */ + +namespace Yasumi\Provider\Australia; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia; + +/** + * Provider for all holidays in Australian Capital Territory (Australia). + * + */ +class ACT extends Australia +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. + */ + public const ID = 'AU-ACT'; + + public $timezone = 'Australia/ACT'; + + /** + * Initialize holidays for Australian Capital Territory (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->addHoliday($this->easterSunday($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->easterSaturday($this->year, $this->timezone, $this->locale)); + $this->calculateQueensBirthday(); + $this->calculateLabourDay(); + $this->calculateCanberraDay(); + $this->calculateReconciliationDay(); + } + + /** + * Canberra Day + * + * @throws \Exception + */ + public function calculateCanberraDay(): void + { + if ($this->year < 2007) { + $date = new DateTime("third monday of march $this->year", new DateTimeZone($this->timezone)); + } else { + $date = new DateTime("second monday of march $this->year", new DateTimeZone($this->timezone)); + } + $this->addHoliday(new Holiday('canberraDay', ['en_AU' => 'Canberra Day'], $date, $this->locale)); + } + + /** + * Reconciliation Day + * + * @throws \Exception + */ + public function calculateReconciliationDay(): void + { + if ($this->year < 2018) { + return; + } + + $date = new DateTime($this->year . '-05-27', new DateTimeZone($this->timezone)); + $day = (int)$date->format('w'); + if ($day !== 1) { + $date = $date->add($day === 0 ? new DateInterval('P1D') : new DateInterval('P'.(8-$day).'D')); + } + $this->addHoliday(new Holiday('reconciliationDay', ['en_AU' => 'Reconciliation Day'], $date, $this->locale)); + } + + /** + * Labour Day + * + * @throws \Exception + */ + public function calculateLabourDay(): void + { + $date = new DateTime("first monday of october $this->year", new DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('labourDay', ['en_AU' => 'Labour Day'], $date, $this->locale)); + } + + /** + * Easter Saturday. + * + * Easter is a festival and holiday celebrating the resurrection of Jesus Christ from the dead. Easter is celebrated + * on a date based on a certain number of days after March 21st. The date of Easter Day was defined by the Council + * of Nicaea in AD325 as the Sunday after the first full moon which falls on or after the Spring Equinox. + * + * @link http://en.wikipedia.org/wiki/Easter + * + * @param int $year the year for which Easter Saturday need to be created + * @param string $timezone the timezone in which Easter Saturday is celebrated + * @param string $locale the locale for which Easter Saturday need to be displayed in. + * @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE, + * TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered. + * + * @return \Yasumi\Holiday + * + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function easterSaturday($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL): Holiday + { + return new Holiday( + 'easterSaturday', + ['en_AU' => 'Easter Saturday'], + $this->calculateEaster($year, $timezone)->sub(new DateInterval('P1D')), + $locale, + $type + ); + } + + /** + * Easter Sunday. + * + * Easter is a festival and holiday celebrating the resurrection of Jesus Christ from the dead. Easter is celebrated + * on a date based on a certain number of days after March 21st. The date of Easter Day was defined by the Council + * of Nicaea in AD325 as the Sunday after the first full moon which falls on or after the Spring Equinox. + * + * @link http://en.wikipedia.org/wiki/Easter + * + * @param int $year the year for which Easter Saturday need to be created + * @param string $timezone the timezone in which Easter Saturday is celebrated + * @param string $locale the locale for which Easter Saturday need to be displayed in. + * @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE, + * TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered. + * + * @return \Yasumi\Holiday + * + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function easterSunday($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL): Holiday + { + return new Holiday( + 'easter', + ['en_AU' => 'Easter Sunday'], + $this->calculateEaster($year, $timezone), + $locale, + $type + ); + } + + /** + * Queens Birthday. + * + * The Queen's Birthday is an Australian public holiday but the date varies across + * states and territories. Australia celebrates this holiday because it is a constitutional + * monarchy, with the English monarch as head of state. + * + * Her actual birthday is on April 21, but it's celebrated as a public holiday on the second Monday of June. + * (Except QLD & WA) + * + * @link https://www.timeanddate.com/holidays/australia/queens-birthday + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function calculateQueensBirthday(): void + { + $this->calculateHoliday( + 'queensBirthday', + ['en_AU' => "Queen's Birthday"], + new DateTime('second monday of june ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } +} diff --git a/src/Yasumi/Provider/Australia/NSW.php b/src/Yasumi/Provider/Australia/NSW.php new file mode 100644 index 000000000..73c7efedd --- /dev/null +++ b/src/Yasumi/Provider/Australia/NSW.php @@ -0,0 +1,140 @@ + + */ + +namespace Yasumi\Provider\Australia; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia; + +/** + * Provider for all holidays in New South Wales (Australia). + * + */ +class NSW extends Australia +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. + */ + public const ID = 'AU-NSW'; + + public $timezone = 'Australia/NSW'; + + /** + * Initialize holidays for New South Wales (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->addHoliday(new Holiday('easter', ['en_AU' => 'Easter Sunday'], $this->calculateEaster($this->year, $this->timezone), $this->locale)); + $this->addHoliday($this->easterSaturday($this->year, $this->timezone, $this->locale)); + $this->calculateQueensBirthday(); + $this->calculateLabourDay(); + $this->calculateBankHoliday(); + } + + /** + * Labour Day + * + * @throws \Exception + */ + public function calculateLabourDay(): void + { + $date = new DateTime("first monday of october $this->year", new DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('labourDay', [], $date, $this->locale)); + } + + /** + * Easter Saturday. + * + * Easter is a festival and holiday celebrating the resurrection of Jesus Christ from the dead. Easter is celebrated + * on a date based on a certain number of days after March 21st. The date of Easter Day was defined by the Council + * of Nicaea in AD325 as the Sunday after the first full moon which falls on or after the Spring Equinox. + * + * @link http://en.wikipedia.org/wiki/Easter + * + * @param int $year the year for which Easter Saturday need to be created + * @param string $timezone the timezone in which Easter Saturday is celebrated + * @param string $locale the locale for which Easter Saturday need to be displayed in. + * @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE, + * TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered. + * + * @return \Yasumi\Holiday + * + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function easterSaturday($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL): Holiday + { + return new Holiday( + 'easterSaturday', + ['en_AU' => 'Easter Saturday'], + $this->calculateEaster($year, $timezone)->sub(new DateInterval('P1D')), + $locale, + $type + ); + } + + /** + * Queens Birthday. + * + * The Queen's Birthday is an Australian public holiday but the date varies across + * states and territories. Australia celebrates this holiday because it is a constitutional + * monarchy, with the English monarch as head of state. + * + * Her actual birthday is on April 21, but it's celebrated as a public holiday on the second Monday of June. + * (Except QLD & WA) + * + * @link https://www.timeanddate.com/holidays/australia/queens-birthday + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function calculateQueensBirthday(): void + { + $this->calculateHoliday( + 'queensBirthday', + ['en_AU' => "Queen's Birthday"], + new DateTime('second monday of june ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } + + /** + * Bank Holiday. + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function calculateBankHoliday(): void + { + $this->calculateHoliday( + 'bankHoliday', + ['en_AU' => 'Bank Holiday'], + new DateTime('first monday of august '. $this->year, new DateTimeZone($this->timezone)), + false, + false, + Holiday::TYPE_BANK + ); + } +} diff --git a/src/Yasumi/Provider/Australia/NT.php b/src/Yasumi/Provider/Australia/NT.php new file mode 100644 index 000000000..effa3dc97 --- /dev/null +++ b/src/Yasumi/Provider/Australia/NT.php @@ -0,0 +1,140 @@ + + */ + +namespace Yasumi\Provider\Australia; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia; + +/** + * Provider for all holidays in Northern Territory (Australia). + * + */ +class NT extends Australia +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. + */ + public const ID = 'AU-NT'; + + public $timezone = 'Australia/North'; + + /** + * Initialize holidays for Northern Territory (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->addHoliday($this->easterSaturday($this->year, $this->timezone, $this->locale)); + $this->calculateQueensBirthday(); + $this->calculateMayDay(); + $this->calculatePicnicDay(); + } + + /** + * May Day + * + * @throws \Exception + */ + public function calculateMayDay(): void + { + $date = new DateTime("first monday of may $this->year", new DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('mayDay', ['en_AU' => 'May Day'], $date, $this->locale)); + } + + /** + * Picnic Day + * + * @link https://en.wikipedia.org/wiki/Picnic_Day_(Australian_holiday) + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function calculatePicnicDay(): void + { + $this->calculateHoliday( + 'picnicDay', + ['en_AU' => 'Picnic Day'], + new DateTime('first monday of august '. $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } + + /** + * Easter Saturday. + * + * Easter is a festival and holiday celebrating the resurrection of Jesus Christ from the dead. Easter is celebrated + * on a date based on a certain number of days after March 21st. The date of Easter Day was defined by the Council + * of Nicaea in AD325 as the Sunday after the first full moon which falls on or after the Spring Equinox. + * + * @link http://en.wikipedia.org/wiki/Easter + * + * @param int $year the year for which Easter Saturday need to be created + * @param string $timezone the timezone in which Easter Saturday is celebrated + * @param string $locale the locale for which Easter Saturday need to be displayed in. + * @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE, + * TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered. + * + * @return \Yasumi\Holiday + * + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function easterSaturday($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL): Holiday + { + return new Holiday( + 'easterSaturday', + ['en_AU' => 'Easter Saturday'], + $this->calculateEaster($year, $timezone)->sub(new DateInterval('P1D')), + $locale, + $type + ); + } + + /** + * Queens Birthday. + * + * The Queen's Birthday is an Australian public holiday but the date varies across + * states and territories. Australia celebrates this holiday because it is a constitutional + * monarchy, with the English monarch as head of state. + * + * Her actual birthday is on April 21, but it's celebrated as a public holiday on the second Monday of June. + * (Except QLD & WA) + * + * @link https://www.timeanddate.com/holidays/australia/queens-birthday + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function calculateQueensBirthday(): void + { + $this->calculateHoliday( + 'queensBirthday', + ['en_AU' => "Queen's Birthday"], + new DateTime('second monday of june ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } +} diff --git a/src/Yasumi/Provider/Australia/Queensland.php b/src/Yasumi/Provider/Australia/Queensland.php new file mode 100644 index 000000000..713dddfa5 --- /dev/null +++ b/src/Yasumi/Provider/Australia/Queensland.php @@ -0,0 +1,100 @@ + + */ + +namespace Yasumi\Provider\Australia; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia; + +/** + * Provider for all holidays in Queensland (Australia). + * + */ +class Queensland extends Australia +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. + */ + public const ID = 'AU-QLD'; + + public $timezone = 'Australia/Queensland'; + + /** + * Initialize holidays for Queensland (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->calculateQueensBirthday(); + $this->calculateLabourDay(); + } + + /** + * Labour Day + * + * @throws \Exception + */ + public function calculateLabourDay(): void + { + if ($this->year === 2013 || $this->year === 2014 || $this->year === 2015) { + $date = new DateTime("first monday of october $this->year", new DateTimeZone($this->timezone)); + } else { + $date = new DateTime("first monday of may $this->year", new DateTimeZone($this->timezone)); + } + + $this->addHoliday(new Holiday('labourDay', [], $date, $this->locale)); + } + + /** + * Queens Birthday. + * + * The Queen's Birthday is an Australian public holiday but the date varies across + * states and territories. Australia celebrates this holiday because it is a constitutional + * monarchy, with the English monarch as head of state. + * + * Her actual birthday is on April 21, but it's celebrated as a public holiday on the second Monday of June. + * (Except QLD & WA) + * + * @link https://www.timeanddate.com/holidays/australia/queens-birthday + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function calculateQueensBirthday(): void + { + if ($this->year < 2012 || $this->year === 2013 || $this->year === 2014 || $this->year === 2015) { + $this->calculateHoliday( + 'queensBirthday', + ['en_AU' => "Queen's Birthday"], + new DateTime('second monday of june ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } else { + $this->calculateHoliday( + 'queensBirthday', + ['en_AU' => "Queen's Birthday"], + new DateTime('first monday of october ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } + } +} diff --git a/src/Yasumi/Provider/Australia/Queensland/Brisbane.php b/src/Yasumi/Provider/Australia/Queensland/Brisbane.php new file mode 100644 index 000000000..de0cb863c --- /dev/null +++ b/src/Yasumi/Provider/Australia/Queensland/Brisbane.php @@ -0,0 +1,76 @@ + + */ + +namespace Yasumi\Provider\Australia\Queensland; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia\Queensland; + +/** + * Provider for all holidays in Brisbane (Australia). + * + */ +class Brisbane extends Queensland +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. This one is not a proper ISO3166 code, but there isn't one specifically for Brisbane, + * and I believe this is a logical extension. + */ + public const ID = 'AU-QLD-BRI'; + + public $timezone = 'Australia/Brisbane'; + + /** + * Initialize holidays for Brisbane (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->calculatePeoplesDay(); + } + + /** + * Ekka People's Day. + * + * The Ekka is the annual agricultural show of Queensland, Australia. Its formal title is the Royal Queensland Show + * and it is held at the Brisbane Showgrounds. It was originally called the Brisbane Exhibition, however it is more + * commonly known as the Ekka, which is a shortening of the word exhibition. It is run by The Royal National + * Agricultural and Industrial Association of Queensland. + * Because of the cultural significance of the Ekka, the City of Brisbane holds a Wednesday public holiday known as + * "People's Day". The Ekka starts on the first Friday in August, except if the first Friday is before 5 August, in + * which case it starts on the second Friday of August. People's Day is then the Wednesday after the Ekka commences. + * + * @link https://en.wikipedia.org/wiki/Ekka + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function calculatePeoplesDay(): void + { + $date = new DateTime('first friday of august ' . $this->year, new DateTimeZone($this->timezone)); + if ($date->format('d') < 5) { + $date = $date->add(new DateInterval('P7D')); + } + $date = $date->add(new DateInterval('P5D')); + $this->addHoliday(new Holiday('peoplesDay', ['en_AU' => 'Ekka People\'s Day'], $date, $this->locale)); + } +} diff --git a/src/Yasumi/Provider/Australia/SA.php b/src/Yasumi/Provider/Australia/SA.php new file mode 100644 index 000000000..1cdabcb34 --- /dev/null +++ b/src/Yasumi/Provider/Australia/SA.php @@ -0,0 +1,193 @@ + + */ + +namespace Yasumi\Provider\Australia; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia; + +/** + * Provider for all holidays in South Australia (Australia). + * + */ +class SA extends Australia +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. + */ + public const ID = 'AU-SA'; + + public $timezone = 'Australia/South'; + + /** + * Initialize holidays for South Australia (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->addHoliday($this->easterSaturday($this->year, $this->timezone, $this->locale)); + $this->calculateQueensBirthday(); + $this->calculateLabourDay(); + $this->calculateAdelaideCupDay(); + + // South Australia have Proclamation Day instead of Boxing Day, but the date definition is slightly different, + // so we have to rework everything here... + $this->removeHoliday('christmasDay'); + $this->removeHoliday('secondChristmasDay'); + $this->removeHoliday('christmasHoliday'); + $this->removeHoliday('secondChristmasHoliday'); + $this->calculateProclamationDay(); + } + + /** + * Proclamation Day + * + * @throws \Exception + */ + public function calculateProclamationDay(): void + { + $christmasDay = new DateTime("$this->year-12-25", new DateTimeZone($this->timezone)); + $this->calculateHoliday('christmasDay', ['en_AU' => 'Christmas Day'], $christmasDay, false, false); + switch ($christmasDay->format('w')) { + case 0: // sunday + $christmasDay->add(new DateInterval('P1D')); + $this->calculateHoliday('christmasHoliday', ['en_AU' => 'Christmas Holiday'], $christmasDay, false, false); + $proclamationDay = $christmasDay->add(new DateInterval('P1D')); + $this->calculateHoliday('proclamationDay', ['en_AU' => 'Proclamation Day'], $proclamationDay, false, false); + break; + case 5: // friday + $proclamationDay = $christmasDay->add(new DateInterval('P3D')); + $this->calculateHoliday('proclamationDay', ['en_AU' => 'Proclamation Day'], $proclamationDay, false, false); + break; + case 6: // saturday + $christmasDay->add(new DateInterval('P2D')); + $this->calculateHoliday('christmasHoliday', ['en_AU' => 'Christmas Holiday'], $christmasDay, false, false); + $proclamationDay = $christmasDay->add(new DateInterval('P1D')); + $this->calculateHoliday('proclamationDay', ['en_AU' => 'Proclamation Day'], $proclamationDay, false, false); + break; + default: // monday-thursday + $proclamationDay = $christmasDay->add(new DateInterval('P1D')); + $this->calculateHoliday('proclamationDay', ['en_AU' => 'Proclamation Day'], $proclamationDay, false, false); + break; + } + } + + /** + * Labour Day + * + * @throws \Exception + */ + public function calculateLabourDay(): void + { + $date = new DateTime("first monday of october $this->year", new DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('labourDay', ['en_AU' => 'Labour Day'], $date, $this->locale)); + } + + /** + * Adelaide Cup Day + * + * @link https://en.wikipedia.org/wiki/Adelaide_Cup + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function calculateAdelaideCupDay(): void + { + if ($this->year >= 1973) { + if ($this->year < 2006) { + $this->calculateHoliday( + 'adelaideCup', + ['en_AU' => 'Adelaide Cup'], + new DateTime('third monday of may ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } else { + $this->calculateHoliday( + 'adelaideCup', + ['en_AU' => 'Adelaide Cup'], + new DateTime('second monday of march ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } + } + } + + /** + * Easter Saturday. + * + * Easter is a festival and holiday celebrating the resurrection of Jesus Christ from the dead. Easter is celebrated + * on a date based on a certain number of days after March 21st. The date of Easter Day was defined by the Council + * of Nicaea in AD325 as the Sunday after the first full moon which falls on or after the Spring Equinox. + * + * @link http://en.wikipedia.org/wiki/Easter + * + * @param int $year the year for which Easter Saturday need to be created + * @param string $timezone the timezone in which Easter Saturday is celebrated + * @param string $locale the locale for which Easter Saturday need to be displayed in. + * @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE, + * TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered. + * + * @return \Yasumi\Holiday + * + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function easterSaturday($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL): Holiday + { + return new Holiday( + 'easterSaturday', + ['en_AU' => 'Easter Saturday'], + $this->calculateEaster($year, $timezone)->sub(new DateInterval('P1D')), + $locale, + $type + ); + } + + /** + * Queens Birthday. + * + * The Queen's Birthday is an Australian public holiday but the date varies across + * states and territories. Australia celebrates this holiday because it is a constitutional + * monarchy, with the English monarch as head of state. + * + * Her actual birthday is on April 21, but it's celebrated as a public holiday on the second Monday of June. + * (Except QLD & WA) + * + * @link https://www.timeanddate.com/holidays/australia/queens-birthday + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function calculateQueensBirthday(): void + { + $this->calculateHoliday( + 'queensBirthday', + ['en_AU' => "Queen's Birthday"], + new DateTime('second monday of june ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } +} diff --git a/src/Yasumi/Provider/Australia/Tasmania.php b/src/Yasumi/Provider/Australia/Tasmania.php new file mode 100644 index 000000000..6e055a598 --- /dev/null +++ b/src/Yasumi/Provider/Australia/Tasmania.php @@ -0,0 +1,106 @@ + + */ + +namespace Yasumi\Provider\Australia; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia; + +/** + * Provider for all holidays in Tasmania (Australia). + * + */ +class Tasmania extends Australia +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. + */ + public const ID = 'AU-TAS'; + + public $timezone = 'Australia/Tasmania'; + + /** + * Initialize holidays for Tasmania (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->calculateEightHoursDay(); + $this->calculateQueensBirthday(); + $this->calculateRecreationDay(); + } + + /** + * Eight Hours Day + * + * @throws \Exception + */ + public function calculateEightHoursDay(): void + { + $date = new DateTime("second monday of march $this->year", new DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('eightHourDay', ['en_AU' => 'Eight Hour Day'], $date, $this->locale)); + } + + /** + * Queens Birthday. + * + * The Queen's Birthday is an Australian public holiday but the date varies across + * states and territories. Australia celebrates this holiday because it is a constitutional + * monarchy, with the English monarch as head of state. + * + * Her actual birthday is on April 21, but it's celebrated as a public holiday on the second Monday of June. + * (Except QLD & WA) + * + * @link https://www.timeanddate.com/holidays/australia/queens-birthday + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function calculateQueensBirthday(): void + { + $this->calculateHoliday( + 'queensBirthday', + ['en_AU' => 'Queen\'s Birthday'], + new DateTime('second monday of june ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } + + /** + * Recreation Day + * + * @link https://en.wikipedia.org/wiki/Recreation_Day_holiday + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function calculateRecreationDay(): void + { + $this->calculateHoliday( + 'recreationDay', + ['en_AU' => 'Recreation Day'], + new DateTime('first monday of november ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } +} diff --git a/src/Yasumi/Provider/Australia/Tasmania/CentralNorth.php b/src/Yasumi/Provider/Australia/Tasmania/CentralNorth.php new file mode 100644 index 000000000..a060a16c9 --- /dev/null +++ b/src/Yasumi/Provider/Australia/Tasmania/CentralNorth.php @@ -0,0 +1,58 @@ + + */ + +namespace Yasumi\Provider\Australia\Tasmania; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia\Tasmania; + +/** + * Provider for all holidays in central north Tasmania (Australia). + * + */ +class CentralNorth extends Tasmania +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, + * and I believe it to be a logical extension. + */ + public const ID = 'AU-TAS-CN'; + + /** + * Initialize holidays for northeastern Tasmania (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->calculateDevonportShow(); + } + + /** + * Devonport Show + * + * @throws \Exception + */ + public function calculateDevonportShow(): void + { + $date = new DateTime($this->year . '-12-02', new DateTimeZone($this->timezone)); + $date = $date->modify('previous friday'); + $this->addHoliday(new Holiday('devonportShow', ['en_AU' => 'Devonport Show'], $date, $this->locale)); + } +} diff --git a/src/Yasumi/Provider/Australia/Tasmania/FlindersIsland.php b/src/Yasumi/Provider/Australia/Tasmania/FlindersIsland.php new file mode 100644 index 000000000..5bcf55cbe --- /dev/null +++ b/src/Yasumi/Provider/Australia/Tasmania/FlindersIsland.php @@ -0,0 +1,59 @@ + + */ + +namespace Yasumi\Provider\Australia\Tasmania; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia\Tasmania; + +/** + * Provider for all holidays in Flinders Island (Australia). + * + */ +class FlindersIsland extends Tasmania +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, + * and I believe it to be a logical extension. + */ + public const ID = 'AU-TAS-FI'; + + /** + * Initialize holidays for Flinders Island (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->calculateFlindersIslandShow(); + } + + /** + * Flinders Island Show + * + * @throws \Exception + */ + public function calculateFlindersIslandShow(): void + { + $date = new DateTime('third saturday of october ' . $this->year, new DateTimeZone($this->timezone)); + $date = $date->sub(new DateInterval('P1D')); + $this->addHoliday(new Holiday('flindersIslandShow', ['en_AU' => 'Flinders Island Show'], $date, $this->locale)); + } +} diff --git a/src/Yasumi/Provider/Australia/Tasmania/KingIsland.php b/src/Yasumi/Provider/Australia/Tasmania/KingIsland.php new file mode 100644 index 000000000..040ad4625 --- /dev/null +++ b/src/Yasumi/Provider/Australia/Tasmania/KingIsland.php @@ -0,0 +1,61 @@ + + */ + +namespace Yasumi\Provider\Australia\Tasmania; + +use DateTime; +use DateTimeZone; +use Yasumi\Provider\Australia\Tasmania; + +/** + * Provider for all holidays in King Island (Australia). + * + */ +class KingIsland extends Tasmania +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, + * and I believe it to be a logical extension. + */ + public const ID = 'AU-TAS-KI'; + + /** + * Initialize holidays for King Island (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->calculateKingIslandShow(); + } + + /** + * King Island Show + * + * @throws \Exception + */ + public function calculateKingIslandShow(): void + { + $this->calculateHoliday( + 'kingIslandShow', + ['en_AU' => 'King Island Show'], + new DateTime('first tuesday of march ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } +} diff --git a/src/Yasumi/Provider/Australia/Tasmania/Northeast.php b/src/Yasumi/Provider/Australia/Tasmania/Northeast.php new file mode 100644 index 000000000..354c9b372 --- /dev/null +++ b/src/Yasumi/Provider/Australia/Tasmania/Northeast.php @@ -0,0 +1,59 @@ + + */ + +namespace Yasumi\Provider\Australia\Tasmania; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia\Tasmania; + +/** + * Provider for all holidays in northeastern Tasmania (Australia). + * + */ +class Northeast extends Tasmania +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, + * and I believe it to be a logical extension. + */ + public const ID = 'AU-TAS-NE'; + + /** + * Initialize holidays for northeastern Tasmania (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->calculateLauncestonShow(); + } + + /** + * Royal Launceston Show + * + * @throws \Exception + */ + public function calculateLauncestonShow(): void + { + $date = new DateTime('second saturday of october ' . $this->year, new DateTimeZone($this->timezone)); + $date = $date->sub(new DateInterval('P2D')); + $this->addHoliday(new Holiday('launcestonShow', ['en_AU' => 'Royal Launceston Show'], $date, $this->locale)); + } +} diff --git a/src/Yasumi/Provider/Australia/Tasmania/Northwest.php b/src/Yasumi/Provider/Australia/Tasmania/Northwest.php new file mode 100644 index 000000000..893576365 --- /dev/null +++ b/src/Yasumi/Provider/Australia/Tasmania/Northwest.php @@ -0,0 +1,59 @@ + + */ + +namespace Yasumi\Provider\Australia\Tasmania; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia\Tasmania; + +/** + * Provider for all holidays in northwestern Tasmania (Australia). + * + */ +class Northwest extends Tasmania +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, + * and I believe it to be a logical extension. + */ + public const ID = 'AU-TAS-NW'; + + /** + * Initialize holidays for northwestern Tasmania (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->calculateBurnieShow(); + } + + /** + * Burnie Show + * + * @throws \Exception + */ + public function calculateBurnieShow(): void + { + $date = new DateTime('first saturday of october ' . $this->year, new DateTimeZone($this->timezone)); + $date = $date->sub(new DateInterval('P1D')); + $this->addHoliday(new Holiday('burnieShow', ['en_AU' => 'Burnie Show'], $date, $this->locale)); + } +} diff --git a/src/Yasumi/Provider/Australia/Tasmania/Northwest/CircularHead.php b/src/Yasumi/Provider/Australia/Tasmania/Northwest/CircularHead.php new file mode 100644 index 000000000..6f36f8ab7 --- /dev/null +++ b/src/Yasumi/Provider/Australia/Tasmania/Northwest/CircularHead.php @@ -0,0 +1,59 @@ + + */ + +namespace Yasumi\Provider\Australia\Tasmania\Northwest; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia\Tasmania\Northwest; + +/** + * Provider for all holidays in Circular Head (Australia). + * + */ +class CircularHead extends Northwest +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, + * and I believe it to be a logical extension. + */ + public const ID = 'AU-TAS-NW-CH'; + + /** + * Initialize holidays for Circular Head (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->calculateAGFEST(); + } + + /** + * AGFEST + * + * @throws \Exception + */ + public function calculateAGFEST(): void + { + $date = new DateTime('first thursday of may ' . $this->year, new DateTimeZone($this->timezone)); + $date = $date->add(new DateInterval('P1D')); + $this->addHoliday(new Holiday('agfest', ['en_AU' => 'AGFEST'], $date, $this->locale)); + } +} diff --git a/src/Yasumi/Provider/Australia/Tasmania/South.php b/src/Yasumi/Provider/Australia/Tasmania/South.php new file mode 100644 index 000000000..cbf1977b4 --- /dev/null +++ b/src/Yasumi/Provider/Australia/Tasmania/South.php @@ -0,0 +1,59 @@ + + */ + +namespace Yasumi\Provider\Australia\Tasmania; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia\Tasmania; + +/** + * Provider for all holidays in southern Tasmania (Australia). + * + */ +class South extends Tasmania +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, + * and I believe it to be a logical extension. + */ + public const ID = 'AU-TAS-SOU'; + + /** + * Initialize holidays for southern Tasmania (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->calculateHobartShow(); + } + + /** + * Royal Hobart Show + * + * @throws \Exception + */ + public function calculateHobartShow(): void + { + $date = new DateTime('fourth saturday of october ' . $this->year, new DateTimeZone($this->timezone)); + $date = $date->sub(new DateInterval('P2D')); + $this->addHoliday(new Holiday('hobartShow', ['en_AU' => 'Royal Hobart Show'], $date, $this->locale)); + } +} diff --git a/src/Yasumi/Provider/Australia/Tasmania/South/Southeast.php b/src/Yasumi/Provider/Australia/Tasmania/South/Southeast.php new file mode 100644 index 000000000..9f2014159 --- /dev/null +++ b/src/Yasumi/Provider/Australia/Tasmania/South/Southeast.php @@ -0,0 +1,64 @@ + + */ + +namespace Yasumi\Provider\Australia\Tasmania\South; + +use DateTime; +use DateTimeZone; +use Yasumi\Provider\Australia\Tasmania\South; + +/** + * Provider for all holidays in southeastern Tasmania (Australia). + * + */ +class Southeast extends South +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, + * and I believe it to be a logical extension. + */ + public const ID = 'AU-TAS-SOU-SE'; + + public $timezone = 'Australia/Hobart'; + + /** + * Initialize holidays for southeastern Tasmania (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->removeHoliday('recreationDay'); + $this->calculateHobartRegatta(); + } + + /** + * Royal Hobart Regatta + * + * @throws \Exception + */ + public function calculateHobartRegatta(): void + { + $this->calculateHoliday( + 'hobartRegatta', + ['en_AU' => 'Royal Hobart Regatta'], + new DateTime('second monday of february ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } +} diff --git a/src/Yasumi/Provider/Australia/Victoria.php b/src/Yasumi/Provider/Australia/Victoria.php index f47c68afa..7c2a87af1 100644 --- a/src/Yasumi/Provider/Australia/Victoria.php +++ b/src/Yasumi/Provider/Australia/Victoria.php @@ -2,16 +2,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Australia; +use DateInterval; use DateTime; use DateTimeZone; use Yasumi\Holiday; @@ -27,7 +28,9 @@ class Victoria extends Australia * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'AU-VIC'; + public const ID = 'AU-VIC'; + + public $timezone = 'Australia/Victoria'; /** * Initialize holidays for Victoria (Australia). @@ -36,10 +39,12 @@ class Victoria extends Australia * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); + $this->addHoliday($this->easterSunday($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->easterSaturday($this->year, $this->timezone, $this->locale)); $this->calculateLabourDay(); $this->calculateQueensBirthday(); $this->calculateMelbourneCupDay(); @@ -47,32 +52,35 @@ public function initialize() } /** + * Labour Day + * * @throws \Exception */ - public function calculateChristmasDay() - { - $christmasDay = new DateTime("$this->year-12-25", new DateTimeZone($this->timezone)); - $boxingDay = new DateTime("$this->year-12-26", new DateTimeZone($this->timezone)); - - $this->calculateHoliday('christmasDay', [], $christmasDay); - $this->calculateHoliday('secondChristmasDay', [], $boxingDay, false); - } - - public function calculateLabourDay() + public function calculateLabourDay(): void { $date = new DateTime("second monday of march $this->year", new DateTimeZone($this->timezone)); - $this->addHoliday(new Holiday('labourDay', [], $date, $this->locale)); + $this->addHoliday(new Holiday('labourDay', ['en_AU' => 'Labour Day'], $date, $this->locale)); } - public function calculateMelbourneCupDay() + /** + * Melbourne Cup Day + * + * @throws \Exception + */ + public function calculateMelbourneCupDay(): void { $date = new DateTime('first Tuesday of November' . " $this->year", new DateTimeZone($this->timezone)); $this->addHoliday(new Holiday('melbourneCup', ['en_AU' => 'Melbourne Cup'], $date, $this->locale)); } - public function calculateAFLGrandFinalDay() + /** + * AFL Grand Final Day + * + * @throws \Exception + */ + public function calculateAFLGrandFinalDay(): void { switch ($this->year) { case 2015: @@ -81,6 +89,12 @@ public function calculateAFLGrandFinalDay() case 2016: $aflGrandFinalFriday = '2016-09-30'; break; + case 2017: + $aflGrandFinalFriday = '2017-09-29'; + break; + case 2018: + $aflGrandFinalFriday = '2018-09-28'; + break; default: return; } @@ -94,4 +108,94 @@ public function calculateAFLGrandFinalDay() $this->locale )); } + + /** + * Queens Birthday. + * + * The Queen's Birthday is an Australian public holiday but the date varies across + * states and territories. Australia celebrates this holiday because it is a constitutional + * monarchy, with the English monarch as head of state. + * + * Her actual birthday is on April 21, but it's celebrated as a public holiday on the second Monday of June. + * (Except QLD & WA) + * + * @link https://www.timeanddate.com/holidays/australia/queens-birthday + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function calculateQueensBirthday(): void + { + $this->calculateHoliday( + 'queensBirthday', + ['en_AU' => 'Queen\'s Birthday'], + new DateTime('second monday of june ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } + + /** + * Easter Saturday. + * + * Easter is a festival and holiday celebrating the resurrection of Jesus Christ from the dead. Easter is celebrated + * on a date based on a certain number of days after March 21st. The date of Easter Day was defined by the Council + * of Nicaea in AD325 as the Sunday after the first full moon which falls on or after the Spring Equinox. + * + * @link http://en.wikipedia.org/wiki/Easter + * + * @param int $year the year for which Easter Saturday need to be created + * @param string $timezone the timezone in which Easter Saturday is celebrated + * @param string $locale the locale for which Easter Saturday need to be displayed in. + * @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE, + * TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered. + * + * @return \Yasumi\Holiday + * + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function easterSaturday($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL): Holiday + { + return new Holiday( + 'easterSaturday', + ['en_AU' => 'Easter Saturday'], + $this->calculateEaster($year, $timezone)->sub(new DateInterval('P1D')), + $locale, + $type + ); + } + + /** + * Easter Sunday. + * + * Easter is a festival and holiday celebrating the resurrection of Jesus Christ from the dead. Easter is celebrated + * on a date based on a certain number of days after March 21st. The date of Easter Day was defined by the Council + * of Nicaea in AD325 as the Sunday after the first full moon which falls on or after the Spring Equinox. + * + * @link http://en.wikipedia.org/wiki/Easter + * + * @param int $year the year for which Easter Saturday need to be created + * @param string $timezone the timezone in which Easter Saturday is celebrated + * @param string $locale the locale for which Easter Saturday need to be displayed in. + * @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE, + * TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered. + * + * @return \Yasumi\Holiday + * + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function easterSunday($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL): Holiday + { + return new Holiday( + 'easter', + ['en_AU' => 'Easter Sunday'], + $this->calculateEaster($year, $timezone), + $locale, + $type + ); + } } diff --git a/src/Yasumi/Provider/Australia/WA.php b/src/Yasumi/Provider/Australia/WA.php new file mode 100644 index 000000000..de7dd89b6 --- /dev/null +++ b/src/Yasumi/Provider/Australia/WA.php @@ -0,0 +1,124 @@ + + */ + +namespace Yasumi\Provider\Australia; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\Provider\Australia; + +/** + * Provider for all holidays in Western Australia (Australia). + * + */ +class WA extends Australia +{ + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. + */ + public const ID = 'AU-WA'; + + public $timezone = 'Australia/West'; + + /** + * Initialize holidays for Western Australia (Australia). + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->calculateQueensBirthday(); + $this->calculateLabourDay(); + $this->calculateWesternAustraliaDay(); + } + + /** + * Labour Day + * + * @throws \Exception + */ + public function calculateLabourDay(): void + { + $date = new DateTime("first monday of march $this->year", new DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('labourDay', [], $date, $this->locale)); + } + + /** + * Western Australia Day + * + * @link https://en.wikipedia.org/wiki/Western_Australia_Day + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function calculateWesternAustraliaDay(): void + { + $this->calculateHoliday( + 'westernAustraliaDay', + ['en_AU' => 'Western Australia Day'], + new DateTime('first monday of june ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } + + /** + * Queens Birthday. + * + * The Queen's Birthday is an Australian public holiday but the date varies across + * states and territories. Australia celebrates this holiday because it is a constitutional + * monarchy, with the English monarch as head of state. + * + * Her actual birthday is on April 21, but it's celebrated as a public holiday on the second Monday of June. + * (Except QLD & WA) + * + * @link https://www.timeanddate.com/holidays/australia/queens-birthday + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function calculateQueensBirthday(): void + { + if ($this->year === 2011) { + $this->calculateHoliday( + 'queensBirthday', + ['en_AU' => "Queen's Birthday"], + new DateTime('2011-10-28', new DateTimeZone($this->timezone)), + false, + false + ); + } elseif ($this->year === 2012) { + $this->calculateHoliday( + 'queensBirthday', + ['en_AU' => "Queen's Birthday"], + new DateTime('2012-10-01', new DateTimeZone($this->timezone)), + false, + false + ); + } else { + $this->calculateHoliday( + 'queensBirthday', + ['en_AU' => "Queen's Birthday"], + new DateTime('last monday of september ' . $this->year, new DateTimeZone($this->timezone)), + false, + false + ); + } + } +} diff --git a/src/Yasumi/Provider/Austria.php b/src/Yasumi/Provider/Austria.php index a246c68f8..aaccc065d 100644 --- a/src/Yasumi/Provider/Austria.php +++ b/src/Yasumi/Provider/Austria.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -27,16 +27,17 @@ class Austria extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'AT'; + public const ID = 'AT'; /** * Initialize holidays for Austria. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Vienna'; @@ -72,10 +73,12 @@ public function initialize() * * @link https://en.wikipedia.org/wiki/Declaration_of_Neutrality * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateNationalDay() + public function calculateNationalDay(): void { if ($this->year < 1955) { return; diff --git a/src/Yasumi/Provider/Belgium.php b/src/Yasumi/Provider/Belgium.php index d22cf502e..9444f06fb 100755 --- a/src/Yasumi/Provider/Belgium.php +++ b/src/Yasumi/Provider/Belgium.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -27,16 +27,17 @@ class Belgium extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'BE'; + public const ID = 'BE'; /** * Initialize holidays for Belgium. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Brussels'; diff --git a/src/Yasumi/Provider/Bosnia.php b/src/Yasumi/Provider/Bosnia.php new file mode 100644 index 000000000..d90f7e44b --- /dev/null +++ b/src/Yasumi/Provider/Bosnia.php @@ -0,0 +1,99 @@ + + */ + +namespace Yasumi\Provider; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; + +/** + * Provider for all holidays in Bosnia. + * + * @author Adnan Kičin + */ +class Bosnia extends AbstractProvider +{ + use CommonHolidays, ChristianHolidays; + + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. + */ + public const ID = 'BA'; + + /** + * Initialize holidays for Bosnia. + * + * @throws \Yasumi\Exception\InvalidDateException + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + $this->timezone = 'Europe/Sarajevo'; + + // Add common holidays + $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->internationalWorkersDay($this->year, $this->timezone, $this->locale)); + + // Add Catholic holidays + $this->addHoliday($this->easter($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale)); + + // Add Orthodox holidays + + $this->addHoliday(new Holiday('orthodoxChristmasDay', [ + 'en_US' => 'Orthodox Christmas Day', + 'bs_Latn_BA' => 'Pravoslavni Božić' + ], new \DateTime("{$this->year}-01-07", new \DateTimeZone($this->timezone)))); + + + /** + * Independence Day + */ + if ($this->year >= 1992) { + $this->addHoliday(new Holiday('independenceDay', [ + 'en_US' => 'Independence Day', + 'bs_Latn_BA' => 'Dan Nezavisnosti' + ], new DateTime("$this->year-3-1", new DateTimeZone($this->timezone)), $this->locale)); + } + + /** + * Bosnian Statehood Day + */ + if ($this->year >= 1943) { + $this->addHoliday(new Holiday('statehoodDay', [ + 'en_US' => 'Statehood Day', + 'bs_Latn_BA' => 'Dan državnosti' + ], new DateTime("$this->year-11-25", new DateTimeZone($this->timezone)), $this->locale)); + } + + /** + * Day after New Years Day + */ + $this->addHoliday(new Holiday('dayAfterNewYearsDay', [ + 'en_US' => 'Day after New Year\'s Day', + 'ro_RO' => 'Nova godina - drugi dan' + ], new DateTime("$this->year-01-02", new DateTimeZone($this->timezone)), $this->locale)); + + /** + * Second Labour day + */ + $this->addHoliday(new Holiday('secondLabourDay', [ + 'en_US' => 'Second Labour Day', + 'ro_RO' => 'Praznik rada - drugi dan' + ], new DateTime("$this->year-05-02", new DateTimeZone($this->timezone)), $this->locale)); + } +} diff --git a/src/Yasumi/Provider/Brazil.php b/src/Yasumi/Provider/Brazil.php index 192423ae1..278e3f973 100644 --- a/src/Yasumi/Provider/Brazil.php +++ b/src/Yasumi/Provider/Brazil.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -28,16 +28,17 @@ class Brazil extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'BR'; + public const ID = 'BR'; /** * Initialize holidays for Brazil. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'America/Fortaleza'; diff --git a/src/Yasumi/Provider/ChristianHolidays.php b/src/Yasumi/Provider/ChristianHolidays.php index 637f38e45..aa1743788 100644 --- a/src/Yasumi/Provider/ChristianHolidays.php +++ b/src/Yasumi/Provider/ChristianHolidays.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -42,10 +42,12 @@ trait ChristianHolidays * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function easter($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) + public function easter(int $year, string $timezone, string $locale, string $type = Holiday::TYPE_OFFICIAL): Holiday { return new Holiday('easter', [], $easter = $this->calculateEaster($year, $timezone), $locale, $type); } @@ -67,12 +69,17 @@ public function easter($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException * @throws \Exception */ - public function easterMonday($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function easterMonday( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'easterMonday', [], @@ -99,12 +106,17 @@ public function easterMonday($year, $timezone, $locale, $type = Holiday::TYPE_OF * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException * @throws \Exception */ - public function ascensionDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function ascensionDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'ascensionDay', [], @@ -128,12 +140,17 @@ public function ascensionDay($year, $timezone, $locale, $type = Holiday::TYPE_OF * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException * @throws \Exception */ - public function pentecost($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function pentecost( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'pentecost', [], @@ -157,12 +174,17 @@ public function pentecost($year, $timezone, $locale, $type = Holiday::TYPE_OFFIC * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException * @throws \Exception */ - public function pentecostMonday($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function pentecostMonday( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'pentecostMonday', [], @@ -189,12 +211,17 @@ public function pentecostMonday($year, $timezone, $locale, $type = Holiday::TYPE * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException * @throws \Exception */ - public function corpusChristi($year, $timezone, $locale, $type = Holiday::TYPE_OTHER) - { + public function corpusChristi( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OTHER + ): Holiday { return new Holiday( 'corpusChristi', [], @@ -222,11 +249,17 @@ public function corpusChristi($year, $timezone, $locale, $type = Holiday::TYPE_O * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function christmasEve($year, $timezone, $locale, $type = Holiday::TYPE_OBSERVANCE) - { + public function christmasEve( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OBSERVANCE + ): Holiday { return new Holiday( 'christmasEve', [], @@ -251,11 +284,17 @@ public function christmasEve($year, $timezone, $locale, $type = Holiday::TYPE_OB * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function christmasDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function christmasDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'christmasDay', [], @@ -280,11 +319,17 @@ public function christmasDay($year, $timezone, $locale, $type = Holiday::TYPE_OF * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function secondChristmasDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function secondChristmasDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'secondChristmasDay', [], @@ -312,11 +357,17 @@ public function secondChristmasDay($year, $timezone, $locale, $type = Holiday::T * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function allSaintsDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function allSaintsDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday('allSaintsDay', [], new DateTime("$year-11-1", new DateTimeZone($timezone)), $locale, $type); } @@ -337,11 +388,17 @@ public function allSaintsDay($year, $timezone, $locale, $type = Holiday::TYPE_OF * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function assumptionOfMary($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function assumptionOfMary( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'assumptionOfMary', [], @@ -366,12 +423,17 @@ public function assumptionOfMary($year, $timezone, $locale, $type = Holiday::TYP * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException * @throws \Exception */ - public function goodFriday($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function goodFriday( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'goodFriday', [], @@ -400,11 +462,17 @@ public function goodFriday($year, $timezone, $locale, $type = Holiday::TYPE_OFFI * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function epiphany($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function epiphany( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday('epiphany', [], new DateTime("$year-1-6", new DateTimeZone($timezone)), $locale, $type); } @@ -425,12 +493,17 @@ public function epiphany($year, $timezone, $locale, $type = Holiday::TYPE_OFFICI * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException * @throws \Exception */ - public function ashWednesday($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function ashWednesday( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'ashWednesday', [], @@ -458,11 +531,17 @@ public function ashWednesday($year, $timezone, $locale, $type = Holiday::TYPE_OF * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function immaculateConception($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function immaculateConception( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'immaculateConception', [], @@ -491,11 +570,17 @@ public function immaculateConception($year, $timezone, $locale, $type = Holiday: * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function stStephensDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function stStephensDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'stStephensDay', [], @@ -524,11 +609,17 @@ public function stStephensDay($year, $timezone, $locale, $type = Holiday::TYPE_O * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function stJosephsDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function stJosephsDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday('stJosephsDay', [], new DateTime("$year-3-19", new DateTimeZone($timezone)), $locale, $type); } @@ -550,12 +641,17 @@ public function stJosephsDay($year, $timezone, $locale, $type = Holiday::TYPE_OF * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException * @throws \Exception */ - public function maundyThursday($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function maundyThursday( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'maundyThursday', [], @@ -583,11 +679,17 @@ public function maundyThursday($year, $timezone, $locale, $type = Holiday::TYPE_ * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function stGeorgesDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function stGeorgesDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday('stGeorgesDay', [], new DateTime("$year-4-23", new DateTimeZone($timezone)), $locale, $type); } @@ -610,11 +712,17 @@ public function stGeorgesDay($year, $timezone, $locale, $type = Holiday::TYPE_OF * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function stJohnsDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function stJohnsDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday('stJohnsDay', [], new DateTime("$year-06-24", new DateTimeZone($timezone)), $locale, $type); } @@ -637,11 +745,17 @@ public function stJohnsDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFI * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function annunciation($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function annunciation( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'annunciation', [], @@ -657,20 +771,20 @@ public function annunciation($year, $timezone, $locale, $type = Holiday::TYPE_OF * @param int $year the year for which Easter needs to be calculated * @param string $timezone the timezone in which Easter is celebrated * - * @return \Datetime date of Orthodox Easter + * @return \DateTime date of Orthodox Easter * * @link http://php.net/manual/en/function.easter-date.php#83794 * @link https://en.wikipedia.org/wiki/Computus#Adaptation_for_Western_Easter_of_Meeus.27_Julian_algorithm * @throws \Exception */ - public function calculateOrthodoxEaster($year, $timezone) + public function calculateOrthodoxEaster(int $year, string $timezone): \DateTime { $a = $year % 4; $b = $year % 7; $c = $year % 19; $d = (19 * $c + 15) % 30; $e = (2 * $a + 4 * $b - $d + 34) % 7; - $month = floor(($d + $e + 114) / 31); + $month = \floor(($d + $e + 114) / 31); $day = (($d + $e + 114) % 31) + 1; return (new DateTime("$year-$month-$day", new DateTimeZone($timezone)))->add(new DateInterval('P13D')); @@ -699,11 +813,17 @@ public function calculateOrthodoxEaster($year, $timezone) * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function reformationDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function reformationDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'reformationDay', [], @@ -737,9 +857,9 @@ public function reformationDay($year, $timezone, $locale, $type = Holiday::TYPE_ * @return \DateTime date of Easter * @throws \Exception */ - protected function calculateEaster($year, $timezone) + protected function calculateEaster(int $year, string $timezone): DateTime { - if (extension_loaded('calendar')) { + if (\extension_loaded('calendar')) { $easter_days = \easter_days($year); } else { $golden = ($year % 19) + 1; // The Golden Number diff --git a/src/Yasumi/Provider/CommonHolidays.php b/src/Yasumi/Provider/CommonHolidays.php index e818c6517..ed7703844 100644 --- a/src/Yasumi/Provider/CommonHolidays.php +++ b/src/Yasumi/Provider/CommonHolidays.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -23,6 +23,38 @@ */ trait CommonHolidays { + /** + * New Year's Eve. + * + * New Year's Eve is observed on December 31, the last day of the year on the modern Gregorian calendar as well as + * the Julian calendar. In present day, with most countries now using the Gregorian calendar as their de facto + * calendar, New Year's Eve is probably the most celebrated holiday, often observed with fireworks at the stroke of + * midnight as the new year starts in each time zone. + * + * @link http://en.wikipedia.org/wiki/New_Year%27s_Eve + * + * @param int $year the year for which New Year's Eve need to be created + * @param string $timezone the timezone in which New Year's Eve is celebrated + * @param string $locale the locale for which New Year's Eve need to be displayed in. + * @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE, + * TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered. + * + * @return \Yasumi\Holiday + * + * @throws \Yasumi\Exception\InvalidDateException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function newYearsEve( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { + return new Holiday('newYearsEve', [], new DateTime("$year-12-31", new DateTimeZone($timezone)), $locale, $type); + } + /** * New Year's Day. * @@ -43,11 +75,17 @@ trait CommonHolidays * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function newYearsDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function newYearsDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday('newYearsDay', [], new DateTime("$year-1-1", new DateTimeZone($timezone)), $locale, $type); } @@ -70,11 +108,17 @@ public function newYearsDay($year, $timezone, $locale, $type = Holiday::TYPE_OFF * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function internationalWorkersDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function internationalWorkersDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'internationalWorkersDay', [], @@ -103,11 +147,17 @@ public function internationalWorkersDay($year, $timezone, $locale, $type = Holid * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function valentinesDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function valentinesDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'valentinesDay', [], @@ -134,11 +184,17 @@ public function valentinesDay($year, $timezone, $locale, $type = Holiday::TYPE_O * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function worldAnimalDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function worldAnimalDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'worldAnimalDay', [], @@ -167,11 +223,17 @@ public function worldAnimalDay($year, $timezone, $locale, $type = Holiday::TYPE_ * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function stMartinsDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function stMartinsDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'stMartinsDay', [], @@ -199,11 +261,17 @@ public function stMartinsDay($year, $timezone, $locale, $type = Holiday::TYPE_OF * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function fathersDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function fathersDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'fathersDay', [], @@ -231,11 +299,17 @@ public function fathersDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFI * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function mothersDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function mothersDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'mothersDay', [], @@ -263,11 +337,17 @@ public function mothersDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFI * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function victoryInEuropeDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function victoryInEuropeDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'victoryInEuropeDay', [], @@ -297,11 +377,17 @@ public function victoryInEuropeDay($year, $timezone, $locale, $type = Holiday::T * * @return \Yasumi\Holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException + * @throws \Exception */ - public function armisticeDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL) - { + public function armisticeDay( + int $year, + string $timezone, + string $locale, + string $type = Holiday::TYPE_OFFICIAL + ): Holiday { return new Holiday( 'armisticeDay', [], @@ -310,4 +396,112 @@ public function armisticeDay($year, $timezone, $locale, $type = Holiday::TYPE_OF $type ); } + + /** + * Calculates daylight saving time transitions. + * + * Daylight saving time is the practice of advancing clocks by one hour during summer months so evening daylight + * lasts even longer, while sacrificing normal sunrise times. + * + * The date of transition between standard time and daylight saving time differs from country to country and + * sometimes from year to year. Most countries outside Europe and North America do not observe daylight saving + * time. + * + * On the northern hemisphere, summer time starts around March/April. On the southern hemisphere it happens 6 + * months later. + * + * @param int $year the year for which Easter needs to be calculated + * @param string $timezone the timezone in which Easter is celebrated + * @param bool $summer whether to calculate the start of summer or winter time + * + * @return \DateTime|null A DateTime object representing the summer or winter transition time for the given + * timezone. If no transition time is found, a null value is returned. + * @throws \Exception + */ + protected function calculateSummerWinterTime($year, $timezone, $summer): ?DateTime + { + $zone = new DateTimeZone($timezone); + + $transitions = $zone->getTransitions(\mktime(0, 0, 0, 1, 1, $year), \mktime(23, 59, 59, 12, 31, $year)); + + $transition = \array_shift($transitions); + $dst = $transition['isdst']; + + foreach ($transitions as $transition) { + if ($transition['isdst'] !== $dst && $transition['isdst'] === $summer) { + return new DateTime(\substr($transition['time'], 0, 10), $zone); + } + $dst = $transition['isdst']; + } + + return null; + } + + /** + * The beginning of summer time. + * + * Summer time is also known as daylight save time. + * + * @param int $year the year for which summer time need to be created + * @param string $timezone the timezone in which summer time transition occurs + * @param string $locale the locale for which summer time need to be displayed in. + * @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE, + * TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered. + * + * @return \Yasumi\Holiday|null + * + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function summerTime($year, $timezone, $locale, $type = Holiday::TYPE_SEASON): ?Holiday + { + $date = $this->calculateSummerWinterTime($year, $timezone, true); + + if ($date) { + return new Holiday( + 'summerTime', + [], + $date, + $locale, + $type + ); + } + + return null; + } + + /** + * The beginning of winter time. + * + * Winter time is also known as standard time. + * + * @param int $year the year for which summer time need to be created + * @param string $timezone the timezone in which summer time transition occurs + * @param string $locale the locale for which summer time need to be displayed in. + * @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE, + * TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered. + * + * @return \Yasumi\Holiday|null + * + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function winterTime($year, $timezone, $locale, $type = Holiday::TYPE_SEASON): ?Holiday + { + $date = $this->calculateSummerWinterTime($year, $timezone, false); + + if ($date) { + return new Holiday( + 'winterTime', + [], + $date, + $locale, + $type + ); + } + + return null; + } } diff --git a/src/Yasumi/Provider/Croatia.php b/src/Yasumi/Provider/Croatia.php index 8a5e3cce5..33fe4b984 100644 --- a/src/Yasumi/Provider/Croatia.php +++ b/src/Yasumi/Provider/Croatia.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -29,16 +29,17 @@ class Croatia extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'HR'; + public const ID = 'HR'; /** * Initialize holidays for Croatia. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Zagreb'; diff --git a/src/Yasumi/Provider/CzechRepublic.php b/src/Yasumi/Provider/CzechRepublic.php index 566e2d730..40c489242 100644 --- a/src/Yasumi/Provider/CzechRepublic.php +++ b/src/Yasumi/Provider/CzechRepublic.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -30,16 +30,17 @@ class CzechRepublic extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CZ'; + public const ID = 'CZ'; /** * Initialize holidays for the Czech Republic. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Prague'; @@ -74,10 +75,12 @@ public function initialize() * @see https://en.wikipedia.org/wiki/Saints_Cyril_and_Methodius * @see https://en.wikipedia.org/wiki/Public_holidays_in_the_Czech_Republic * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateSaintsCyrilAndMethodiusDay() + public function calculateSaintsCyrilAndMethodiusDay(): void { $this->addHoliday(new Holiday( 'saintsCyrilAndMethodiusDay', @@ -97,10 +100,12 @@ public function calculateSaintsCyrilAndMethodiusDay() * @see https://en.wikipedia.org/wiki/Jan_Hus * @see https://en.wikipedia.org/wiki/Public_holidays_in_the_Czech_Republic * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateJanHusDay() + public function calculateJanHusDay(): void { $this->addHoliday(new Holiday( 'janHusDay', @@ -123,10 +128,12 @@ public function calculateJanHusDay() * @see https://en.wikipedia.org/wiki/Wenceslaus_I,_Duke_of_Bohemia * @see https://en.wikipedia.org/wiki/Public_holidays_in_the_Czech_Republic * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateCzechStatehoodDay() + public function calculateCzechStatehoodDay(): void { $this->addHoliday(new Holiday( 'czechStateHoodDay', @@ -141,10 +148,12 @@ public function calculateCzechStatehoodDay() * * @see https://en.wikipedia.org/wiki/Public_holidays_in_the_Czech_Republic * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateIndependentCzechoslovakStateDay() + public function calculateIndependentCzechoslovakStateDay(): void { $this->addHoliday(new Holiday('independentCzechoslovakStateDay', [ 'cs_CZ' => 'Den vzniku samostatného československého státu', @@ -157,10 +166,12 @@ public function calculateIndependentCzechoslovakStateDay() * * @see https://en.wikipedia.org/wiki/Public_holidays_in_the_Czech_Republic * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateStruggleForFreedomAndDemocracyDay() + public function calculateStruggleForFreedomAndDemocracyDay(): void { $this->addHoliday(new Holiday( 'struggleForFreedomAndDemocracyDay', diff --git a/src/Yasumi/Provider/Denmark.php b/src/Yasumi/Provider/Denmark.php index 5bcc6c49b..c1146fbcc 100644 --- a/src/Yasumi/Provider/Denmark.php +++ b/src/Yasumi/Provider/Denmark.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -28,16 +28,17 @@ class Denmark extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DK'; + public const ID = 'DK'; /** * Initialize holidays for Denmark. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Copenhagen'; @@ -54,9 +55,21 @@ public function initialize() $this->addHoliday($this->pentecostMonday($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)); - - // Calculate other holidays $this->calculateGreatPrayerDay(); + + $this->addHoliday($this->internationalWorkersDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OBSERVANCE)); + $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 !== null) { + $this->addHoliday($summerTime); + } + $winterTime = $this->winterTime($this->year, $this->timezone, $this->locale); + if ($winterTime !== null) { + $this->addHoliday($winterTime); + } } /** @@ -70,21 +83,51 @@ public function initialize() * * @link https://en.wikipedia.org/wiki/Store_Bededag * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateGreatPrayerDay() + public function calculateGreatPrayerDay(): void { $easter = $this->calculateEaster($this->year, $this->timezone)->format('Y-m-d'); if ($this->year >= 1686) { $this->addHoliday(new Holiday( 'greatPrayerDay', - ['da_DK' => 'Store Bededag'], + ['da_DK' => 'Store bededag'], new DateTime("fourth friday $easter", new DateTimeZone($this->timezone)), $this->locale )); } } + + /** + * Constitution Day + * + * Denmark’s Constitution Day is June 5 and commemorates the signing of Denmark's constitution + * on June 5 1849, when Denmark peacefully became as a constitutional monarchy. + * + * While not a public holiday, some companies and public offices are closed. Traditionally, + * members of parliament gives political speeches around the country. + * + * @link https://en.wikipedia.org/wiki/Constitution_Day_(Denmark) + * + * @throws \Yasumi\Exception\InvalidDateException + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function calculateConstitutionDay(): void + { + if ($this->year >= 1849) { + $this->addHoliday(new Holiday( + 'constitutionDay', + ['da_DK' => 'Grundlovsdag'], + new DateTime("$this->year-6-5", new DateTimeZone($this->timezone)), + $this->locale, + Holiday::TYPE_OBSERVANCE + )); + } + } } diff --git a/src/Yasumi/Provider/Estonia.php b/src/Yasumi/Provider/Estonia.php index bad66c457..5fab5188d 100644 --- a/src/Yasumi/Provider/Estonia.php +++ b/src/Yasumi/Provider/Estonia.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -24,17 +24,17 @@ class Estonia extends AbstractProvider { use CommonHolidays, ChristianHolidays; - const DECLARATION_OF_INDEPENDENCE_YEAR = 1918; + public const DECLARATION_OF_INDEPENDENCE_YEAR = 1918; - const VICTORY_DAY_START_YEAR = 1934; + public const VICTORY_DAY_START_YEAR = 1934; - const RESTORATION_OF_INDEPENDENCE_YEAR = 1991; + public const RESTORATION_OF_INDEPENDENCE_YEAR = 1991; /** * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'EE'; + public const ID = 'EE'; /** * Initialize holidays for Estonia. @@ -42,7 +42,7 @@ class Estonia extends AbstractProvider * @throws \InvalidArgumentException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Tallinn'; @@ -63,8 +63,9 @@ public function initialize() /** * @throws \InvalidArgumentException + * @throws \Exception */ - private function addIndependenceDay() + private function addIndependenceDay(): void { if ($this->year >= self::DECLARATION_OF_INDEPENDENCE_YEAR) { $this->addHoliday(new Holiday('independenceDay', [ @@ -76,8 +77,9 @@ private function addIndependenceDay() /** * @throws \InvalidArgumentException + * @throws \Exception */ - private function addVictoryDay() + private function addVictoryDay(): void { if ($this->year >= self::VICTORY_DAY_START_YEAR) { $this->addHoliday(new Holiday('victoryDay', [ @@ -89,8 +91,9 @@ private function addVictoryDay() /** * @throws \InvalidArgumentException + * @throws \Exception */ - private function addRestorationOfIndependenceDay() + private function addRestorationOfIndependenceDay(): void { if ($this->year >= self::RESTORATION_OF_INDEPENDENCE_YEAR) { $this->addHoliday(new Holiday('restorationOfIndependenceDay', [ diff --git a/src/Yasumi/Provider/Finland.php b/src/Yasumi/Provider/Finland.php index 5506b5cf5..4ecaa0b84 100644 --- a/src/Yasumi/Provider/Finland.php +++ b/src/Yasumi/Provider/Finland.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -28,16 +28,17 @@ class Finland extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'FI'; + public const ID = 'FI'; /** * Initialize holidays for Finland. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Helsinki'; @@ -76,10 +77,12 @@ public function initialize() * * @link https://en.wikipedia.org/wiki/Midsummer#Finland * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateStJohnsDay() + public function calculateStJohnsDay(): void { $translation = ['fi_FI' => 'Juhannuspäivä']; $shortName = 'stJohnsDay'; @@ -118,11 +121,12 @@ public function calculateStJohnsDay() * @link https://en.wikipedia.org/wiki/All_Saints%27_Day * @link https://fi.wikipedia.org/wiki/Pyh%C3%A4inp%C3%A4iv%C3%A4 * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - private function calculateAllSaintsDay() + private function calculateAllSaintsDay(): void { $date = new DateTime("$this->year-10-31", new DateTimeZone($this->timezone)); @@ -150,10 +154,12 @@ private function calculateAllSaintsDay() * * @link https://en.wikipedia.org/wiki/Independence_Day_(Finland) * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateIndependenceDay() + public function calculateIndependenceDay(): void { if ($this->year >= 1917) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/France.php b/src/Yasumi/Provider/France.php index 2833a4f50..ed3603238 100755 --- a/src/Yasumi/Provider/France.php +++ b/src/Yasumi/Provider/France.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -27,16 +27,17 @@ class France extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'FR'; + public const ID = 'FR'; /** * Initialize holidays for France. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Paris'; @@ -76,10 +77,12 @@ public function initialize() * * @link http://en.wikipedia.org/wiki/Bastille_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateBastilleDay() + public function calculateBastilleDay(): void { if ($this->year >= 1790) { $this->addHoliday(new Holiday('bastilleDay', [ diff --git a/src/Yasumi/Provider/France/BasRhin.php b/src/Yasumi/Provider/France/BasRhin.php index 8fb0e341b..4642c5281 100755 --- a/src/Yasumi/Provider/France/BasRhin.php +++ b/src/Yasumi/Provider/France/BasRhin.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\France; @@ -32,16 +32,17 @@ class BasRhin extends France * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'FR-67'; + public const ID = 'FR-67'; /** * Initialize holidays for Bas-Rhin (France). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/France/HautRhin.php b/src/Yasumi/Provider/France/HautRhin.php index d51c2bac9..9154631ef 100755 --- a/src/Yasumi/Provider/France/HautRhin.php +++ b/src/Yasumi/Provider/France/HautRhin.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\France; @@ -32,16 +32,17 @@ class HautRhin extends France * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'FR-68'; + public const ID = 'FR-68'; /** * Initialize holidays for Haut-Rhin (France). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/France/Moselle.php b/src/Yasumi/Provider/France/Moselle.php index c9ca9f259..12cf57422 100755 --- a/src/Yasumi/Provider/France/Moselle.php +++ b/src/Yasumi/Provider/France/Moselle.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\France; @@ -33,16 +33,17 @@ class Moselle extends France * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'FR-57'; + public const ID = 'FR-57'; /** * Initialize holidays for Moselle (France). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Germany.php b/src/Yasumi/Provider/Germany.php index 94952ec93..cde6e1b94 100644 --- a/src/Yasumi/Provider/Germany.php +++ b/src/Yasumi/Provider/Germany.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -27,16 +27,17 @@ class Germany extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE'; + public const ID = 'DE'; /** * Initialize holidays for Germany. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Berlin'; @@ -46,12 +47,10 @@ public function initialize() // Add common Christian holidays (common in Germany) $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale)); $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale)); - $this->addHoliday($this->easter($this->year, $this->timezone, $this->locale)); $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale)); $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale)); $this->addHoliday($this->internationalWorkersDay($this->year, $this->timezone, $this->locale)); $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale)); - $this->addHoliday($this->pentecost($this->year, $this->timezone, $this->locale)); $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale)); $this->addHoliday($this->secondChristmasDay($this->year, $this->timezone, $this->locale)); @@ -76,10 +75,12 @@ public function initialize() * * @link https://en.wikipedia.org/wiki/German_Unity_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateGermanUnityDay() + public function calculateGermanUnityDay(): void { if ($this->year >= 1990) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Germany/BadenWurttemberg.php b/src/Yasumi/Provider/Germany/BadenWurttemberg.php index e379afcb5..593ee50fc 100755 --- a/src/Yasumi/Provider/Germany/BadenWurttemberg.php +++ b/src/Yasumi/Provider/Germany/BadenWurttemberg.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -30,16 +30,17 @@ class BadenWurttemberg extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-BW'; + public const ID = 'DE-BW'; /** * Initialize holidays for Baden-Württemberg (Germany). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Germany/Bavaria.php b/src/Yasumi/Provider/Germany/Bavaria.php index 9da8454e2..1a97df3ca 100755 --- a/src/Yasumi/Provider/Germany/Bavaria.php +++ b/src/Yasumi/Provider/Germany/Bavaria.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -31,16 +31,17 @@ class Bavaria extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-BY'; + public const ID = 'DE-BY'; /** * Initialize holidays for Bavaria (Germany). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Germany/Berlin.php b/src/Yasumi/Provider/Germany/Berlin.php index 6469adfad..f0f5f8e60 100755 --- a/src/Yasumi/Provider/Germany/Berlin.php +++ b/src/Yasumi/Provider/Germany/Berlin.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -30,5 +30,5 @@ class Berlin extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-BE'; + public const ID = 'DE-BE'; } diff --git a/src/Yasumi/Provider/Germany/Brandenburg.php b/src/Yasumi/Provider/Germany/Brandenburg.php index 2d612bc06..f405f2330 100755 --- a/src/Yasumi/Provider/Germany/Brandenburg.php +++ b/src/Yasumi/Provider/Germany/Brandenburg.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -29,19 +29,24 @@ class Brandenburg extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-BB'; + public const ID = 'DE-BB'; /** * Initialize holidays for Brandenburg (Germany). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); + // Add specific Christian holidays + $this->addHoliday($this->easter($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->pentecost($this->year, $this->timezone, $this->locale)); + // Add custom Christian holidays $this->calculateReformationDay(); } @@ -50,10 +55,12 @@ public function initialize() * For the German state of Brandenburg, Reformation Day was celebrated since 1517. * Note: In 2017 all German states will celebrate Reformation Day for its 500th anniversary. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - private function calculateReformationDay() + private function calculateReformationDay(): void { if ($this->year < 1517) { return; diff --git a/src/Yasumi/Provider/Germany/Bremen.php b/src/Yasumi/Provider/Germany/Bremen.php index 3e37353be..5f4fc9ae7 100755 --- a/src/Yasumi/Provider/Germany/Bremen.php +++ b/src/Yasumi/Provider/Germany/Bremen.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -29,5 +29,38 @@ class Bremen extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-HB'; + public const ID = 'DE-HB'; + + /** + * Initialize holidays for Bremen (Germany). + * + * @throws \Yasumi\Exception\InvalidDateException + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + // Add custom Christian holidays + $this->calculateReformationDay(); + } + + /** + * For the German state of Bremen, Reformation Day is celebrated since 2018. + * Note: In 2017 all German states will celebrate Reformation Day for its 500th anniversary. + * + * @throws \Yasumi\Exception\InvalidDateException + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + private function calculateReformationDay(): void + { + if ($this->year < 2018) { + return; + } + $this->addHoliday($this->reformationDay($this->year, $this->timezone, $this->locale)); + } } diff --git a/src/Yasumi/Provider/Germany/Hamburg.php b/src/Yasumi/Provider/Germany/Hamburg.php index ab4e2ef45..fa484c5ff 100755 --- a/src/Yasumi/Provider/Germany/Hamburg.php +++ b/src/Yasumi/Provider/Germany/Hamburg.php @@ -2,16 +2,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; +use Yasumi\Holiday; use Yasumi\Provider\Germany; /** @@ -30,5 +31,46 @@ class Hamburg extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-HH'; + public const ID = 'DE-HH'; + + /** + * Initialize holidays for Schleswig-Holstein (Germany). + * + * @throws \Yasumi\Exception\InvalidDateException + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + $this->calculateDayOfReformation(); + } + + /** + * Since 2018 Hamburg celebrates the "Day of Reformation". + * It is not called "Reformation Day" like other states to prevent church-based associations + * + * @throws \Yasumi\Exception\InvalidDateException + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + private function calculateDayOfReformation(): void + { + if ($this->year < 2018) { + return; + } + + $this->addHoliday( + new Holiday( + 'dayOfReformation', + [], + new \DateTime("{$this->year}-10-31", new \DateTimeZone($this->timezone)), + $this->locale, + Holiday::TYPE_OFFICIAL + ) + ); + } } diff --git a/src/Yasumi/Provider/Germany/Hesse.php b/src/Yasumi/Provider/Germany/Hesse.php index 08da7609d..2f9cc2992 100755 --- a/src/Yasumi/Provider/Germany/Hesse.php +++ b/src/Yasumi/Provider/Germany/Hesse.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -31,16 +31,17 @@ class Hesse extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-HE'; + public const ID = 'DE-HE'; /** * Initialize holidays for Hesse (Germany). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Germany/LowerSaxony.php b/src/Yasumi/Provider/Germany/LowerSaxony.php index fd38fa7e3..e6279be66 100755 --- a/src/Yasumi/Provider/Germany/LowerSaxony.php +++ b/src/Yasumi/Provider/Germany/LowerSaxony.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -30,5 +30,40 @@ class LowerSaxony extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-NI'; + public const ID = 'DE-NI'; + + /** + * Initialize holidays for Lower Saxony (Germany). + * + * @throws \Yasumi\Exception\InvalidDateException + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + // Add custom Christian holidays + $this->calculateReformationDay(); + } + + /** + * For the German state of Lower Saxony, Reformation Day is celebrated since 2018. + * Note: In 2017 all German states will celebrate Reformation Day for its 500th anniversary. + * + * @link https://www.zeit.de/gesellschaft/zeitgeschehen/2018-06/reformationstag-niedersachsen-neuer-feiertag + * + * @throws \Yasumi\Exception\InvalidDateException + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + private function calculateReformationDay(): void + { + if ($this->year < 2018) { + return; + } + $this->addHoliday($this->reformationDay($this->year, $this->timezone, $this->locale)); + } } diff --git a/src/Yasumi/Provider/Germany/MecklenburgWesternPomerania.php b/src/Yasumi/Provider/Germany/MecklenburgWesternPomerania.php index 2ab6918f8..59202eed5 100755 --- a/src/Yasumi/Provider/Germany/MecklenburgWesternPomerania.php +++ b/src/Yasumi/Provider/Germany/MecklenburgWesternPomerania.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -30,16 +30,17 @@ class MecklenburgWesternPomerania extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-MV'; + public const ID = 'DE-MV'; /** * Initialize holidays for Mecklenburg-Western Pomerania (Germany). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -51,10 +52,12 @@ public function initialize() * For the German state of Mecklenburg-Western Pomerania, Reformation Day was celebrated since 1517. * Note: In 2017 all German states will celebrate Reformation Day for its 500th anniversary. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - private function calculateReformationDay() + private function calculateReformationDay(): void { if ($this->year < 1517) { return; diff --git a/src/Yasumi/Provider/Germany/NorthRhineWestphalia.php b/src/Yasumi/Provider/Germany/NorthRhineWestphalia.php index 247c6608e..b705de979 100755 --- a/src/Yasumi/Provider/Germany/NorthRhineWestphalia.php +++ b/src/Yasumi/Provider/Germany/NorthRhineWestphalia.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -31,16 +31,17 @@ class NorthRhineWestphalia extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-NW'; + public const ID = 'DE-NW'; /** * Initialize holidays for North Rhine-Westphalia (Germany). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Germany/RhinelandPalatinate.php b/src/Yasumi/Provider/Germany/RhinelandPalatinate.php index 0177b6d86..f99e8ce3f 100755 --- a/src/Yasumi/Provider/Germany/RhinelandPalatinate.php +++ b/src/Yasumi/Provider/Germany/RhinelandPalatinate.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -30,16 +30,17 @@ class RhinelandPalatinate extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-RP'; + public const ID = 'DE-RP'; /** * Initialize holidays for Rhineland Palatinate (Germany). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Germany/Saarland.php b/src/Yasumi/Provider/Germany/Saarland.php index 975328193..e51ad314b 100755 --- a/src/Yasumi/Provider/Germany/Saarland.php +++ b/src/Yasumi/Provider/Germany/Saarland.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -31,16 +31,17 @@ class Saarland extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-SL'; + public const ID = 'DE-SL'; /** * Initialize holidays for Saarland (Germany). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Germany/Saxony.php b/src/Yasumi/Provider/Germany/Saxony.php index 39adef155..8f06ba753 100755 --- a/src/Yasumi/Provider/Germany/Saxony.php +++ b/src/Yasumi/Provider/Germany/Saxony.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -32,15 +32,16 @@ class Saxony extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-SN'; + public const ID = 'DE-SN'; /** * Initialize holidays for Saxony (Germany). + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -53,10 +54,12 @@ public function initialize() * For the German state of Saxony, Reformation Day was celebrated since 1517. * Note: In 2017 all German states will celebrate Reformation Day for its 500th anniversary. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - private function calculateReformationDay() + private function calculateReformationDay(): void { if ($this->year < 1517) { return; @@ -77,10 +80,12 @@ private function calculateReformationDay() * * @link https://en.wikipedia.org/wiki/Bu%C3%9F-_und_Bettag * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateRepentanceAndPrayerDay() + public function calculateRepentanceAndPrayerDay(): void { if ($this->year >= 1995) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Germany/SaxonyAnhalt.php b/src/Yasumi/Provider/Germany/SaxonyAnhalt.php index 75815cee4..b946c5bae 100755 --- a/src/Yasumi/Provider/Germany/SaxonyAnhalt.php +++ b/src/Yasumi/Provider/Germany/SaxonyAnhalt.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -30,16 +30,17 @@ class SaxonyAnhalt extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-ST'; + public const ID = 'DE-ST'; /** * Initialize holidays for Saxony-Anhalt (Germany). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -52,10 +53,12 @@ public function initialize() * For the German state of Saxony-Anhalt, Reformation Day was celebrated since 1517. * Note: In 2017 all German states will celebrate Reformation Day for its 500th anniversary. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - private function calculateReformationDay() + private function calculateReformationDay(): void { if ($this->year < 1517) { return; diff --git a/src/Yasumi/Provider/Germany/SchleswigHolstein.php b/src/Yasumi/Provider/Germany/SchleswigHolstein.php index 9f3e2a3ca..f37a99875 100755 --- a/src/Yasumi/Provider/Germany/SchleswigHolstein.php +++ b/src/Yasumi/Provider/Germany/SchleswigHolstein.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -29,5 +29,38 @@ class SchleswigHolstein extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-SH'; + public const ID = 'DE-SH'; + + /** + * Initialize holidays for Schleswig-Holstein (Germany). + * + * @throws \Yasumi\Exception\InvalidDateException + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + parent::initialize(); + + // Add custom Christian holidays + $this->calculateReformationDay(); + } + + /** + * For the German state of Schleswig-Holstein, Reformation Day is celebrated since 2018. + * Note: In 2017 all German states will celebrate Reformation Day for its 500th anniversary. + * + * @throws \Yasumi\Exception\InvalidDateException + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + */ + private function calculateReformationDay(): void + { + if ($this->year < 2018) { + return; + } + $this->addHoliday($this->reformationDay($this->year, $this->timezone, $this->locale)); + } } diff --git a/src/Yasumi/Provider/Germany/Thuringia.php b/src/Yasumi/Provider/Germany/Thuringia.php index 0ebeceea6..c8839ab0c 100755 --- a/src/Yasumi/Provider/Germany/Thuringia.php +++ b/src/Yasumi/Provider/Germany/Thuringia.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Germany; @@ -30,16 +30,17 @@ class Thuringia extends Germany * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'DE-TH'; + public const ID = 'DE-TH'; /** * Initialize holidays for Thuringia (Germany). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -51,10 +52,12 @@ public function initialize() * For the German state of Thuringia, Reformation Day was celebrated since 1517. * Note: In 2017 all German states will celebrate Reformation Day for its 500th anniversary. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - private function calculateReformationDay() + private function calculateReformationDay(): void { if ($this->year < 1517) { return; diff --git a/src/Yasumi/Provider/Greece.php b/src/Yasumi/Provider/Greece.php index 7b82494ba..d0ce2521c 100644 --- a/src/Yasumi/Provider/Greece.php +++ b/src/Yasumi/Provider/Greece.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -28,16 +28,17 @@ class Greece extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'GR'; + public const ID = 'GR'; /** * Initialize holidays for Greece. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Athens'; @@ -73,10 +74,12 @@ public function initialize() * * @see https://en.wikipedia.org/wiki/Three_Holy_Hierarchs * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateThreeHolyHierarchs() + public function calculateThreeHolyHierarchs(): void { $this->addHoliday(new Holiday( 'threeHolyHierarchs', @@ -96,11 +99,12 @@ public function calculateThreeHolyHierarchs() * * @see https://en.wikipedia.org/wiki/Clean_Monday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateCleanMonday() + public function calculateCleanMonday(): void { $this->addHoliday(new Holiday( 'cleanMonday', @@ -120,7 +124,7 @@ public function calculateCleanMonday() * * @throws \Exception */ - public function calculateEaster($year, $timezone) + public function calculateEaster($year, $timezone): DateTime { return $this->calculateOrthodoxEaster($year, $timezone); } @@ -132,11 +136,13 @@ public function calculateEaster($year, $timezone) * * @link https://en.wikipedia.org/wiki/Greek_War_of_Independence * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateIndependenceDay() + public function calculateIndependenceDay(): void { if ($this->year >= 1821) { $this->addHoliday(new Holiday( @@ -155,10 +161,12 @@ public function calculateIndependenceDay() * * @link https://en.wikipedia.org/wiki/Ohi_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateOhiDay() + public function calculateOhiDay(): void { if ($this->year >= 1940) { $this->addHoliday(new Holiday( @@ -177,10 +185,12 @@ public function calculateOhiDay() * * @link https://en.wikipedia.org/wiki/Athens_Polytechnic_uprising * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculatePolytechnio() + public function calculatePolytechnio(): void { if ($this->year >= 1973) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Hungary.php b/src/Yasumi/Provider/Hungary.php index 1abea03b9..13bffbcee 100644 --- a/src/Yasumi/Provider/Hungary.php +++ b/src/Yasumi/Provider/Hungary.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -29,16 +29,17 @@ class Hungary extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'HU'; + public const ID = 'HU'; /** * Initialize holidays for Hungary. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Budapest'; diff --git a/src/Yasumi/Provider/Ireland.php b/src/Yasumi/Provider/Ireland.php index 7c59c6d98..739a64e8f 100644 --- a/src/Yasumi/Provider/Ireland.php +++ b/src/Yasumi/Provider/Ireland.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -33,16 +33,17 @@ class Ireland extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'IE'; + public const ID = 'IE'; /** * Initialize holidays for Ireland. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Dublin'; @@ -85,10 +86,12 @@ public function initialize() * states that New Years Day is substituted the *next* day if it does not fall on a weekday. So what if it * falls on a Saturday? * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateNewYearsDay() + public function calculateNewYearsDay(): void { if ($this->year < 1974) { return; @@ -116,11 +119,12 @@ public function calculateNewYearsDay() * @link http://www.irishstatutebook.ie/eli/1939/act/1/section/8/enacted/en/html * @link http://www.irishstatutebook.ie/eli/1973/act/25/schedule/1/enacted/en/html#sched1 * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculatePentecostMonday() + public function calculatePentecostMonday(): void { if ($this->year > 1973) { return; @@ -137,10 +141,13 @@ public function calculatePentecostMonday() * * @link http://www.irishstatutebook.ie/eli/1973/act/25/schedule/1/enacted/en/html#sched1 * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - public function calculateChristmasDay() + public function calculateChristmasDay(): void { $holiday = new Holiday( 'christmasDay', @@ -152,7 +159,7 @@ public function calculateChristmasDay() $this->addHoliday($holiday); // Whenever Christmas Day does not fall on a weekday, the Tuesday following on it shall be a public holiday. - if (in_array((int)$holiday->format('w'), [0, 6], true)) { + if (\in_array((int)$holiday->format('w'), [0, 6], true)) { $substituteHoliday = clone $holiday; $substituteHoliday->modify('next tuesday'); @@ -171,10 +178,13 @@ public function calculateChristmasDay() * @link https://en.wikipedia.org/wiki/St._Stephen%27s_Day * @see ChristianHolidays * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - public function calculateStStephensDay() + public function calculateStStephensDay(): void { $holiday = new Holiday( 'stStephensDay', @@ -186,7 +196,7 @@ public function calculateStStephensDay() $this->addHoliday($holiday); // Whenever St. Stephens Day does not fall on a weekday, the Monday following on it shall be a public holiday. - if (in_array((int)$holiday->format('w'), [0, 6], true)) { + if (\in_array((int)$holiday->format('w'), [0, 6], true)) { $substituteHoliday = clone $holiday; $substituteHoliday->modify('next monday'); @@ -207,10 +217,13 @@ public function calculateStStephensDay() * * @link https://en.wikipedia.org/wiki/Saint_Patrick%27s_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - public function calculateStPatricksDay() + public function calculateStPatricksDay(): void { if ($this->year < 1903) { return; @@ -225,7 +238,7 @@ public function calculateStPatricksDay() $this->addHoliday($holiday); // Substitute holiday is on the next available weekday if a holiday falls on a Saturday or Sunday - if (in_array((int)$holiday->format('w'), [0, 6], true)) { + if (\in_array((int)$holiday->format('w'), [0, 6], true)) { $substituteHoliday = clone $holiday; $substituteHoliday->modify('next monday'); @@ -246,10 +259,13 @@ public function calculateStPatricksDay() * * @link https://en.wikipedia.org/wiki/May_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - public function calculateMayDay() + public function calculateMayDay(): void { if ($this->year < 1994) { return; @@ -271,10 +287,13 @@ public function calculateMayDay() * * @link http://www.irishstatutebook.ie/eli/1961/act/33/section/8/enacted/en/html * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - public function calculateJuneHoliday() + public function calculateJuneHoliday(): void { if ($this->year < 1974) { return; @@ -295,10 +314,13 @@ public function calculateJuneHoliday() * * @link http://www.irishstatutebook.ie/eli/1973/act/25/schedule/1/enacted/en/html#sched1 * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - public function calculateOctoberHoliday() + public function calculateOctoberHoliday(): void { if ($this->year < 1977) { return; diff --git a/src/Yasumi/Provider/Italy.php b/src/Yasumi/Provider/Italy.php index 298f5921a..537019937 100755 --- a/src/Yasumi/Provider/Italy.php +++ b/src/Yasumi/Provider/Italy.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -27,16 +27,17 @@ class Italy extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'IT'; + public const ID = 'IT'; /** * Initialize holidays for Italy. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Rome'; @@ -70,10 +71,13 @@ public function initialize() * * @link http://en.wikipedia.org/wiki/Liberation_Day_%28Italy%29 * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - public function calculateLiberationDay() + public function calculateLiberationDay(): void { if ($this->year >= 1949) { $this->addHoliday(new Holiday( @@ -95,10 +99,13 @@ public function calculateLiberationDay() * * @link http://en.wikipedia.org/wiki/Festa_della_Repubblica * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - public function calculateRepublicDay() + public function calculateRepublicDay(): void { if ($this->year >= 1946) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Japan.php b/src/Yasumi/Provider/Japan.php index caca56e38..d8345bde9 100755 --- a/src/Yasumi/Provider/Japan.php +++ b/src/Yasumi/Provider/Japan.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -29,69 +29,92 @@ class Japan extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'JP'; + public const ID = 'JP'; /** * The gradient parameter of the approximate expression to calculate equinox day. */ - const EQUINOX_GRADIENT = 0.242194; + private const EQUINOX_GRADIENT = 0.242194; /** * The initial parameter of the approximate expression to calculate vernal equinox day from 1900 to 1979. */ - const VERNAL_EQUINOX_PARAM_1979 = 20.8357; + private const VERNAL_EQUINOX_PARAM_1979 = 20.8357; /** * The initial parameter of the approximate expression to calculate vernal equinox day from 1980 to 2099. */ - const VERNAL_EQUINOX_PARAM_2099 = 20.8431; + private const VERNAL_EQUINOX_PARAM_2099 = 20.8431; /** * The initial parameter of the approximate expression to calculate vernal equinox day from 2100 to 2150. */ - const VERNAL_EQUINOX_PARAM_2150 = 21.8510; + private const VERNAL_EQUINOX_PARAM_2150 = 21.8510; /** * The initial parameter of the approximate expression to calculate autumnal equinox day from 1851 to 1899. */ - const AUTUMNAL_EQUINOX_PARAM_1899 = 22.2588; + private const AUTUMNAL_EQUINOX_PARAM_1899 = 22.2588; /** * The initial parameter of the approximate expression to calculate autumnal equinox day from 1900 to 1979. */ - const AUTUMNAL_EQUINOX_PARAM_1979 = 23.2588; + private const AUTUMNAL_EQUINOX_PARAM_1979 = 23.2588; /** * The initial parameter of the approximate expression to calculate autumnal equinox day from 1980 to 2099. */ - const AUTUMNAL_EQUINOX_PARAM_2099 = 23.2488; + private const AUTUMNAL_EQUINOX_PARAM_2099 = 23.2488; /** * The initial parameter of the approximate expression to calculate autumnal equinox day from 2100 to 2150. */ - const AUTUMNAL_EQUINOX_PARAM_2150 = 24.2488; + private const AUTUMNAL_EQUINOX_PARAM_2150 = 24.2488; /** * Initialize holidays for Japan. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Asia/Tokyo'; - /** - * New Year's Day. New Year's Day in Japan is established since 1948. - */ + // Add common holidays if ($this->year >= 1948) { $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale)); } - /** - * National Foundation Day. National Foundation Day is held on February 11th and established since 1966. - */ + // Calculate other holidays + $this->calculateNationalFoundationDay(); + $this->calculateShowaDay(); + $this->calculateConstitutionMemorialDay(); + $this->calculateChildrensDay(); + $this->calculateCultureDay(); + $this->calculateLaborThanksgivingDay(); + $this->calculateEmporersBirthday(); + $this->calculateVernalEquinoxDay(); + $this->calculateComingOfAgeDay(); + $this->calculateGreeneryDay(); + $this->calculateMarineDay(); + $this->calculateMountainDay(); + $this->calculateRespectForTheAgeDay(); + $this->calculateHealthAndSportsDay(); + $this->calculateAutumnalEquinoxDay(); + $this->calculateSubstituteHolidays(); + $this->calculateBridgeHolidays(); + } + + /** + * National Foundation Day. National Foundation Day is held on February 11th and established since 1966. + * + * @throws \Exception + */ + private function calculateNationalFoundationDay(): void + { if ($this->year >= 1966) { $this->addHoliday(new Holiday( 'nationalFoundationDay', @@ -100,10 +123,15 @@ public function initialize() $this->locale )); } + } - /** - * Showa Day. Showa Day is held on April 29th and established since 2007. - */ + /** + * Showa Day. Showa Day is held on April 29th and established since 2007. + * + * @throws \Exception + */ + private function calculateShowaDay(): void + { if ($this->year >= 2007) { $this->addHoliday(new Holiday( 'showaDay', @@ -112,10 +140,15 @@ public function initialize() $this->locale )); } + } - /** - * Constitution Memorial Day. Constitution Memorial Day is held on May 3rd and established since 1948. - */ + /** + * Constitution Memorial Day. Constitution Memorial Day is held on May 3rd and established since 1948. + * + * @throws \Exception + */ + private function calculateConstitutionMemorialDay(): void + { if ($this->year >= 1948) { $this->addHoliday(new Holiday( 'constitutionMemorialDay', @@ -124,10 +157,14 @@ public function initialize() $this->locale )); } - - /** - * Children's Day. Children's Day is held on May 5th and established since 1948. - */ + } + /** + * Children's Day. Children's Day is held on May 5th and established since 1948. + * + * @throws \Exception + */ + private function calculateChildrensDay(): void + { if ($this->year >= 1948) { $this->addHoliday(new Holiday( 'childrensDay', @@ -136,22 +173,15 @@ public function initialize() $this->locale )); } + } - /** - * Mountain Day. Mountain Day is held on August 11th and established since 2016. - */ - if ($this->year >= 2016) { - $this->addHoliday(new Holiday( - 'mountainDay', - ['en_US' => 'Mountain Day', 'ja_JP' => '山の日'], - new DateTime("$this->year-8-11", new DateTimeZone($this->timezone)), - $this->locale - )); - } - - /** - * Culture Day. Culture Day is held on November 11th and established since 1948. - */ + /** + * Culture Day. Culture Day is held on November 11th and established since 1948. + * + * @throws \Exception + */ + private function calculateCultureDay(): void + { if ($this->year >= 1948) { $this->addHoliday(new Holiday( 'cultureDay', @@ -160,10 +190,15 @@ public function initialize() $this->locale )); } + } - /** - * Labor Thanksgiving Day. Labor Thanksgiving Day is held on November 23rd and established since 1948. - */ + /** + * Labor Thanksgiving Day. Labor Thanksgiving Day is held on November 23rd and established since 1948. + * + * @throws \Exception + */ + private function calculateLaborThanksgivingDay(): void + { if ($this->year >= 1948) { $this->addHoliday(new Holiday( 'laborThanksgivingDay', @@ -172,11 +207,16 @@ public function initialize() $this->locale )); } + } - /** - * Emperors Birthday. The Emperors Birthday is on December 23rd and celebrated as such since 1989. - * Prior to the death of Emperor Hirohito in 1989, this holiday was celebrated on April 29. See also "Shōwa Day". - */ + /** + * Emperors Birthday. The Emperors Birthday is on December 23rd and celebrated as such since 1989. + * Prior to the death of Emperor Hirohito in 1989, this holiday was celebrated on April 29. See also "Shōwa Day". + * + * @throws \Exception + */ + private function calculateEmporersBirthday(): void + { if ($this->year >= 1989) { $this->addHoliday(new Holiday( 'emperorsBirthday', @@ -185,16 +225,6 @@ public function initialize() $this->locale )); } - - $this->calculateVernalEquinoxDay(); - $this->calculateComingOfAgeDay(); - $this->calculateGreeneryDay(); - $this->calculateMarineDay(); - $this->calculateRespectForTheAgeDay(); - $this->calculateHealthAndSportsDay(); - $this->calculateAutumnalEquinoxDay(); - $this->calculateSubstituteHolidays(); - $this->calculateBridgeHolidays(); } /** @@ -206,20 +236,22 @@ public function initialize() * * @link http://www.h3.dion.ne.jp/~sakatsu/holiday_topic.htm (in Japanese) * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - private function calculateVernalEquinoxDay() + private function calculateVernalEquinoxDay(): void { $day = null; if ($this->year < 1948 || $this->year > 2150) { $day = null; } elseif ($this->year >= 1948 && $this->year <= 1979) { - $day = floor(self::VERNAL_EQUINOX_PARAM_1979 + self::EQUINOX_GRADIENT * ($this->year - 1980) - floor(($this->year - 1983) / 4)); + $day = \floor(self::VERNAL_EQUINOX_PARAM_1979 + self::EQUINOX_GRADIENT * ($this->year - 1980) - \floor(($this->year - 1983) / 4)); } elseif ($this->year <= 2099) { - $day = floor(self::VERNAL_EQUINOX_PARAM_2099 + self::EQUINOX_GRADIENT * ($this->year - 1980) - floor(($this->year - 1980) / 4)); + $day = \floor(self::VERNAL_EQUINOX_PARAM_2099 + self::EQUINOX_GRADIENT * ($this->year - 1980) - \floor(($this->year - 1980) / 4)); } elseif ($this->year <= 2150) { - $day = floor(self::VERNAL_EQUINOX_PARAM_2150 + self::EQUINOX_GRADIENT * ($this->year - 1980) - floor(($this->year - 1980) / 4)); + $day = \floor(self::VERNAL_EQUINOX_PARAM_2150 + self::EQUINOX_GRADIENT * ($this->year - 1980) - \floor(($this->year - 1980) / 4)); } if (null !== $day) { @@ -238,10 +270,13 @@ private function calculateVernalEquinoxDay() * Coming of Age Day was established after 1948 on January 15th. After 2000 it was changed to be the second monday * of January. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - private function calculateComingOfAgeDay() + private function calculateComingOfAgeDay(): void { $date = null; if ($this->year >= 2000) { @@ -265,10 +300,13 @@ private function calculateComingOfAgeDay() * * Greenery Day was established from 1989 on April 29th. After 2007 it was changed to be May 4th. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - private function calculateGreeneryDay() + private function calculateGreeneryDay(): void { $date = null; if ($this->year >= 2007) { @@ -290,15 +328,22 @@ private function calculateGreeneryDay() /** * Calculates Marine Day. * - * Marine Day was established since 1996 on July 20th. After 2003 it was changed to be the third monday of July. + * Marine Day was established since 1996 on July 20th. After 2003 it was changed to be the third monday of July.In + * 2020 is July 23th. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception + * @throws \Exception */ - private function calculateMarineDay() + private function calculateMarineDay(): void { $date = null; - if ($this->year >= 2003) { + if ($this->year === 2020) { + $date = new DateTime("$this->year-7-23", new DateTimeZone($this->timezone)); + } elseif ($this->year >= 2003) { $date = new DateTime("third monday of july $this->year", new DateTimeZone($this->timezone)); } elseif ($this->year >= 1996) { $date = new DateTime("$this->year-7-20", new DateTimeZone($this->timezone)); @@ -314,16 +359,48 @@ private function calculateMarineDay() } } + /** + * Calculates MountainDay + * + * Mountain Day. Mountain Day is held on August 11th and established since 2016.In 2020 is August 10th. + * + * @throws \InvalidArgumentException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception + */ + private function calculateMountainDay(): void + { + $date = null; + if ($this->year === 2020) { + $date = new DateTime("$this->year-8-10", new DateTimeZone($this->timezone)); + } elseif ($this->year >= 2016) { + $date = new DateTime("$this->year-8-11", new DateTimeZone($this->timezone)); + } + + if (null !== $date) { + $this->addHoliday(new Holiday( + 'mountainDay', + ['en_US' => 'Mountain Day', 'ja_JP' => '山の日'], + $date, + $this->locale + )); + } + } + /** * Calculates Respect for the Age Day. * * Respect for the Age Day was established since 1996 on September 15th. After 2003 it was changed to be the third * monday of September. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - private function calculateRespectForTheAgeDay() + private function calculateRespectForTheAgeDay(): void { $date = null; if ($this->year >= 2003) { @@ -346,15 +423,21 @@ private function calculateRespectForTheAgeDay() * Calculates Health And Sports Day. * * Health And Sports Day was established since 1966 on October 10th. After 2000 it was changed to be the second - * monday of October. + * monday of October.In 2020 is July 24th. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception + * @throws \Exception */ - private function calculateHealthAndSportsDay() + private function calculateHealthAndSportsDay(): void { $date = null; - if ($this->year >= 2000) { + if ($this->year === 2020) { + $date = new DateTime("$this->year-7-24", new DateTimeZone($this->timezone)); + } elseif ($this->year >= 2000) { $date = new DateTime("second monday of october $this->year", new DateTimeZone($this->timezone)); } elseif ($this->year >= 1996) { $date = new DateTime("$this->year-10-10", new DateTimeZone($this->timezone)); @@ -379,20 +462,22 @@ private function calculateHealthAndSportsDay() * * @link http://www.h3.dion.ne.jp/~sakatsu/holiday_topic.htm (in Japanese) * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - private function calculateAutumnalEquinoxDay() + private function calculateAutumnalEquinoxDay(): void { $day = null; if ($this->year < 1948 || $this->year > 2150) { $day = null; } elseif ($this->year >= 1948 && $this->year <= 1979) { - $day = floor(self::AUTUMNAL_EQUINOX_PARAM_1979 + self::EQUINOX_GRADIENT * ($this->year - 1980) - floor(($this->year - 1983) / 4)); + $day = \floor(self::AUTUMNAL_EQUINOX_PARAM_1979 + self::EQUINOX_GRADIENT * ($this->year - 1980) - \floor(($this->year - 1983) / 4)); } elseif ($this->year <= 2099) { - $day = floor(self::AUTUMNAL_EQUINOX_PARAM_2099 + self::EQUINOX_GRADIENT * ($this->year - 1980) - floor(($this->year - 1980) / 4)); + $day = \floor(self::AUTUMNAL_EQUINOX_PARAM_2099 + self::EQUINOX_GRADIENT * ($this->year - 1980) - \floor(($this->year - 1980) / 4)); } elseif ($this->year <= 2150) { - $day = floor(self::AUTUMNAL_EQUINOX_PARAM_2150 + self::EQUINOX_GRADIENT * ($this->year - 1980) - floor(($this->year - 1980) / 4)); + $day = \floor(self::AUTUMNAL_EQUINOX_PARAM_2150 + self::EQUINOX_GRADIENT * ($this->year - 1980) - \floor(($this->year - 1980) / 4)); } if (null !== $day) { @@ -411,11 +496,12 @@ private function calculateAutumnalEquinoxDay() * Generally if a national holiday falls on a Sunday, the holiday is observed the next working day (not being * another holiday). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - private function calculateSubstituteHolidays() + private function calculateSubstituteHolidays(): void { // Get initial list of holiday dates $dates = $this->getHolidayDates(); @@ -428,13 +514,13 @@ private function calculateSubstituteHolidays() if (0 === (int)$date->format('w')) { if ($this->year >= 2007) { // Find next week day (not being another holiday) - while (in_array($substituteDay, $dates)) { + while (\in_array($substituteDay, $dates, false)) { $substituteDay->add(new DateInterval('P1D')); continue; } } elseif ($date >= '1973-04-12') { $substituteDay->add(new DateInterval('P1D')); - if (in_array($substituteDay, $dates)) { + if (\in_array($substituteDay, $dates, false)) { continue; // @codeCoverageIgnore } } else { @@ -457,11 +543,12 @@ private function calculateSubstituteHolidays() * * Any day that falls between two other national holidays also becomes a holiday, known as a bridge holiday. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - private function calculateBridgeHolidays() + private function calculateBridgeHolidays(): void { // Get initial list of holidays and iterator $datesIterator = $this->getIterator(); diff --git a/src/Yasumi/Provider/Latvia.php b/src/Yasumi/Provider/Latvia.php index 038c481aa..ae2eec0e7 100644 --- a/src/Yasumi/Provider/Latvia.php +++ b/src/Yasumi/Provider/Latvia.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -24,15 +24,15 @@ class Latvia extends AbstractProvider { use CommonHolidays, ChristianHolidays; - const RESTORATION_OF_INDEPENDENCE_YEAR = 1990; + public const RESTORATION_OF_INDEPENDENCE_YEAR = 1990; - const PROCLAMATION_OF_INDEPENDENCE_YEAR = 1918; + public const PROCLAMATION_OF_INDEPENDENCE_YEAR = 1918; /** * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'LV'; + public const ID = 'LV'; /** * Initialize holidays for Latvia. @@ -40,7 +40,7 @@ class Latvia extends AbstractProvider * @throws \InvalidArgumentException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Riga'; @@ -57,7 +57,7 @@ public function initialize() $this->addHoliday($this->christmasEve($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL)); $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale)); $this->addHoliday($this->secondChristmasDay($this->year, $this->timezone, $this->locale)); - $this->addNewYearsEve(); + $this->addHoliday($this->newYearsEve($this->year, $this->timezone, $this->locale)); } /** @@ -65,8 +65,9 @@ public function initialize() * If the day is on the weekend the next Monday is a holiday. * * @throws \InvalidArgumentException + * @throws \Exception */ - private function addRestorationOfIndependenceDay() + private function addRestorationOfIndependenceDay(): void { if ($this->year >= self::RESTORATION_OF_INDEPENDENCE_YEAR) { $date = new \DateTime("{$this->year}-05-04", new \DateTimeZone($this->timezone)); @@ -84,8 +85,9 @@ private function addRestorationOfIndependenceDay() /** * @throws \InvalidArgumentException + * @throws \Exception */ - private function addMidsummerEveDay() + private function addMidsummerEveDay(): void { $this->addHoliday(new Holiday('midsummerEveDay', [ 'en_US' => 'Midsummer Eve', @@ -98,8 +100,9 @@ private function addMidsummerEveDay() * If the day is on the weekend the next Monday is a holiday. * * @throws \InvalidArgumentException + * @throws \Exception */ - private function addProclamationDay() + private function addProclamationDay(): void { if ($this->year >= self::PROCLAMATION_OF_INDEPENDENCE_YEAR) { $date = new \DateTime("{$this->year}-11-18", new \DateTimeZone($this->timezone)); @@ -114,15 +117,4 @@ private function addProclamationDay() ], $date)); } } - - /** - * @throws \InvalidArgumentException - */ - private function addNewYearsEve() - { - $this->addHoliday(new Holiday('newYearsEve', [ - 'en_US' => 'New Year\'s Eve', - 'lv_LV' => 'Vecgada vakars' - ], new \DateTime("{$this->year}-12-31", new \DateTimeZone($this->timezone)))); - } } diff --git a/src/Yasumi/Provider/Lithuania.php b/src/Yasumi/Provider/Lithuania.php index 7016c8ba3..a64a1f109 100644 --- a/src/Yasumi/Provider/Lithuania.php +++ b/src/Yasumi/Provider/Lithuania.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -28,22 +28,22 @@ class Lithuania extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'LT'; + public const ID = 'LT'; /** * The year when The Act of Reinstating Independence of Lithuania was signed. */ - const RESTORATION_OF_THE_STATE_YEAR = 1918; + public const RESTORATION_OF_THE_STATE_YEAR = 1918; /** * The year when The Act of the Re-Establishment of the State of Lithuania was signed. */ - const RESTORATION_OF_INDEPENDENCE_YEAR = 1990; + public const RESTORATION_OF_INDEPENDENCE_YEAR = 1990; /** * A year when Mindaugas was crowned as the only King of Lithuania. */ - const STATEHOOD_YEAR = 1253; + public const STATEHOOD_YEAR = 1253; /** * Initialize holidays for Lithuania. @@ -51,7 +51,7 @@ class Lithuania extends AbstractProvider * @throws \InvalidArgumentException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Vilnius'; @@ -75,8 +75,9 @@ public function initialize() * The Act of Reinstating Independence of Lithuania was signed on February 16, 1918. * * @throws \InvalidArgumentException + * @throws \Exception */ - private function addRestorationOfTheStateDay() + private function addRestorationOfTheStateDay(): void { if ($this->year >= self::RESTORATION_OF_THE_STATE_YEAR) { $this->addHoliday(new Holiday('restorationOfTheStateOfLithuaniaDay', [ @@ -90,8 +91,9 @@ private function addRestorationOfTheStateDay() * The Act of the Re-Establishment of the State of Lithuania was signed on March 11, 1990. * * @throws \InvalidArgumentException + * @throws \Exception */ - private function addRestorationOfIndependenceDay() + private function addRestorationOfIndependenceDay(): void { if ($this->year >= self::RESTORATION_OF_INDEPENDENCE_YEAR) { $this->addHoliday(new Holiday('restorationOfIndependenceOfLithuaniaDay', [ @@ -106,8 +108,9 @@ private function addRestorationOfIndependenceDay() * the coronation in 1253 of Mindaugas as the only King of Lithuania. * * @throws \InvalidArgumentException + * @throws \Exception */ - private function addStatehoodDay() + private function addStatehoodDay(): void { if ($this->year >= self::STATEHOOD_YEAR) { $this->addHoliday(new Holiday('statehoodDay', [ diff --git a/src/Yasumi/Provider/Netherlands.php b/src/Yasumi/Provider/Netherlands.php index cee7edbee..2c301b997 100755 --- a/src/Yasumi/Provider/Netherlands.php +++ b/src/Yasumi/Provider/Netherlands.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -28,16 +28,17 @@ class Netherlands extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'NL'; + public const ID = 'NL'; /** * Initialize holidays for the Netherlands. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Amsterdam'; @@ -175,33 +176,15 @@ public function initialize() Holiday::TYPE_OBSERVANCE )); - /** - * Summertime. - * - * Start of Summertime takes place on the last sunday of march. (Summertime is the common name for Daylight Saving - * Time). - */ - $this->addHoliday(new Holiday( - 'summerTime', - ['en_US' => 'Summertime', 'nl_NL' => 'Zomertijd'], - new DateTime("last sunday of march $this->year", new DateTimeZone($this->timezone)), - $this->locale, - Holiday::TYPE_SEASON - )); + $summerTime = $this->summerTime($this->year, $this->timezone, $this->locale); + if ($summerTime !== null) { + $this->addHoliday($summerTime); + } - /** - * Wintertime. - * - * Start of Wintertime takes place on the last sunday of october. (Wintertime is actually the end of Summertime. - * Summertime is the common name for Daylight Saving Time). - */ - $this->addHoliday(new Holiday( - 'winterTime', - ['en_US' => 'Wintertime', 'nl_NL' => 'Wintertijd'], - new DateTime("last sunday of october $this->year", new DateTimeZone($this->timezone)), - $this->locale, - Holiday::TYPE_SEASON - )); + $winterTime = $this->winterTime($this->year, $this->timezone, $this->locale); + if ($winterTime !== null) { + $this->addHoliday($winterTime); + } /** * Carnival. diff --git a/src/Yasumi/Provider/NewZealand.php b/src/Yasumi/Provider/NewZealand.php index 9973a51ad..a70280234 100644 --- a/src/Yasumi/Provider/NewZealand.php +++ b/src/Yasumi/Provider/NewZealand.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -28,16 +28,17 @@ class NewZealand extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'NZ'; + public const ID = 'NZ'; /** * Initialize holidays for New Zealand. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Pacific/Auckland'; @@ -65,11 +66,12 @@ public function initialize() * @link http://www.timeanddate.com/holidays/new-zealand/day-after-new-years-day * @link http://employment.govt.nz/er/holidaysandleave/publicholidays/mondayisation.asp * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateNewYearHolidays() + public function calculateNewYearHolidays(): void { $newYearsDay = new DateTime("$this->year-01-01", new DateTimeZone($this->timezone)); $dayAfterNewYearsDay = new DateTime("$this->year-01-02", new DateTimeZone($this->timezone)); @@ -104,10 +106,12 @@ public function calculateNewYearHolidays() * @link https://en.wikipedia.org/wiki/Waitangi_Day * @link http://employment.govt.nz/er/holidaysandleave/publicholidays/mondayisation.asp * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateWaitangiDay() + public function calculateWaitangiDay(): void { if ($this->year < 1974) { return; @@ -132,10 +136,12 @@ public function calculateWaitangiDay() * @link https://en.wikipedia.org/wiki/Anzac_Day * @link http://employment.govt.nz/er/holidaysandleave/publicholidays/mondayisation.asp * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateAnzacDay() + public function calculateAnzacDay(): void { if ($this->year < 1921) { return; @@ -163,10 +169,12 @@ public function calculateAnzacDay() * * @link http://www.timeanddate.com/holidays/new-zealand/queen-birthday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateQueensBirthday() + public function calculateQueensBirthday(): void { if ($this->year < 1952) { return; @@ -194,10 +202,12 @@ public function calculateQueensBirthday() * * @link http://www.timeanddate.com/holidays/new-zealand/labour-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateLabourDay() + public function calculateLabourDay(): void { if ($this->year < 1900) { return; @@ -221,11 +231,12 @@ public function calculateLabourDay() * @link http://www.timeanddate.com/holidays/new-zealand/christmas-day * @link http://employment.govt.nz/er/holidaysandleave/publicholidays/mondayisation.asp * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateChristmasHolidays() + public function calculateChristmasHolidays(): void { $christmasDay = new DateTime("$this->year-12-25", new DateTimeZone($this->timezone)); $boxingDay = new DateTime("$this->year-12-26", new DateTimeZone($this->timezone)); diff --git a/src/Yasumi/Provider/Norway.php b/src/Yasumi/Provider/Norway.php index 046f6fa48..03b42364e 100644 --- a/src/Yasumi/Provider/Norway.php +++ b/src/Yasumi/Provider/Norway.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -27,16 +27,17 @@ class Norway extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'NO'; + public const ID = 'NO'; /** * Initialize holidays for Norway. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Oslo'; @@ -63,23 +64,26 @@ public function initialize() * Constitution Day * * Norway’s Constitution Day is May 17 and commemorates the signing of Norways's constitution at Eidsvoll on - * May 17, 1814. It’s usually referred to as syttende mai (May 17) or Nasjonaldagen (The National Day) in Norwegian. + * May 17, 1814. It’s usually referred to as Grunnlovsdag(en) ((The) Constitution Day), syttende mai (May 17) or + * Nasjonaldagen (The National Day) in Norwegian. * * Norway adopted its constitution on May 16 1814 and it was signed on May 17, 1814, ending almost 100 years of a * coalition with Sweden, proceeded by nearly 400 years of Danish rule. The Norwegian Parliament, known as * Stortinget, held the first May 17 celebrations in 1836, and since it has been regarded as Norway’s National Day. * - * @link https://en.wikipedia.org/wiki/Store_Bededag + * @link https://en.wikipedia.org/wiki/Norwegian_Constitution_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateConstitutionDay() + public function calculateConstitutionDay(): void { if ($this->year >= 1836) { $this->addHoliday(new Holiday( 'constitutionDay', - ['nb_NO' => 'Nasjonaldagen'], + ['nb_NO' => 'Grunnlovsdagen'], new DateTime("$this->year-5-17", new DateTimeZone($this->timezone)), $this->locale )); diff --git a/src/Yasumi/Provider/Poland.php b/src/Yasumi/Provider/Poland.php index 12e89aec5..4801f45a5 100755 --- a/src/Yasumi/Provider/Poland.php +++ b/src/Yasumi/Provider/Poland.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -27,16 +27,17 @@ class Poland extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'PL'; + public const ID = 'PL'; /** * Initialize holidays for Poland. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Warsaw'; @@ -70,11 +71,13 @@ public function initialize() * * @link https://en.wikipedia.org/wiki/May_3rd_Constitution_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateIndependenceDay() + public function calculateIndependenceDay(): void { if ($this->year < 1918) { return; @@ -96,11 +99,13 @@ public function calculateIndependenceDay() * * @link https://en.wikipedia.org/wiki/National_Independence_Day_(Poland) * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateConstitutionDay() + public function calculateConstitutionDay(): void { if ($this->year < 1791) { return; diff --git a/src/Yasumi/Provider/Portugal.php b/src/Yasumi/Provider/Portugal.php index 779da2f91..77294a0aa 100644 --- a/src/Yasumi/Provider/Portugal.php +++ b/src/Yasumi/Provider/Portugal.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -31,16 +31,17 @@ class Portugal extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'PT'; + public const ID = 'PT'; /** * Initialize holidays for Portugal. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Lisbon'; @@ -75,10 +76,12 @@ public function initialize() * * @link https://en.wikipedia.org/wiki/Carnation_Revolution * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateCarnationRevolutionDay() + public function calculateCarnationRevolutionDay(): void { if ($this->year >= 1974) { $this->addHoliday(new Holiday( @@ -95,11 +98,12 @@ public function calculateCarnationRevolutionDay() * In Portugal, between 2013 andd 2015 (inclusive) this holiday did not happen due to government deliberation. * It was restored in 2016. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateCorpusChristi() + public function calculateCorpusChristi(): void { if ($this->year <= 2013 || $this->year >= 2016) { $this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale)); @@ -119,10 +123,12 @@ public function calculateCorpusChristi() * * @link https://en.wikipedia.org/wiki/Portugal_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculatePortugalDay() + public function calculatePortugalDay(): void { if ($this->year <= 1932 || $this->year >= 1974) { $this->addHoliday(new Holiday( @@ -149,10 +155,12 @@ public function calculatePortugalDay() * * @link https://en.wikipedia.org/wiki/5_October_1910_revolution * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculatePortugueseRepublicDay() + public function calculatePortugueseRepublicDay(): void { if ($this->year >= 1910) { $this->addHoliday(new Holiday( @@ -168,10 +176,12 @@ public function calculatePortugueseRepublicDay() * In Portugal, between 2013 andd 2015 (inclusive) this holiday did not happen due to government deliberation. * It was restored in 2016. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateAllSaintsDay() + public function calculateAllSaintsDay(): void { if ($this->year <= 2013 || $this->year >= 2016) { $this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale)); @@ -198,10 +208,12 @@ public function calculateAllSaintsDay() * @link https://pt.wikipedia.org/wiki/Restauração_da_Independência (portuguese link) * @link https://pt.wikipedia.org/wiki/Guerra_da_Restauração (english link) * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateRestorationOfIndependenceDay() + public function calculateRestorationOfIndependenceDay(): void { // The Wikipedia article mentions that this has been a holiday since the second of half of the XIX century. if (($this->year >= 1850 && $this->year <= 2013) || $this->year >= 2016) { diff --git a/src/Yasumi/Provider/Romania.php b/src/Yasumi/Provider/Romania.php index 9f320a446..460702433 100755 --- a/src/Yasumi/Provider/Romania.php +++ b/src/Yasumi/Provider/Romania.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -32,16 +32,17 @@ class Romania extends AbstractProvider * Code to identify this Holiday Provider. * Typically this is the ISO3166 code corresponding to the respective country or sub-region. */ - const ID = 'RO'; + public const ID = 'RO'; /** * Initialize holidays for Romania. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Bucharest'; @@ -78,10 +79,12 @@ public function initialize() * * @link https://en.wikipedia.org/wiki/Public_holidays_in_Romania * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateDayAfterNewYearsDay() + public function calculateDayAfterNewYearsDay(): void { $this->addHoliday(new Holiday('dayAfterNewYearsDay', [ 'en_US' => 'Day after New Year\'s Day', @@ -99,10 +102,12 @@ public function calculateDayAfterNewYearsDay() * * @link https://en.wikipedia.org/wiki/United_Principalities * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateUnitedPrincipalitiesDay() + public function calculateUnitedPrincipalitiesDay(): void { // The law is official since 21.12.2014. if ($this->year > 2014) { @@ -120,10 +125,12 @@ public function calculateUnitedPrincipalitiesDay() * * @link https://en.wikipedia.org/wiki/St._Andrew%27s_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateStAndrewDay() + public function calculateStAndrewDay(): void { if ($this->year >= 2012) { $this->addHoliday(new Holiday('stAndrewDay', [ @@ -144,10 +151,12 @@ public function calculateStAndrewDay() * @link https://en.wikipedia.org/wiki/Great_Union_Day * @link https://ro.wikipedia.org/wiki/Ziua_na%C8%9Bional%C4%83_a_Rom%C3%A2niei * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateNationalDay() + public function calculateNationalDay(): void { $national_day = null; @@ -178,10 +187,12 @@ public function calculateNationalDay() * Constantin Brâncuși (February 19, 1876 – March 16, 1957) was a Romanian sculptor, painter and photographer. * * @link https://en.wikipedia.org/wiki/Constantin_Br%C3%A2ncu%C8%99i + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateConstantinBrancusiDay() + public function calculateConstantinBrancusiDay(): void { if ($this->year >= 2016) { $this->addHoliday(new Holiday( @@ -204,10 +215,13 @@ public function calculateConstantinBrancusiDay() * according to the Law 220/2016 (18.11.2016) * * @link https://en.wikipedia.org/wiki/Children%27s_Day + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - public function calculateChildrensDay() + public function calculateChildrensDay(): void { if ($this->year >= 1950 && $this->year <= 2016) { $this->addHoliday(new Holiday( @@ -238,7 +252,7 @@ public function calculateChildrensDay() * * @throws \Exception */ - public function calculateEaster($year, $timezone) + public function calculateEaster($year, $timezone): DateTime { return $this->calculateOrthodoxEaster($year, $timezone); } diff --git a/src/Yasumi/Provider/Russia.php b/src/Yasumi/Provider/Russia.php index eeadcd82b..7db1e63bf 100644 --- a/src/Yasumi/Provider/Russia.php +++ b/src/Yasumi/Provider/Russia.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -23,24 +23,25 @@ class Russia extends AbstractProvider { use CommonHolidays; - const DEFENCE_OF_THE_FATHERLAND_START_YEAR = 1919; + public const DEFENCE_OF_THE_FATHERLAND_START_YEAR = 1919; - const RUSSIA_DAY_START_YEAR = 1990; + public const RUSSIA_DAY_START_YEAR = 1990; - const UNITY_DAY_START_YEAR = 2005; + public const UNITY_DAY_START_YEAR = 2005; /** * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'RU'; + public const ID = 'RU'; /** * Initialize holidays for Russia. * * @throws \InvalidArgumentException + * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Moscow'; @@ -58,8 +59,9 @@ public function initialize() /** * @throws \InvalidArgumentException + * @throws \Exception */ - private function addNewYearsHolidays() + private function addNewYearsHolidays(): void { $holidayDays = [2, 3, 4, 5, 6, 8]; @@ -67,25 +69,27 @@ private function addNewYearsHolidays() $this->addHoliday(new Holiday('newYearHolidaysDay' . $day, [ 'en_US' => 'New Year\'s holidays', 'ru_RU' => 'Новогодние каникулы' - ], new \DateTime("{$this->year}-01-{$day}", new \DateTimeZone($this->timezone)))); + ], new \DateTime("{$this->year}-01-{$day}", new \DateTimeZone($this->timezone)), $this->locale)); } } /** * @throws \InvalidArgumentException + * @throws \Exception */ - private function addOrthodoxChristmasDay() + private function addOrthodoxChristmasDay(): void { $this->addHoliday(new Holiday('orthodoxChristmasDay', [ 'en_US' => 'Orthodox Christmas Day', 'ru_RU' => 'Рождество' - ], new \DateTime("{$this->year}-01-07", new \DateTimeZone($this->timezone)))); + ], new \DateTime("{$this->year}-01-07", new \DateTimeZone($this->timezone)), $this->locale)); } /** * @throws \InvalidArgumentException + * @throws \Exception */ - private function addDefenceOfTheFatherlandDay() + private function addDefenceOfTheFatherlandDay(): void { if ($this->year < self::DEFENCE_OF_THE_FATHERLAND_START_YEAR) { return; @@ -94,46 +98,50 @@ private function addDefenceOfTheFatherlandDay() $this->addHoliday(new Holiday('defenceOfTheFatherlandDay', [ 'en_US' => 'Defence of the Fatherland Day', 'ru_RU' => 'День защитника Отечества' - ], new \DateTime("{$this->year}-02-23", new \DateTimeZone($this->timezone)))); + ], new \DateTime("{$this->year}-02-23", new \DateTimeZone($this->timezone)), $this->locale)); } /** * @throws \InvalidArgumentException + * @throws \Exception */ - private function addInternationalWomensDay() + private function addInternationalWomensDay(): void { $this->addHoliday(new Holiday('internationalWomensDay', [ 'en_US' => 'International Women\'s Day', 'ru_RU' => 'Международный женский день' - ], new \DateTime("{$this->year}-03-08", new \DateTimeZone($this->timezone)))); + ], new \DateTime("{$this->year}-03-08", new \DateTimeZone($this->timezone)), $this->locale)); } /** * @throws \InvalidArgumentException + * @throws \Exception */ - private function addSpringAndLabourDay() + private function addSpringAndLabourDay(): void { $this->addHoliday(new Holiday('springAndLabourDay', [ 'en_US' => 'Spring and Labour Day', 'ru_RU' => 'Праздник Весны и Труда' - ], new \DateTime("{$this->year}-05-01", new \DateTimeZone($this->timezone)))); + ], new \DateTime("{$this->year}-05-01", new \DateTimeZone($this->timezone)), $this->locale)); } /** * @throws \InvalidArgumentException + * @throws \Exception */ - private function addVictoryDay() + private function addVictoryDay(): void { $this->addHoliday(new Holiday('victoryDay', [ 'en_US' => 'Victory Day', 'ru_RU' => 'День Победы' - ], new \DateTime("{$this->year}-05-09", new \DateTimeZone($this->timezone)))); + ], new \DateTime("{$this->year}-05-09", new \DateTimeZone($this->timezone)), $this->locale)); } /** * @throws \InvalidArgumentException + * @throws \Exception */ - private function addRussiaDay() + private function addRussiaDay(): void { if ($this->year < self::RUSSIA_DAY_START_YEAR) { return; @@ -142,13 +150,14 @@ private function addRussiaDay() $this->addHoliday(new Holiday('russiaDay', [ 'en_US' => 'Russia Day', 'ru_RU' => 'День России' - ], new \DateTime("{$this->year}-06-12", new \DateTimeZone($this->timezone)))); + ], new \DateTime("{$this->year}-06-12", new \DateTimeZone($this->timezone)), $this->locale)); } /** * @throws \InvalidArgumentException + * @throws \Exception */ - private function addUnityDay() + private function addUnityDay(): void { if ($this->year < self::UNITY_DAY_START_YEAR) { return; @@ -157,6 +166,6 @@ private function addUnityDay() $this->addHoliday(new Holiday('unityDay', [ 'en_US' => 'Unity Day', 'ru_RU' => 'День народного единства' - ], new \DateTime("{$this->year}-11-04", new \DateTimeZone($this->timezone)))); + ], new \DateTime("{$this->year}-11-04", new \DateTimeZone($this->timezone)), $this->locale)); } } diff --git a/src/Yasumi/Provider/Slovakia.php b/src/Yasumi/Provider/Slovakia.php index 71163c298..1d85b7776 100644 --- a/src/Yasumi/Provider/Slovakia.php +++ b/src/Yasumi/Provider/Slovakia.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -53,16 +53,17 @@ class Slovakia extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'SK'; + public const ID = 'SK'; /** * Initialize holidays for Slovakia. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Bratislava'; @@ -110,10 +111,12 @@ public function initialize() * * Note: this holiday is common for Czech republic and Slovakia. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateSaintsCyrilAndMethodiusDay() + public function calculateSaintsCyrilAndMethodiusDay(): void { $this->addHoliday(new Holiday( 'saintsCyrilAndMethodiusDay', @@ -133,10 +136,12 @@ public function calculateSaintsCyrilAndMethodiusDay() * * @see https://en.wikipedia.org/wiki/Slovak_National_Uprising * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateSlovakNationalUprisingDay() + public function calculateSlovakNationalUprisingDay(): void { $this->addHoliday(new Holiday( 'slovakNationalUprisingDay', @@ -155,10 +160,12 @@ public function calculateSlovakNationalUprisingDay() * * @see https://en.wikipedia.org/wiki/Constitution_of_Slovakia * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateSlovakConstitutionDay() + public function calculateSlovakConstitutionDay(): void { $this->addHoliday(new Holiday( 'slovakConstitutionDay', @@ -181,10 +188,12 @@ public function calculateSlovakConstitutionDay() * @see https://en.wikipedia.org/wiki/Our_Lady_of_Sorrows * @see https://sk.wikipedia.org/wiki/Sedembolestn%C3%A1_Panna_M%C3%A1ria * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateOurLadyOfSorrowsDay() + public function calculateOurLadyOfSorrowsDay(): void { $this->addHoliday(new Holiday('ourLadyOfSorrowsDay', [ 'sk_SK' => 'Sviatok Sedembolestnej Panny Márie', @@ -197,10 +206,12 @@ public function calculateOurLadyOfSorrowsDay() * * Note: this national day is common for Czech republic and Slovakia. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateStruggleForFreedomAndDemocracyDay() + public function calculateStruggleForFreedomAndDemocracyDay(): void { $this->addHoliday(new Holiday( 'struggleForFreedomAndDemocracyDay', diff --git a/src/Yasumi/Provider/SouthAfrica.php b/src/Yasumi/Provider/SouthAfrica.php index b999d659d..0be7ab47d 100644 --- a/src/Yasumi/Provider/SouthAfrica.php +++ b/src/Yasumi/Provider/SouthAfrica.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -33,16 +33,17 @@ class SouthAfrica extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ZA'; + public const ID = 'ZA'; /** * Initialize holidays for South Africa. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Africa/Johannesburg'; @@ -86,10 +87,12 @@ public function initialize() * * @link http://www.gov.za/about-sa/public-holidays#21march * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateHumanRightsDay() + public function calculateHumanRightsDay(): void { $this->addHoliday(new Holiday( 'humanRightsDay', @@ -106,11 +109,12 @@ public function calculateHumanRightsDay() * * @link http://www.gov.za/sites/www.gov.za/files/Act36of1994.pdf * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateFamilyDay() + public function calculateFamilyDay(): void { $this->addHoliday(new Holiday( 'familyDay', @@ -128,10 +132,12 @@ public function calculateFamilyDay() * @link http://www.gov.za/sites/www.gov.za/files/Act36of1994.pdf * @link http://www.gov.za/freedom-day-2014 * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateFreedomDay() + public function calculateFreedomDay(): void { $this->addHoliday(new Holiday( 'freedomDay', @@ -153,10 +159,12 @@ public function calculateFreedomDay() * @link http://www.gov.za/sites/www.gov.za/files/Act36of1994.pdf * @link http://www.gov.za/youth-day-2014 * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateYouthDay() + public function calculateYouthDay(): void { $this->addHoliday(new Holiday( 'youthDay', @@ -174,10 +182,12 @@ public function calculateYouthDay() * * @link http://www.gov.za/speeches/president-jacob-zuma-declares-3-august-2016-public-holiday-24-jun-2016-0000 * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculate2016MunicipalElectionsDay() + public function calculate2016MunicipalElectionsDay(): void { if ($this->year !== 2016) { return; @@ -201,10 +211,12 @@ public function calculate2016MunicipalElectionsDay() * @link http://www.gov.za/about-sa/public-holidays#women * @link http://www.gov.za/womens-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateNationalWomensDay() + public function calculateNationalWomensDay(): void { $this->addHoliday(new Holiday( 'nationalWomensDay', @@ -224,10 +236,12 @@ public function calculateNationalWomensDay() * @link http://www.gov.za/sites/www.gov.za/files/Act36of1994.pdf * @link http://www.gov.za/heritage-day-2014 * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateHeritageDay() + public function calculateHeritageDay(): void { $this->addHoliday(new Holiday( 'heritageDay', @@ -249,10 +263,12 @@ public function calculateHeritageDay() * @link http://www.gov.za/sites/www.gov.za/files/Act36of1994.pdf * @link http://www.gov.za/day-reconciliation-2014 * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateDayOfReconciliation() + public function calculateDayOfReconciliation(): void { $this->addHoliday(new Holiday( 'reconciliationDay', @@ -273,10 +289,12 @@ public function calculateDayOfReconciliation() * * @link http://www.gov.za/sites/www.gov.za/files/Act36of1994.pdf * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateSubstituteDayOfGoodwill() + public function calculateSubstituteDayOfGoodwill(): void { if ($this->year !== 2016) { return; @@ -296,11 +314,12 @@ public function calculateSubstituteDayOfGoodwill() * The Public Holidays Act (Act No 36 of 1994) determines whenever any public holiday falls on a Sunday, the Monday * following on it shall be a public holiday. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - private function calculateSubstituteHolidays() + private function calculateSubstituteHolidays(): void { $datesIterator = $this->getIterator(); @@ -308,7 +327,7 @@ private function calculateSubstituteHolidays() while ($datesIterator->valid()) { // Exclude Good Friday, Family Day, 2016 Municipal Elections Day as these don't fall in the weekend - if (in_array( + if (\in_array( $datesIterator->current()->shortName, ['goodFriday', 'familyDay', '2016MunicipalElectionsDay'], true diff --git a/src/Yasumi/Provider/Spain.php b/src/Yasumi/Provider/Spain.php index 953ef2b35..27154b754 100755 --- a/src/Yasumi/Provider/Spain.php +++ b/src/Yasumi/Provider/Spain.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -27,16 +27,17 @@ class Spain extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES'; + public const ID = 'ES'; /** * Initialize holidays for Spain. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Madrid'; @@ -70,10 +71,12 @@ public function initialize() * * @link http://en.wikipedia.org/wiki/Fiesta_Nacional_de_España * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateNationalDay() + public function calculateNationalDay(): void { if ($this->year >= 1981) { $this->addHoliday(new Holiday( @@ -94,10 +97,12 @@ public function calculateNationalDay() * * @link http://www.timeanddate.com/holidays/spain/constitution-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateConstitutionDay() + public function calculateConstitutionDay(): void { if ($this->year >= 1978) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Spain/Andalusia.php b/src/Yasumi/Provider/Spain/Andalusia.php index 2479b9873..393d06d95 100755 --- a/src/Yasumi/Provider/Spain/Andalusia.php +++ b/src/Yasumi/Provider/Spain/Andalusia.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -35,16 +35,17 @@ class Andalusia extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-AN'; + public const ID = 'ES-AN'; /** * Initialize holidays for Andalusia (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -65,10 +66,12 @@ public function initialize() * * @link http://en.wikipedia.org/wiki/D%C3%ADa_de_Andaluc%C3%ADa * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateAndalusiaDay() + public function calculateAndalusiaDay(): void { if ($this->year >= 1980) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Spain/Aragon.php b/src/Yasumi/Provider/Spain/Aragon.php index cab86fc6c..0ba419e3b 100755 --- a/src/Yasumi/Provider/Spain/Aragon.php +++ b/src/Yasumi/Provider/Spain/Aragon.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -34,16 +34,17 @@ class Aragon extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-AR'; + public const ID = 'ES-AR'; /** * Initialize holidays for Aragon (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Spain/Asturias.php b/src/Yasumi/Provider/Spain/Asturias.php index e1db2fbe2..51d93e1ec 100755 --- a/src/Yasumi/Provider/Spain/Asturias.php +++ b/src/Yasumi/Provider/Spain/Asturias.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -36,16 +36,17 @@ class Asturias extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-AS'; + public const ID = 'ES-AS'; /** * Initialize holidays for Asturias (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -67,10 +68,12 @@ public function initialize() * * @link http://www.timeanddate.com/holidays/spain/asturias-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateAsturiasDay() + public function calculateAsturiasDay(): void { if ($this->year >= 1984) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Spain/BalearicIslands.php b/src/Yasumi/Provider/Spain/BalearicIslands.php index 001855c8d..24c2d491b 100755 --- a/src/Yasumi/Provider/Spain/BalearicIslands.php +++ b/src/Yasumi/Provider/Spain/BalearicIslands.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -35,16 +35,17 @@ class BalearicIslands extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-IB'; + public const ID = 'ES-IB'; /** * Initialize holidays for Balearic Islands (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -67,10 +68,12 @@ public function initialize() * * @link http://www.timeanddate.com/holidays/spain/the-balearic-islands-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateBalearicIslandsDay() + public function calculateBalearicIslandsDay(): void { if ($this->year >= 1983) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Spain/BasqueCountry.php b/src/Yasumi/Provider/Spain/BasqueCountry.php index 59c088ac5..0ab4d9e36 100755 --- a/src/Yasumi/Provider/Spain/BasqueCountry.php +++ b/src/Yasumi/Provider/Spain/BasqueCountry.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -34,16 +34,17 @@ class BasqueCountry extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-PV'; + public const ID = 'ES-PV'; /** * Initialize holidays for Basque Country (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -67,10 +68,12 @@ public function initialize() * * @link http://www.officeholidays.com/countries/spain/basque_community_day.php * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateBasqueCountryDay() + public function calculateBasqueCountryDay(): void { if ($this->year >= 2011 && $this->year <= 2013) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Spain/CanaryIslands.php b/src/Yasumi/Provider/Spain/CanaryIslands.php index 91ce460d5..78b237648 100755 --- a/src/Yasumi/Provider/Spain/CanaryIslands.php +++ b/src/Yasumi/Provider/Spain/CanaryIslands.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -36,16 +36,17 @@ class CanaryIslands extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-CN'; + public const ID = 'ES-CN'; /** * Initialize holidays for Canary Islands (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); $this->timezone = 'Atlantic/Canary'; @@ -66,10 +67,12 @@ public function initialize() * * @link http://www.timeanddate.com/holidays/spain/canaries-day-observed * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateCanaryIslandsDay() + public function calculateCanaryIslandsDay(): void { if ($this->year >= 1984) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Spain/Cantabria.php b/src/Yasumi/Provider/Spain/Cantabria.php index 5ceb5af52..c58b5ff82 100755 --- a/src/Yasumi/Provider/Spain/Cantabria.php +++ b/src/Yasumi/Provider/Spain/Cantabria.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -36,16 +36,17 @@ class Cantabria extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-CB'; + public const ID = 'ES-CB'; /** * Initialize holidays for Cantabria (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -70,10 +71,12 @@ public function initialize() * * @link http://www.timeanddate.com/holidays/spain/cantabria-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateCantabriaDay() + public function calculateCantabriaDay(): void { if ($this->year >= 1967) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Spain/CastileAndLeon.php b/src/Yasumi/Provider/Spain/CastileAndLeon.php index b64fef1cd..4f1126acb 100755 --- a/src/Yasumi/Provider/Spain/CastileAndLeon.php +++ b/src/Yasumi/Provider/Spain/CastileAndLeon.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -37,16 +37,17 @@ class CastileAndLeon extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-CL'; + public const ID = 'ES-CL'; /** * Initialize holidays for Castile and León (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -67,10 +68,12 @@ public function initialize() * * @link http://en.wikipedia.org/wiki/Castile_and_León_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateCastileAndLeonDay() + public function calculateCastileAndLeonDay(): void { if ($this->year >= 1976) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Spain/CastillaLaMancha.php b/src/Yasumi/Provider/Spain/CastillaLaMancha.php index 2a3099224..bca90b1de 100755 --- a/src/Yasumi/Provider/Spain/CastillaLaMancha.php +++ b/src/Yasumi/Provider/Spain/CastillaLaMancha.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -37,16 +37,17 @@ class CastillaLaMancha extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-CM'; + public const ID = 'ES-CM'; /** * Initialize holidays for Castilla-La Mancha (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -70,10 +71,12 @@ public function initialize() * * @link http://www.timeanddate.com/holidays/spain/castile-la-mancha-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateCastillaLaManchaDay() + public function calculateCastillaLaManchaDay(): void { if ($this->year >= 1984) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Spain/Catalonia.php b/src/Yasumi/Provider/Spain/Catalonia.php index 8e1fb1822..d0c4d1bb3 100755 --- a/src/Yasumi/Provider/Spain/Catalonia.php +++ b/src/Yasumi/Provider/Spain/Catalonia.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -38,16 +38,17 @@ class Catalonia extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-CT'; + public const ID = 'ES-CT'; /** * Initialize holidays for Catalonia (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -70,10 +71,12 @@ public function initialize() * * @link https://en.wikipedia.org/wiki/National_Day_of_Catalonia * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateNationalDayOfCatalonia() + public function calculateNationalDayOfCatalonia(): void { if ($this->year >= 1886) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Spain/Ceuta.php b/src/Yasumi/Provider/Spain/Ceuta.php index 0156ae1c8..a2d99f594 100755 --- a/src/Yasumi/Provider/Spain/Ceuta.php +++ b/src/Yasumi/Provider/Spain/Ceuta.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -35,16 +35,17 @@ class Ceuta extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-CE'; + public const ID = 'ES-CE'; /** * Initialize holidays for Ceuta (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -64,10 +65,12 @@ public function initialize() * * @link http://www.timeanddate.com/holidays/spain/the-independent-city-ceuta-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateDayOfCeuta() + public function calculateDayOfCeuta(): void { if ($this->year >= 1416) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Spain/CommunityOfMadrid.php b/src/Yasumi/Provider/Spain/CommunityOfMadrid.php index 1b47b0592..ffae26b49 100755 --- a/src/Yasumi/Provider/Spain/CommunityOfMadrid.php +++ b/src/Yasumi/Provider/Spain/CommunityOfMadrid.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -37,16 +37,17 @@ class CommunityOfMadrid extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-MD'; + public const ID = 'ES-MD'; /** * Initialize holidays for the Community Of Madrid (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -71,10 +72,12 @@ public function initialize() * * @link http://en.wikipedia.org/wiki/Dos_de_Mayo_Uprising * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateDosdeMayoUprisingDay() + public function calculateDosdeMayoUprisingDay(): void { $this->addHoliday(new Holiday( 'dosdeMayoUprisingDay', diff --git a/src/Yasumi/Provider/Spain/Extremadura.php b/src/Yasumi/Provider/Spain/Extremadura.php index 44c955475..2a47a2405 100755 --- a/src/Yasumi/Provider/Spain/Extremadura.php +++ b/src/Yasumi/Provider/Spain/Extremadura.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -36,16 +36,17 @@ class Extremadura extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-EX'; + public const ID = 'ES-EX'; /** * Initialize holidays for Extremadura (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -67,10 +68,12 @@ public function initialize() * * @link http://www.timeanddate.com/holidays/spain/extremadura-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateDayOfExtremadura() + public function calculateDayOfExtremadura(): void { if ($this->year >= 1985) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Spain/Galicia.php b/src/Yasumi/Provider/Spain/Galicia.php index 7ad63a582..383a47695 100755 --- a/src/Yasumi/Provider/Spain/Galicia.php +++ b/src/Yasumi/Provider/Spain/Galicia.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -36,16 +36,17 @@ class Galicia extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-GA'; + public const ID = 'ES-GA'; /** * Initialize holidays for Galicia (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -68,10 +69,12 @@ public function initialize() * * @link http://en.wikipedia.org/wiki/Galician_Literature_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateGalicianLiteratureDay() + public function calculateGalicianLiteratureDay(): void { if ($this->year >= 1991) { $this->addHoliday(new Holiday('galicianLiteratureDay', [ @@ -94,10 +97,12 @@ public function calculateGalicianLiteratureDay() * * @link http://www.timeanddate.com/holidays/spain/santiago-apostle * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateStJamesDay() + public function calculateStJamesDay(): void { if ($this->year >= 2000) { $this->addHoliday(new Holiday('stJamesDay', [ diff --git a/src/Yasumi/Provider/Spain/LaRioja.php b/src/Yasumi/Provider/Spain/LaRioja.php index 200ac91e6..36bd6e973 100755 --- a/src/Yasumi/Provider/Spain/LaRioja.php +++ b/src/Yasumi/Provider/Spain/LaRioja.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -35,16 +35,17 @@ class LaRioja extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-RI'; + public const ID = 'ES-RI'; /** * Initialize holidays for La Rioja (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -64,10 +65,12 @@ public function initialize() * * @link http://www.timeanddate.com/holidays/spain/rioja-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateLaRiojaDay() + public function calculateLaRiojaDay(): void { if ($this->year >= 1983) { $this->addHoliday(new Holiday('laRiojaDay', [ diff --git a/src/Yasumi/Provider/Spain/Melilla.php b/src/Yasumi/Provider/Spain/Melilla.php index 31983d17f..44fe9fc74 100755 --- a/src/Yasumi/Provider/Spain/Melilla.php +++ b/src/Yasumi/Provider/Spain/Melilla.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -33,16 +33,17 @@ class Melilla extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-ML'; + public const ID = 'ES-ML'; /** * Initialize holidays for Melilla (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Spain/Navarre.php b/src/Yasumi/Provider/Spain/Navarre.php index fb4860abb..3edfe3887 100755 --- a/src/Yasumi/Provider/Spain/Navarre.php +++ b/src/Yasumi/Provider/Spain/Navarre.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -33,16 +33,17 @@ class Navarre extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-NC'; + public const ID = 'ES-NC'; /** * Initialize holidays for Navarre (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Spain/RegionOfMurcia.php b/src/Yasumi/Provider/Spain/RegionOfMurcia.php index 2bd991e8e..2962015d9 100755 --- a/src/Yasumi/Provider/Spain/RegionOfMurcia.php +++ b/src/Yasumi/Provider/Spain/RegionOfMurcia.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -35,16 +35,17 @@ class RegionOfMurcia extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-MC'; + public const ID = 'ES-MC'; /** * Initialize holidays for the Region of Murcia (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -65,10 +66,12 @@ public function initialize() * * @link http://www.timeanddate.com/holidays/spain/murcia-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateDayOfMurcia() + public function calculateDayOfMurcia(): void { if ($this->year >= 1983) { $this->addHoliday(new Holiday('murciaDay', [ diff --git a/src/Yasumi/Provider/Spain/ValencianCommunity.php b/src/Yasumi/Provider/Spain/ValencianCommunity.php index a8fd4545a..c5a0b1582 100755 --- a/src/Yasumi/Provider/Spain/ValencianCommunity.php +++ b/src/Yasumi/Provider/Spain/ValencianCommunity.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Spain; @@ -38,16 +38,17 @@ class ValencianCommunity extends Spain * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'ES-VC'; + public const ID = 'ES-VC'; /** * Initialize holidays for the Valencian Community (Spain). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -72,10 +73,12 @@ public function initialize() * * @link http://www.timeanddate.com/holidays/spain/the-valencian-community-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateValencianCommunityDay() + public function calculateValencianCommunityDay(): void { if ($this->year >= 1239) { $this->addHoliday(new Holiday('valencianCommunityDay', [ diff --git a/src/Yasumi/Provider/Sweden.php b/src/Yasumi/Provider/Sweden.php index c532b0262..f8a6a1401 100644 --- a/src/Yasumi/Provider/Sweden.php +++ b/src/Yasumi/Provider/Sweden.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -28,16 +28,17 @@ class Sweden extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'SE'; + public const ID = 'SE'; /** * Initialize holidays for Sweden. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Stockholm'; @@ -76,11 +77,12 @@ public function initialize() * * @link https://en.wikipedia.org/wiki/Midsummer#Sweden * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateStJohnsDay() + public function calculateStJohnsDay(): void { $date = new DateTime("$this->year-6-20", new DateTimeZone($this->timezone)); // Default date @@ -111,11 +113,12 @@ public function calculateStJohnsDay() * @link https://en.wikipedia.org/wiki/All_Saints%27_Day * @link http://www.timeanddate.com/holidays/sweden/all-saints-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateAllSaintsDay() + public function calculateAllSaintsDay(): void { $date = new DateTime("$this->year-10-31", new DateTimeZone($this->timezone)); @@ -139,10 +142,12 @@ public function calculateAllSaintsDay() * Olympic Stadium, in honour of the election of King Gustav Vasa in 1523, as this was considered the foundation of * modern Sweden. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateNationalDay() + public function calculateNationalDay(): void { if ($this->year < 1916) { return; diff --git a/src/Yasumi/Provider/Switzerland.php b/src/Yasumi/Provider/Switzerland.php index 56a4aa830..ba43389c1 100644 --- a/src/Yasumi/Provider/Switzerland.php +++ b/src/Yasumi/Provider/Switzerland.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -28,15 +28,17 @@ class Switzerland extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH'; + public const ID = 'CH'; /** * Initialize holidays for Switzerland. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Zurich'; @@ -52,10 +54,13 @@ public function initialize() * * @link https://en.wikipedia.org/wiki/Swiss_National_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - public function calculateNationalDay() + public function calculateNationalDay(): void { $translations = [ 'en_US' => 'National Day', @@ -95,10 +100,12 @@ public function calculateNationalDay() * * @link https://en.wikipedia.org/wiki/Berchtoldstag * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateBerchtoldsTag() + public function calculateBerchtoldsTag(): void { $this->addHoliday(new Holiday( 'berchtoldsTag', @@ -125,11 +132,12 @@ public function calculateBerchtoldsTag() * * @link https://en.wikipedia.org/wiki/Federal_Day_of_Thanksgiving,_Repentance_and_Prayer * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateBettagsMontag() + public function calculateBettagsMontag(): void { if ($this->year >= 1832) { // Find third Sunday of September diff --git a/src/Yasumi/Provider/Switzerland/Aargau.php b/src/Yasumi/Provider/Switzerland/Aargau.php index c3dc811f9..7d47ff712 100644 --- a/src/Yasumi/Provider/Switzerland/Aargau.php +++ b/src/Yasumi/Provider/Switzerland/Aargau.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Aargau extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-AG'; + public const ID = 'CH-AG'; /** * Initialize holidays for Aargau (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/AppenzellAusserrhoden.php b/src/Yasumi/Provider/Switzerland/AppenzellAusserrhoden.php index a3d3ce8d6..65bf4a492 100644 --- a/src/Yasumi/Provider/Switzerland/AppenzellAusserrhoden.php +++ b/src/Yasumi/Provider/Switzerland/AppenzellAusserrhoden.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class AppenzellAusserrhoden extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-AR'; + public const ID = 'CH-AR'; /** * Initialize holidays for Appenzell Ausserrhoden (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/AppenzellInnerrhoden.php b/src/Yasumi/Provider/Switzerland/AppenzellInnerrhoden.php index 3f5ddd7b6..c466071b7 100644 --- a/src/Yasumi/Provider/Switzerland/AppenzellInnerrhoden.php +++ b/src/Yasumi/Provider/Switzerland/AppenzellInnerrhoden.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class AppenzellInnerrhoden extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-AI'; + public const ID = 'CH-AI'; /** * Initialize holidays for Appenzell Innerrhoden (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/BaselLandschaft.php b/src/Yasumi/Provider/Switzerland/BaselLandschaft.php index 98e64e0dc..9757483eb 100644 --- a/src/Yasumi/Provider/Switzerland/BaselLandschaft.php +++ b/src/Yasumi/Provider/Switzerland/BaselLandschaft.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class BaselLandschaft extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-BL'; + public const ID = 'CH-BL'; /** * Initialize holidays for Basel-Landschaft (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/BaselStadt.php b/src/Yasumi/Provider/Switzerland/BaselStadt.php index 7283d33e8..00bbb1970 100644 --- a/src/Yasumi/Provider/Switzerland/BaselStadt.php +++ b/src/Yasumi/Provider/Switzerland/BaselStadt.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class BaselStadt extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-BS'; + public const ID = 'CH-BS'; /** * Initialize holidays for Basel-Stadt (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Bern.php b/src/Yasumi/Provider/Switzerland/Bern.php index 072ef9469..65515f457 100644 --- a/src/Yasumi/Provider/Switzerland/Bern.php +++ b/src/Yasumi/Provider/Switzerland/Bern.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Bern extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-BE'; + public const ID = 'CH-BE'; /** * Initialize holidays for Bern (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Fribourg.php b/src/Yasumi/Provider/Switzerland/Fribourg.php index 20387f1e2..bdf5f25fa 100644 --- a/src/Yasumi/Provider/Switzerland/Fribourg.php +++ b/src/Yasumi/Provider/Switzerland/Fribourg.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Fribourg extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-FR'; + public const ID = 'CH-FR'; /** * Initialize holidays for Fribourg (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Geneva.php b/src/Yasumi/Provider/Switzerland/Geneva.php index 3bc1ad6ac..eb0d600bc 100644 --- a/src/Yasumi/Provider/Switzerland/Geneva.php +++ b/src/Yasumi/Provider/Switzerland/Geneva.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -32,16 +32,17 @@ class Geneva extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-GE'; + public const ID = 'CH-GE'; /** * Initialize holidays for Geneva (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -64,11 +65,12 @@ public function initialize() * * @link https://en.wikipedia.org/wiki/Je%C3%BBne_genevois * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateJeuneGenevois() + public function calculateJeuneGenevois(): void { // Find first Sunday of September $date = new DateTime('First Sunday of ' . $this->year . '-09', new DateTimeZone($this->timezone)); @@ -98,10 +100,12 @@ public function calculateJeuneGenevois() * * @link https://fr.wikipedia.org/wiki/Restauration_genevoise * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateRestaurationGenevoise() + public function calculateRestaurationGenevoise(): void { if ($this->year > 1813) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Switzerland/Glarus.php b/src/Yasumi/Provider/Switzerland/Glarus.php index 7995b6b8b..57ca3f79b 100644 --- a/src/Yasumi/Provider/Switzerland/Glarus.php +++ b/src/Yasumi/Provider/Switzerland/Glarus.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -31,16 +31,17 @@ class Glarus extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-GL'; + public const ID = 'CH-GL'; /** * Initialize holidays for Glarus (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -66,10 +67,12 @@ public function initialize() * * @link https://en.wikipedia.org/wiki/Battle_of_N%C3%A4fels * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateNafelserFahrt() + public function calculateNafelserFahrt(): void { if ($this->year >= 1389) { $date = new DateTime('First Thursday of ' . $this->year . '-04', new DateTimeZone($this->timezone)); diff --git a/src/Yasumi/Provider/Switzerland/Grisons.php b/src/Yasumi/Provider/Switzerland/Grisons.php index 68c6e1631..80fcdc279 100644 --- a/src/Yasumi/Provider/Switzerland/Grisons.php +++ b/src/Yasumi/Provider/Switzerland/Grisons.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Grisons extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-GR'; + public const ID = 'CH-GR'; /** * Initialize holidays for Grisons (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Jura.php b/src/Yasumi/Provider/Switzerland/Jura.php index 6b909805a..ed2cf2975 100644 --- a/src/Yasumi/Provider/Switzerland/Jura.php +++ b/src/Yasumi/Provider/Switzerland/Jura.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -31,16 +31,17 @@ class Jura extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-JU'; + public const ID = 'CH-JU'; /** * Initialize holidays for Jura (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -69,10 +70,12 @@ public function initialize() * * @link https://fr.wikipedia.org/wiki/Pl%C3%A9biscite_jurassien * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculatePlebisciteJurassien() + public function calculatePlebisciteJurassien(): void { if ($this->year > 1974) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Switzerland/Lucerne.php b/src/Yasumi/Provider/Switzerland/Lucerne.php index bccfbe570..89115995d 100644 --- a/src/Yasumi/Provider/Switzerland/Lucerne.php +++ b/src/Yasumi/Provider/Switzerland/Lucerne.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Lucerne extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-LU'; + public const ID = 'CH-LU'; /** * Initialize holidays for Lucerne (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Neuchatel.php b/src/Yasumi/Provider/Switzerland/Neuchatel.php index b3c68a982..51e0fd2d8 100644 --- a/src/Yasumi/Provider/Switzerland/Neuchatel.php +++ b/src/Yasumi/Provider/Switzerland/Neuchatel.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -31,16 +31,17 @@ class Neuchatel extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-NE'; + public const ID = 'CH-NE'; /** * Initialize holidays for Neuchâtel (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -67,10 +68,12 @@ public function initialize() * * @link https://www.feiertagskalender.ch/feiertag.php?ft_id=11&geo=3056&hl=fr * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateInstaurationRepublique() + public function calculateInstaurationRepublique(): void { if ($this->year > 1848) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Switzerland/Nidwalden.php b/src/Yasumi/Provider/Switzerland/Nidwalden.php index 6cb429cc3..98276f72e 100644 --- a/src/Yasumi/Provider/Switzerland/Nidwalden.php +++ b/src/Yasumi/Provider/Switzerland/Nidwalden.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Nidwalden extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-NW'; + public const ID = 'CH-NW'; /** * Initialize holidays for Nidwalden (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Obwalden.php b/src/Yasumi/Provider/Switzerland/Obwalden.php index 2f89c5883..b6c4423e8 100644 --- a/src/Yasumi/Provider/Switzerland/Obwalden.php +++ b/src/Yasumi/Provider/Switzerland/Obwalden.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -31,16 +31,17 @@ class Obwalden extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-OW'; + public const ID = 'CH-OW'; /** * Initialize holidays for Obwalden (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -70,10 +71,13 @@ public function initialize() * * @link http://www.lebendigetraditionen.ch/traditionen/00210/index.html?lang=en * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception + * @throws \Exception */ - public function calculateBruderKlausenFest() + public function calculateBruderKlausenFest(): void { if ($this->year >= 1947) { $this->addHoliday(new Holiday( diff --git a/src/Yasumi/Provider/Switzerland/Schaffhausen.php b/src/Yasumi/Provider/Switzerland/Schaffhausen.php index 1a92e528a..b36b48f82 100644 --- a/src/Yasumi/Provider/Switzerland/Schaffhausen.php +++ b/src/Yasumi/Provider/Switzerland/Schaffhausen.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Schaffhausen extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-SH'; + public const ID = 'CH-SH'; /** * Initialize holidays for Schaffhausen (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Schwyz.php b/src/Yasumi/Provider/Switzerland/Schwyz.php index c5e54476e..661f1b110 100644 --- a/src/Yasumi/Provider/Switzerland/Schwyz.php +++ b/src/Yasumi/Provider/Switzerland/Schwyz.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Schwyz extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-SZ'; + public const ID = 'CH-SZ'; /** * Initialize holidays for Schwyz (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Solothurn.php b/src/Yasumi/Provider/Switzerland/Solothurn.php index d204362c2..c0c19a318 100644 --- a/src/Yasumi/Provider/Switzerland/Solothurn.php +++ b/src/Yasumi/Provider/Switzerland/Solothurn.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Solothurn extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-SO'; + public const ID = 'CH-SO'; /** * Initialize holidays for Solothurn (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/StGallen.php b/src/Yasumi/Provider/Switzerland/StGallen.php index dbca20144..9dc34c694 100644 --- a/src/Yasumi/Provider/Switzerland/StGallen.php +++ b/src/Yasumi/Provider/Switzerland/StGallen.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class StGallen extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-SG'; + public const ID = 'CH-SG'; /** * Initialize holidays for St. Gallen (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Thurgau.php b/src/Yasumi/Provider/Switzerland/Thurgau.php index c71d76118..fdc7effa3 100644 --- a/src/Yasumi/Provider/Switzerland/Thurgau.php +++ b/src/Yasumi/Provider/Switzerland/Thurgau.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Thurgau extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-TG'; + public const ID = 'CH-TG'; /** * Initialize holidays for Thurgau (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Ticino.php b/src/Yasumi/Provider/Switzerland/Ticino.php index cf043c1df..ea4ab8650 100644 --- a/src/Yasumi/Provider/Switzerland/Ticino.php +++ b/src/Yasumi/Provider/Switzerland/Ticino.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -31,16 +31,17 @@ class Ticino extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-TI'; + public const ID = 'CH-TI'; /** * Initialize holidays for Ticino (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); @@ -76,10 +77,12 @@ public function initialize() * * @link https://en.wikipedia.org/wiki/Feast_of_Saints_Peter_and_Paul * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateStPeterPaul() + public function calculateStPeterPaul(): void { $this->addHoliday(new Holiday( 'stPeterPaul', diff --git a/src/Yasumi/Provider/Switzerland/Uri.php b/src/Yasumi/Provider/Switzerland/Uri.php index 012c7a85b..191ac8cd5 100644 --- a/src/Yasumi/Provider/Switzerland/Uri.php +++ b/src/Yasumi/Provider/Switzerland/Uri.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Uri extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-UR'; + public const ID = 'CH-UR'; /** * Initialize holidays for Uri (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Valais.php b/src/Yasumi/Provider/Switzerland/Valais.php index 7353a31c4..ca49019c7 100644 --- a/src/Yasumi/Provider/Switzerland/Valais.php +++ b/src/Yasumi/Provider/Switzerland/Valais.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Valais extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-VS'; + public const ID = 'CH-VS'; /** * Initialize holidays for Valais (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Vaud.php b/src/Yasumi/Provider/Switzerland/Vaud.php index 04d387ddc..8ebab708d 100644 --- a/src/Yasumi/Provider/Switzerland/Vaud.php +++ b/src/Yasumi/Provider/Switzerland/Vaud.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Vaud extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-VD'; + public const ID = 'CH-VD'; /** * Initialize holidays for Vaud (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Zug.php b/src/Yasumi/Provider/Switzerland/Zug.php index 7b14ac71f..0e5678d70 100644 --- a/src/Yasumi/Provider/Switzerland/Zug.php +++ b/src/Yasumi/Provider/Switzerland/Zug.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Zug extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-ZG'; + public const ID = 'CH-ZG'; /** * Initialize holidays for Zug (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/Switzerland/Zurich.php b/src/Yasumi/Provider/Switzerland/Zurich.php index d149e5387..d95d4b763 100644 --- a/src/Yasumi/Provider/Switzerland/Zurich.php +++ b/src/Yasumi/Provider/Switzerland/Zurich.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider\Switzerland; @@ -29,16 +29,17 @@ class Zurich extends Switzerland * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'CH-ZH'; + public const ID = 'CH-ZH'; /** * Initialize holidays for Zürich (Switzerland). * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { parent::initialize(); diff --git a/src/Yasumi/Provider/USA.php b/src/Yasumi/Provider/USA.php index c1bf876d8..5d353a5d6 100755 --- a/src/Yasumi/Provider/USA.php +++ b/src/Yasumi/Provider/USA.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -28,16 +28,17 @@ class USA extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'US'; + public const ID = 'US'; /** * Initialize holidays for the USA. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'America/New_York'; @@ -47,53 +48,52 @@ public function initialize() // Add Christian holidays $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale)); - /** - * Dr. Martin Luther King Day. - * - * Honors Dr. Martin Luther King, Jr., Civil Rights leader, who was actually born on January 15, 1929; combined - * with other holidays in several states. It is observed on the third Monday of January since 1986. - * - * @link http://en.wikipedia.org/wiki/Martin_Luther_King,_Jr._Day - */ + // Calculate other holidays + $this->calculateMartinLutherKingday(); + $this->calculateWashingtonsBirthday(); + $this->calculateMemorialDay(); + $this->calculateIndependenceDay(); + $this->calculateLabourDay(); + $this->calculateColumbusDay(); + $this->calculateVeteransDay(); + $this->calculateThanksgivingDay(); + + $this->calculateSubstituteHolidays(); + } + + /** + * Dr. Martin Luther King Day. + * + * Honors Dr. Martin Luther King, Jr., Civil Rights leader, who was actually born on January 15, 1929; combined + * with other holidays in several states. It is observed on the third Monday of January since 1986. + * + * @link http://en.wikipedia.org/wiki/Martin_Luther_King,_Jr._Day + * + * @throws \Exception + */ + private function calculateMartinLutherKingday(): void + { if ($this->year >= 1986) { $this->addHoliday(new Holiday('martinLutherKingDay', [ 'en_US' => 'Dr. Martin Luther King Jr\'s Birthday', ], new DateTime("third monday of january $this->year", new DateTimeZone($this->timezone)), $this->locale)); } + } - /** - * Washington's Birthday. - * - * Washington's Birthday is a United States federal holiday celebrated on the third Monday of February in honor - * of George Washington, the first President of the United States. Colloquially, it is widely known as - * Presidents Day and is often an occasion to remember all the presidents. - * - * Washington's Birthday was first declared a federal holiday by an 1879 act of Congress. The Uniform Holidays - * Act, 1968 shifted the date of the commemoration of Washington's Birthday from February 22 to the third Monday - * in February. - * - * @link http://en.wikipedia.org/wiki/Washington%27s_Birthday - */ - if ($this->year >= 1879) { - $date = new DateTime("$this->year-2-22", new DateTimeZone($this->timezone)); - if ($this->year >= 1968) { - $date = new DateTime("third monday of february $this->year", new DateTimeZone($this->timezone)); - } - $this->addHoliday(new Holiday('washingtonsBirthday', [ - 'en_US' => 'Washington\'s Birthday', - ], $date, $this->locale)); - } - - /** - * Memorial Day. - * - * Honors the nation's war dead from the Civil War onwards; marks the unofficial beginning of the summer season. - * - * Memorial Day was first declared a federal holiday on May 1, 1865. The Uniform Holidays Act, 1968 shifted the - * date of the commemoration of Memorial Day from May 30 to the last Monday in May. - * - * @link http://en.wikipedia.org/wiki/Memorial_Day - */ + /** + * Memorial Day. + * + * Honors the nation's war dead from the Civil War onwards; marks the unofficial beginning of the summer season. + * + * Memorial Day was first declared a federal holiday on May 1, 1865. The Uniform Holidays Act, 1968 shifted the + * date of the commemoration of Memorial Day from May 30 to the last Monday in May. + * + * @link http://en.wikipedia.org/wiki/Memorial_Day + * + * @throws \Exception + */ + private function calculateMemorialDay(): void + { if ($this->year >= 1865) { $date = new DateTime("$this->year-5-30", new DateTimeZone($this->timezone)); if ($this->year >= 1968) { @@ -103,31 +103,41 @@ public function initialize() 'en_US' => 'Memorial Day', ], $date, $this->locale)); } + } - /** - * Independence Day. - * - * Independence Day, commonly known as the Fourth of July or July Fourth, is a federal holiday in the United - * States commemorating the adoption of the Declaration of Independence on July 4, 1776, declaring independence - * from Great Britain. In case Independence Day falls on a Sunday, a substituted holiday is observed the - * following Monday. If it falls on a Saturday, a substituted holiday is observed the previous Friday. - * - * @link http://en.wikipedia.org/wiki/Independence_Day_(United_States) - */ + /** + * Independence Day. + * + * Independence Day, commonly known as the Fourth of July or July Fourth, is a federal holiday in the United + * States commemorating the adoption of the Declaration of Independence on July 4, 1776, declaring independence + * from Great Britain. In case Independence Day falls on a Sunday, a substituted holiday is observed the + * following Monday. If it falls on a Saturday, a substituted holiday is observed the previous Friday. + * + * @link http://en.wikipedia.org/wiki/Independence_Day_(United_States) + * + * @throws \Exception + */ + private function calculateIndependenceDay(): void + { if ($this->year >= 1776) { $this->addHoliday(new Holiday('independenceDay', [ 'en_US' => 'Independence Day', ], new DateTime("$this->year-7-4", new DateTimeZone($this->timezone)), $this->locale)); } + } - /** - * Labour Day. - * - * Labor Day in the United States is a holiday celebrated on the first Monday in September. It is a celebration - * of the American labor movement and is dedicated to the social and economic achievements of workers. - * - * @link http://en.wikipedia.org/wiki/Labor_Day - */ + /** + * Labour Day. + * + * Labor Day in the United States is a holiday celebrated on the first Monday in September. It is a celebration + * of the American labor movement and is dedicated to the social and economic achievements of workers. + * + * @link http://en.wikipedia.org/wiki/Labor_Day + * + * @throws \Exception + */ + private function calculateLabourDay(): void + { if ($this->year >= 1887) { $this->addHoliday(new Holiday( 'labourDay', @@ -138,18 +148,23 @@ public function initialize() $this->locale )); } + } - /** - * Columbus Day. - * - * Honors Christopher Columbus, traditional discoverer of the Americas. In some areas it is also a celebration - * of Indigenous Peoples, or Italian culture and heritage. (traditionally October 12). Columbus Day first became - * an official state holiday in Colorado in 1906, and became a federal holiday in the United States in 1937, - * though people have celebrated Columbus's voyage since the colonial period. Since 1970 (Oct. 12), the holiday - * has been fixed to the second Monday in October. - * - * @link http://en.wikipedia.org/wiki/Columbus_Day - */ + /** + * Columbus Day. + * + * Honors Christopher Columbus, traditional discoverer of the Americas. In some areas it is also a celebration + * of Indigenous Peoples, or Italian culture and heritage. (traditionally October 12). Columbus Day first became + * an official state holiday in Colorado in 1906, and became a federal holiday in the United States in 1937, + * though people have celebrated Columbus's voyage since the colonial period. Since 1970 (Oct. 12), the holiday + * has been fixed to the second Monday in October. + * + * @link http://en.wikipedia.org/wiki/Columbus_Day + * + * @throws \Exception + */ + private function calculateColumbusDay(): void + { if ($this->year >= 1937) { $date = new DateTime("$this->year-10-12", new DateTimeZone($this->timezone)); if ($this->year >= 1970) { @@ -159,16 +174,21 @@ public function initialize() 'en_US' => 'Columbus Day', ], $date, $this->locale)); } + } - /** - * Veterans Day. - * - * Veterans Day is an official United States holiday that honors people who have served in the U.S. Armed Forces - * also known as veterans. It is a federal holiday that is observed on November 11 since 1919. Congress amended - * a bill on June 1, 1954, replacing "Armistice" with "Veterans," and it has been known as Veterans Day since. - * - * @link http://en.wikipedia.org/wiki/Veterans_Day - */ + /** + * Veterans Day. + * + * Veterans Day is an official United States holiday that honors people who have served in the U.S. Armed Forces + * also known as veterans. It is a federal holiday that is observed on November 11 since 1919. Congress amended + * a bill on June 1, 1954, replacing "Armistice" with "Veterans," and it has been known as Veterans Day since. + * + * @link http://en.wikipedia.org/wiki/Veterans_Day + * + * @throws \Exception + */ + private function calculateVeteransDay(): void + { if ($this->year >= 1919) { $name = ($this->year < 1954) ? 'Armistice Day' : 'Veterans Day'; @@ -176,17 +196,22 @@ public function initialize() 'en_US' => $name, ], new DateTime("$this->year-11-11", new DateTimeZone($this->timezone)), $this->locale)); } + } - /** - * Thanksgiving Day. - * - * Thanksgiving, or Thanksgiving Day, is a holiday celebrated in the United States on the fourth Thursday in - * November. It has been celebrated as a federal holiday every year since 1863, when, during the Civil War, - * President Abraham Lincoln proclaimed a national day of "Thanksgiving and Praise to our beneficent Father who - * dwelleth in the Heavens", to be celebrated on the last Thursday in November. - * - * @link http://en.wikipedia.org/wiki/Thanksgiving_(United_States) - */ + /** + * Thanksgiving Day. + * + * Thanksgiving, or Thanksgiving Day, is a holiday celebrated in the United States on the fourth Thursday in + * November. It has been celebrated as a federal holiday every year since 1863, when, during the Civil War, + * President Abraham Lincoln proclaimed a national day of "Thanksgiving and Praise to our beneficent Father who + * dwelleth in the Heavens", to be celebrated on the last Thursday in November. + * + * @link http://en.wikipedia.org/wiki/Thanksgiving_(United_States) + * + * @throws \Exception + */ + private function calculateThanksgivingDay(): void + { if ($this->year >= 1863) { $this->addHoliday(new Holiday( 'thanksgivingDay', @@ -197,8 +222,34 @@ public function initialize() $this->locale )); } + } - $this->calculateSubstituteHolidays(); + /** + * Washington's Birthday. + * + * Washington's Birthday is a United States federal holiday celebrated on the third Monday of February in honor + * of George Washington, the first President of the United States. Colloquially, it is widely known as + * Presidents Day and is often an occasion to remember all the presidents. + * + * Washington's Birthday was first declared a federal holiday by an 1879 act of Congress. The Uniform Holidays + * Act, 1968 shifted the date of the commemoration of Washington's Birthday from February 22 to the third Monday + * in February. + * + * @link http://en.wikipedia.org/wiki/Washington%27s_Birthday + * + * @throws \Exception + */ + private function calculateWashingtonsBirthday(): void + { + if ($this->year >= 1879) { + $date = new DateTime("$this->year-2-22", new DateTimeZone($this->timezone)); + if ($this->year >= 1968) { + $date = new DateTime("third monday of february $this->year", new DateTimeZone($this->timezone)); + } + $this->addHoliday(new Holiday('washingtonsBirthday', [ + 'en_US' => 'Washington\'s Birthday', + ], $date, $this->locale)); + } } /** @@ -207,11 +258,12 @@ public function initialize() * When New Year's Day, Independence Day, or Christmas Day falls on a Saturday, the previous day is also a holiday. * When one of these holidays fall on a Sunday, the next day is also a holiday. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - private function calculateSubstituteHolidays() + private function calculateSubstituteHolidays(): void { $datesIterator = $this->getIterator(); $substituteHoliday = null; @@ -220,7 +272,7 @@ private function calculateSubstituteHolidays() while ($datesIterator->valid()) { // Only process New Year's Day, Independence Day, or Christmas Day - if (in_array( + if (\in_array( $datesIterator->current()->shortName, ['newYearsDay', 'independenceDay', 'christmasDay'], true diff --git a/src/Yasumi/Provider/Ukraine.php b/src/Yasumi/Provider/Ukraine.php index 580fdb855..22608a876 100644 --- a/src/Yasumi/Provider/Ukraine.php +++ b/src/Yasumi/Provider/Ukraine.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -30,16 +30,17 @@ class Ukraine extends AbstractProvider * Code to identify this Holiday Provider. * Typically this is the ISO3166 code corresponding to the respective country or sub-region. */ - const ID = 'UA'; + public const ID = 'UA'; /** * Initialize holidays for Ukraine. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/Kiev'; @@ -64,10 +65,12 @@ public function initialize() /** * Christmas Day. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateChristmasDay() + public function calculateChristmasDay(): void { $this->addHoliday(new Holiday( 'christmasDay', @@ -85,10 +88,12 @@ public function calculateChristmasDay() * * @link https://en.wikipedia.org/wiki/International_Women%27s_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateInternationalWomensDay() + public function calculateInternationalWomensDay(): void { $this->addHoliday(new Holiday( 'internationalWomensDay', @@ -103,10 +108,12 @@ public function calculateInternationalWomensDay() * * @link https://en.wikipedia.org/wiki/International_Workers%27_Day#Ukraine * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateSecondInternationalWorkersDay() + public function calculateSecondInternationalWorkersDay(): void { $this->addHoliday(new Holiday('secondInternationalWorkersDay', [ 'uk_UA' => 'День міжнародної солідарності трудящих', @@ -125,10 +132,12 @@ public function calculateSecondInternationalWorkersDay() * * @link https://en.wikipedia.org/wiki/Victory_Day_over_Nazism_in_World_War_II * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateVictoryDay() + public function calculateVictoryDay(): void { $this->addHoliday(new Holiday( 'victoryDay', @@ -145,10 +154,12 @@ public function calculateVictoryDay() * * @link https://en.wikipedia.org/wiki/Constitution_Day_(Ukraine) * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateConstitutionDay() + public function calculateConstitutionDay(): void { if ($this->year < 1996) { return; @@ -171,10 +182,12 @@ public function calculateConstitutionDay() * * @link https://en.wikipedia.org/wiki/Declaration_of_Independence_of_Ukraine * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateIndependenceDay() + public function calculateIndependenceDay(): void { if ($this->year < 1991) { return; @@ -198,10 +211,12 @@ public function calculateIndependenceDay() * * @link https://en.wikipedia.org/wiki/Defender_of_Ukraine_Day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateDefenderOfUkraineDay() + public function calculateDefenderOfUkraineDay(): void { if ($this->year < 2015) { return; @@ -222,7 +237,7 @@ public function calculateDefenderOfUkraineDay() * @return \DateTime * @throws \Exception */ - public function calculateEaster($year, $timezone) + public function calculateEaster($year, $timezone): \DateTime { return $this->calculateOrthodoxEaster($year, $timezone); } diff --git a/src/Yasumi/Provider/UnitedKingdom.php b/src/Yasumi/Provider/UnitedKingdom.php index 2f5b6b2ef..68aea9c30 100644 --- a/src/Yasumi/Provider/UnitedKingdom.php +++ b/src/Yasumi/Provider/UnitedKingdom.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\Provider; @@ -29,16 +29,17 @@ class UnitedKingdom extends AbstractProvider * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective * country or sub-region. */ - const ID = 'GB'; + public const ID = 'GB'; /** * Initialize holidays for the United Kingdom. * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function initialize() + public function initialize(): void { $this->timezone = 'Europe/London'; @@ -66,10 +67,12 @@ public function initialize() * @link https://en.wikipedia.org/wiki/Public_holidays_in_the_United_Kingdom * @link http://www.timeanddate.com/holidays/uk/new-year-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function calculateNewYearsDay() + public function calculateNewYearsDay(): void { // Before 1871 it was not an observed or statutory holiday if ($this->year < 1871) { @@ -84,7 +87,7 @@ public function calculateNewYearsDay() $newYearsDay = new DateTime("$this->year-01-01", new DateTimeZone($this->timezone)); // If New Years Day falls on a Saturday or Sunday, it is observed the next Monday (January 2nd or 3rd) - if (in_array((int)$newYearsDay->format('w'), [0, 6], true)) { + if (\in_array((int)$newYearsDay->format('w'), [0, 6], true)) { $newYearsDay->modify('next monday'); } @@ -103,10 +106,12 @@ public function calculateNewYearsDay() * * @link http://www.timeanddate.com/holidays/uk/early-may-bank-holiday * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - private function calculateMayDayBankHoliday() + private function calculateMayDayBankHoliday(): void { // From 1978, by Royal Proclamation annually if ($this->year < 1978) { @@ -133,10 +138,12 @@ private function calculateMayDayBankHoliday() * @link http://www.timeanddate.com/holidays/uk/spring-bank-holiday * @link https://en.wikipedia.org/wiki/Public_holidays_in_the_United_Kingdom * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - private function calculateSpringBankHoliday() + private function calculateSpringBankHoliday(): void { // Statutory bank holiday from 1971, following a trial period from 1965 to 1970. if ($this->year < 1965) { @@ -163,10 +170,12 @@ private function calculateSpringBankHoliday() * @link https://www.timeanddate.com/holidays/uk/summer-bank-holiday * @link https://en.wikipedia.org/wiki/Public_holidays_in_the_United_Kingdom * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - private function calculateSummerBankHoliday() + private function calculateSummerBankHoliday(): void { // Statutory bank holiday from 1971, following a trial period from 1965 to 1970. if ($this->year < 1965) { @@ -199,11 +208,12 @@ private function calculateSummerBankHoliday() * @link http://www.timeanddate.com/holidays/uk/christmas-day * @link http://www.timeanddate.com/holidays/uk/boxing-day * + * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Exception */ - public function calculateChristmasHolidays() + public function calculateChristmasHolidays(): void { $christmasDay = new DateTime("$this->year-12-25", new DateTimeZone($this->timezone)); $boxingDay = new DateTime("$this->year-12-26", new DateTimeZone($this->timezone)); @@ -214,7 +224,7 @@ public function calculateChristmasHolidays() $substituteChristmasDay = clone $christmasDay; $substituteBoxingDay = clone $boxingDay; - if (in_array((int)$christmasDay->format('w'), [0, 6], true)) { + if (\in_array((int)$christmasDay->format('w'), [0, 6], true)) { $substituteChristmasDay->add(new DateInterval('P2D')); $this->addHoliday(new Holiday( 'substituteHoliday:christmasDay', @@ -225,7 +235,7 @@ public function calculateChristmasHolidays() )); } - if (in_array((int)$boxingDay->format('w'), [0, 6], true)) { + if (\in_array((int)$boxingDay->format('w'), [0, 6], true)) { $substituteBoxingDay->add(new DateInterval('P2D')); $this->addHoliday(new Holiday( 'substituteHoliday:secondChristmasDay', diff --git a/src/Yasumi/ProviderInterface.php b/src/Yasumi/ProviderInterface.php index 60928e927..3cfd4625c 100755 --- a/src/Yasumi/ProviderInterface.php +++ b/src/Yasumi/ProviderInterface.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi; diff --git a/src/Yasumi/Translations.php b/src/Yasumi/Translations.php index 5cd66453f..2ac7576f3 100644 --- a/src/Yasumi/Translations.php +++ b/src/Yasumi/Translations.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi; @@ -50,13 +50,13 @@ public function __construct(array $availableLocales) * @throws \Yasumi\Exception\UnknownLocaleException * @throws \InvalidArgumentException */ - public function loadTranslations($directoryPath) + public function loadTranslations(string $directoryPath): void { - if (! file_exists($directoryPath)) { + if (! \file_exists($directoryPath)) { throw new InvalidArgumentException('Directory with translations not found'); } - $directoryPath = rtrim($directoryPath, '/\\') . DIRECTORY_SEPARATOR; + $directoryPath = \rtrim($directoryPath, '/\\') . DIRECTORY_SEPARATOR; $extension = 'php'; foreach (new DirectoryIterator($directoryPath) as $file) { @@ -73,8 +73,8 @@ public function loadTranslations($directoryPath) $translations = require $directoryPath . $filename; - if (is_array($translations)) { - foreach (array_keys($translations) as $locale) { + if (\is_array($translations)) { + foreach (\array_keys($translations) as $locale) { $this->isValidLocale($locale); // Validate the given locale } @@ -93,10 +93,10 @@ public function loadTranslations($directoryPath) * * @return true upon success, otherwise an UnknownLocaleException is thrown */ - protected function isValidLocale($locale) + protected function isValidLocale(string $locale): bool { - if (! in_array($locale, $this->availableLocales, true)) { - throw new UnknownLocaleException(sprintf('Locale "%s" is not a valid locale.', $locale)); + if (! \in_array($locale, $this->availableLocales, true)) { + throw new UnknownLocaleException(\sprintf('Locale "%s" is not a valid locale.', $locale)); } return true; @@ -111,11 +111,11 @@ protected function isValidLocale($locale) * * @throws \Yasumi\Exception\UnknownLocaleException */ - public function addTranslation($shortName, $locale, $translation) + public function addTranslation(string $shortName, string $locale, string $translation): void { $this->isValidLocale($locale); // Validate the given locale - if (! array_key_exists($shortName, $this->translations)) { + if (! \array_key_exists($shortName, $this->translations)) { $this->translations[$shortName] = []; } @@ -130,13 +130,13 @@ public function addTranslation($shortName, $locale, $translation) * * @return string|null translated holiday name */ - public function getTranslation($shortName, $locale) + public function getTranslation(string $shortName, string $locale): ?string { - if (! array_key_exists($shortName, $this->translations)) { + if (! \array_key_exists($shortName, $this->translations)) { return null; } - if (! array_key_exists($locale, $this->translations[$shortName])) { + if (! \array_key_exists($locale, $this->translations[$shortName])) { return null; } @@ -150,9 +150,9 @@ public function getTranslation($shortName, $locale) * * @return array holiday name translations ['' => '', ...] */ - public function getTranslations($shortName) + public function getTranslations(string $shortName): array { - if (! array_key_exists($shortName, $this->translations)) { + if (! \array_key_exists($shortName, $this->translations)) { return []; } diff --git a/src/Yasumi/TranslationsInterface.php b/src/Yasumi/TranslationsInterface.php index c9523b1cf..ec58213a7 100644 --- a/src/Yasumi/TranslationsInterface.php +++ b/src/Yasumi/TranslationsInterface.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi; @@ -25,7 +25,7 @@ interface TranslationsInterface * * @return string|null translated holiday name */ - public function getTranslation($shortName, $locale); + public function getTranslation(string $shortName, string $locale): ?string; /** * Returns all available translations for holiday. @@ -34,5 +34,5 @@ public function getTranslation($shortName, $locale); * * @return array holiday name translations ['' => '', ...] */ - public function getTranslations($shortName); + public function getTranslations(string $shortName): array; } diff --git a/src/Yasumi/Yasumi.php b/src/Yasumi/Yasumi.php index f0c226ee1..a9f9b9955 100755 --- a/src/Yasumi/Yasumi.php +++ b/src/Yasumi/Yasumi.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi; @@ -29,12 +29,12 @@ class Yasumi /** * Default locale. */ - const DEFAULT_LOCALE = 'en_US'; + public const DEFAULT_LOCALE = 'en_US'; /** * @var array list of all defined locales */ - private static $locales; + private static $locales = []; /** * Global translations. @@ -68,14 +68,21 @@ class Yasumi * @return \DateTimeInterface * * @throws \ReflectionException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \RuntimeException + * @throws \InvalidArgumentException * @throws \Exception * @throws \Yasumi\Exception\InvalidDateException * * @TODO we should accept a timezone so we can accept int/string for $startDate * */ - public static function nextWorkingDay($class, \DateTimeInterface $startDate, $workingDays = 1) - { + public static function nextWorkingDay( + string $class, + \DateTimeInterface $startDate, + int $workingDays = 1 + ): \DateTimeInterface { + // Setup start date, if its an instance of \DateTime, clone to prevent modification to original $date = $startDate instanceof \DateTime ? clone $startDate : $startDate; @@ -83,8 +90,8 @@ public static function nextWorkingDay($class, \DateTimeInterface $startDate, $wo while ($workingDays > 0) { $date = $date->add(new \DateInterval('P1D')); - if (! $provider || $provider->getYear() != $date->format('Y')) { - $provider = self::create($class, $date->format('Y')); + if (! $provider || $provider->getYear() !== \getdate()['year']) { + $provider = self::create($class, (int)$date->format('Y')); } if ($provider->isWorkingDay($date)) { $workingDays--; @@ -106,46 +113,46 @@ public static function nextWorkingDay($class, \DateTimeInterface $startDate, $wo * between 1000 and 9999. * @param string $locale The locale to use. If empty we'll use the default locale (en_US) * + * @throws \ReflectionException * @throws RuntimeException If no such holiday provider is found * @throws InvalidArgumentException if the year parameter is not between 1000 and 9999 * @throws UnknownLocaleException if the locale parameter is invalid * @throws InvalidArgumentException if the holiday provider for the given country does not exist - * @throws \ReflectionException * * @return AbstractProvider An instance of class $class is created and returned */ - public static function create($class, $year = null, $locale = self::DEFAULT_LOCALE) + public static function create(string $class, int $year = 0, string $locale = self::DEFAULT_LOCALE): ProviderInterface { // Find and return holiday provider instance - $providerClass = sprintf('Yasumi\Provider\%s', str_replace('/', '\\', $class)); + $providerClass = \sprintf('Yasumi\Provider\%s', \str_replace('/', '\\', $class)); - if (class_exists($class) && (new ReflectionClass($class))->implementsInterface(ProviderInterface::class)) { + if (\class_exists($class) && (new ReflectionClass($class))->implementsInterface(ProviderInterface::class)) { $providerClass = $class; } - if ($class === 'AbstractProvider' || ! class_exists($providerClass)) { - throw new InvalidArgumentException(sprintf('Unable to find holiday provider "%s".', $class)); + if ($class === 'AbstractProvider' || ! \class_exists($providerClass)) { + throw new InvalidArgumentException(\sprintf('Unable to find holiday provider "%s".', $class)); } // Assert year input if ($year < 1000 || $year > 9999) { - throw new InvalidArgumentException(sprintf('Year needs to be between 1000 and 9999 (%s given).', $year)); + throw new InvalidArgumentException(\sprintf('Year needs to be between 1000 and 9999 (%s given).', $year)); } // Load internal locales variable - if (null === static::$locales) { - static::$locales = self::getAvailableLocales(); + if (empty(self::$locales)) { + self::$locales = self::getAvailableLocales(); } // Load internal translations variable - if (null === static::$globalTranslations) { - static::$globalTranslations = new Translations(static::$locales); - static::$globalTranslations->loadTranslations(__DIR__ . '/data/translations'); + if (null === self::$globalTranslations) { + self::$globalTranslations = new Translations(self::$locales); + self::$globalTranslations->loadTranslations(__DIR__ . '/data/translations'); } // Assert locale input - if (! in_array($locale, static::$locales, true)) { - throw new UnknownLocaleException(sprintf('Locale "%s" is not a valid locale.', $locale)); + if (! \in_array($locale, self::$locales, true)) { + throw new UnknownLocaleException(\sprintf('Locale "%s" is not a valid locale.', $locale)); } return new $providerClass($year, $locale, self::$globalTranslations); @@ -156,7 +163,7 @@ public static function create($class, $year = null, $locale = self::DEFAULT_LOCA * * @return array list of available locales */ - public static function getAvailableLocales() + public static function getAvailableLocales(): array { return require __DIR__ . '/data/locales.php'; } @@ -173,20 +180,23 @@ public static function getAvailableLocales() * integer between 1000 and 9999. * @param string $locale The locale to use. If empty we'll use the default locale (en_US) * + * @throws \ReflectionException * @throws RuntimeException If no such holiday provider is found * @throws InvalidArgumentException if the year parameter is not between 1000 and 9999 * @throws UnknownLocaleException if the locale parameter is invalid * @throws InvalidArgumentException if the holiday provider for the given ISO3166-2 code does not exist - * @throws \ReflectionException * * @return AbstractProvider An instance of class $class is created and returned */ - public static function createByISO3166_2($iso3166_2, $year = null, $locale = self::DEFAULT_LOCALE) - { + public static function createByISO3166_2( + string $iso3166_2, + int $year = 0, + string $locale = self::DEFAULT_LOCALE + ): AbstractProvider { $availableProviders = self::getProviders(); if (false === isset($availableProviders[$iso3166_2])) { - throw new InvalidArgumentException(sprintf( + throw new InvalidArgumentException(\sprintf( 'Unable to find holiday provider by ISO3166-2 "%s".', $iso3166_2 )); @@ -202,24 +212,22 @@ public static function createByISO3166_2($iso3166_2, $year = null, $locale = sel * * @throws \ReflectionException */ - public static function getProviders() + public static function getProviders(): array { // Basic static cache static $providers; - if ($providers !== null) { + if (!empty($providers)) { return $providers; } - $ds = DIRECTORY_SEPARATOR; - $providers = []; $filesIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator( - __DIR__ . $ds . 'Provider', + __DIR__ . DIRECTORY_SEPARATOR . 'Provider', FilesystemIterator::SKIP_DOTS ), RecursiveIteratorIterator::SELF_FIRST); foreach ($filesIterator as $file) { - if ($file->isDir() || $file->getExtension() !== 'php' || in_array( + if ($file->isDir() || $file->getExtension() !== 'php' || \in_array( $file->getBasename('.php'), self::$ignoredProvider, true @@ -227,14 +235,14 @@ public static function getProviders() continue; } - $quotedDs = preg_quote($ds, null); - $provider = preg_replace("#^.+{$quotedDs}Provider{$quotedDs}(.+)\\.php$#", '$1', $file->getPathName()); + $quotedDs = \preg_quote(DIRECTORY_SEPARATOR, ''); + $provider = \preg_replace("#^.+{$quotedDs}Provider{$quotedDs}(.+)\\.php$#", '$1', $file->getPathName()); - $class = new ReflectionClass(sprintf('Yasumi\Provider\%s', str_replace('/', '\\', $provider))); + $class = new ReflectionClass(\sprintf('Yasumi\Provider\%s', \str_replace('/', '\\', $provider))); $key = 'ID'; - if ($class->hasConstant($key)) { - $providers[strtoupper($class->getConstant($key))] = $provider; + if ($class->isSubclassOf(AbstractProvider::class) && $class->hasConstant($key)) { + $providers[\strtoupper($class->getConstant($key))] = $provider; } } @@ -255,14 +263,21 @@ public static function getProviders() * @return \DateTimeInterface * * @throws \ReflectionException + * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \RuntimeException + * @throws \InvalidArgumentException * @throws \Exception * @throws \Yasumi\Exception\InvalidDateException * * @TODO we should accept a timezone so we can accept int/string for $startDate * */ - public static function prevWorkingDay($class, \DateTimeInterface $startDate, $workingDays = 1) - { + public static function prevWorkingDay( + string $class, + \DateTimeInterface $startDate, + int $workingDays = 1 + ): \DateTimeInterface { + // Setup start date, if its an instance of \DateTime, clone to prevent modification to original $date = $startDate instanceof \DateTime ? clone $startDate : $startDate; @@ -270,8 +285,8 @@ public static function prevWorkingDay($class, \DateTimeInterface $startDate, $wo while ($workingDays > 0) { $date = $date->sub(new \DateInterval('P1D')); - if (! $provider || $provider->getYear() != $date->format('Y')) { - $provider = self::create($class, $date->format('Y')); + if (! $provider || $provider->getYear() !== \getdate()['year']) { + $provider = self::create($class, (int)$date->format('Y')); } if ($provider->isWorkingDay($date)) { $workingDays--; diff --git a/src/Yasumi/data/locales.php b/src/Yasumi/data/locales.php index b79ee9e34..9b8a65476 100644 --- a/src/Yasumi/data/locales.php +++ b/src/Yasumi/data/locales.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // List of possible locales. This list is used in case the 'intl' extension is not loaded/available. @@ -238,6 +238,19 @@ 'fa_IR', 'ff_CM', 'ff_GN', + 'ff_Latn', + 'ff_Latn_BF', + 'ff_Latn_CM', + 'ff_Latn_GH', + 'ff_Latn_GM', + 'ff_Latn_GN', + 'ff_Latn_GW', + 'ff_Latn_LR', + 'ff_Latn_MR', + 'ff_Latn_NE', + 'ff_Latn_NG', + 'ff_Latn_SL', + 'ff_Latn_SN', 'ff_MR', 'ff_SN', 'fi_FI', @@ -312,6 +325,7 @@ 'hsb_DE', 'hu_HU', 'hy_AM', + 'ia_001', 'id_ID', 'ig_NG', 'ii_CN', @@ -323,6 +337,7 @@ 'ja_JP', 'jgo_CM', 'jmc_TZ', + 'jv_ID', 'ka_GE', 'kab_DZ', 'kam_KE', @@ -343,6 +358,7 @@ 'ksb_TZ', 'ksf_CM', 'ksh_DE', + 'ku_TR', 'kw_GB', 'ky_KG', 'lag_TZ', @@ -368,6 +384,7 @@ 'mg_MG', 'mgh_MZ', 'mgo_CM', + 'mi_NZ', 'mk_MK', 'ml_IN', 'mn_MN', @@ -517,6 +534,7 @@ 'vun_TZ', 'wae_CH', 'wo_SN', + 'xh_ZA', 'xog_UG', 'yav_CM', 'yo_BJ', diff --git a/src/Yasumi/data/translations/allSaintsDay.php b/src/Yasumi/data/translations/allSaintsDay.php index b1af15ca0..8ec5ec68a 100755 --- a/src/Yasumi/data/translations/allSaintsDay.php +++ b/src/Yasumi/data/translations/allSaintsDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for All Saints' Day diff --git a/src/Yasumi/data/translations/annunciation.php b/src/Yasumi/data/translations/annunciation.php index cb0b8dae6..eb2bb79b3 100644 --- a/src/Yasumi/data/translations/annunciation.php +++ b/src/Yasumi/data/translations/annunciation.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Annunciation diff --git a/src/Yasumi/data/translations/anzacDay.php b/src/Yasumi/data/translations/anzacDay.php index 2a452edab..ecae451ef 100644 --- a/src/Yasumi/data/translations/anzacDay.php +++ b/src/Yasumi/data/translations/anzacDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for ANZAC Day diff --git a/src/Yasumi/data/translations/armisticeDay.php b/src/Yasumi/data/translations/armisticeDay.php index e6a1c03b4..3649e008d 100644 --- a/src/Yasumi/data/translations/armisticeDay.php +++ b/src/Yasumi/data/translations/armisticeDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Armistice Day diff --git a/src/Yasumi/data/translations/ascensionDay.php b/src/Yasumi/data/translations/ascensionDay.php index 6f2418825..5ac109f69 100644 --- a/src/Yasumi/data/translations/ascensionDay.php +++ b/src/Yasumi/data/translations/ascensionDay.php @@ -2,17 +2,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Ascension Day return [ - 'da_DK' => 'Kristi Himmelfartsdag', + 'da_DK' => 'Kristi himmelfartsdag', 'de_AT' => 'Christi Himmelfahrt', 'de_CH' => 'Auffahrt', 'de_DE' => 'Christi Himmelfahrt', @@ -26,5 +26,5 @@ 'nb_NO' => 'Kristi himmelfartsdag', 'nl_BE' => 'Hemelvaart', 'nl_NL' => 'Hemelvaart', - 'sv_SE' => 'Kristi himmelsfärds dag', + 'sv_SE' => 'Kristi himmelsfärdsdag', ]; diff --git a/src/Yasumi/data/translations/ashWednesday.php b/src/Yasumi/data/translations/ashWednesday.php index 9eb9d3f01..ec9019b52 100644 --- a/src/Yasumi/data/translations/ashWednesday.php +++ b/src/Yasumi/data/translations/ashWednesday.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Ash Wednesday diff --git a/src/Yasumi/data/translations/assumptionOfMary.php b/src/Yasumi/data/translations/assumptionOfMary.php index a687cd3e6..7b3c4e52d 100755 --- a/src/Yasumi/data/translations/assumptionOfMary.php +++ b/src/Yasumi/data/translations/assumptionOfMary.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Assumption of Mary diff --git a/src/Yasumi/data/translations/australiaDay.php b/src/Yasumi/data/translations/australiaDay.php index f54cd8a2c..ee2b3640b 100644 --- a/src/Yasumi/data/translations/australiaDay.php +++ b/src/Yasumi/data/translations/australiaDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Australia Day diff --git a/src/Yasumi/data/translations/carnationRevolutionDay.php b/src/Yasumi/data/translations/carnationRevolutionDay.php index df5766fce..0943891e4 100644 --- a/src/Yasumi/data/translations/carnationRevolutionDay.php +++ b/src/Yasumi/data/translations/carnationRevolutionDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Freedom Day diff --git a/src/Yasumi/data/translations/christmasDay.php b/src/Yasumi/data/translations/christmasDay.php index 313def516..db2c3c616 100755 --- a/src/Yasumi/data/translations/christmasDay.php +++ b/src/Yasumi/data/translations/christmasDay.php @@ -2,19 +2,20 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Christmas return [ + 'bs_Latn_BA' => 'Božić', 'cs_CZ' => '1. svátek vánoční', 'cy_GB' => 'Nadolig', - 'da_DK' => '1. Juledag', + 'da_DK' => 'Juledag', 'de_AT' => 'Christtag', 'de_CH' => 'Weihnachtstag', 'de_DE' => '1. Weihnachtsfeiertag', diff --git a/src/Yasumi/data/translations/christmasEve.php b/src/Yasumi/data/translations/christmasEve.php index 697598908..4583a1143 100755 --- a/src/Yasumi/data/translations/christmasEve.php +++ b/src/Yasumi/data/translations/christmasEve.php @@ -2,18 +2,19 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Christmas Eve return [ 'cs_CZ' => 'Štědrý den', 'cy_GB' => 'Noswyl Nadolig', + 'da_DK' => 'Juleaften', 'de_CH' => 'Heiliger Abend', 'en_US' => 'Christmas Eve', 'et_EE' => 'Jõululaupäev', diff --git a/src/Yasumi/data/translations/corpusChristi.php b/src/Yasumi/data/translations/corpusChristi.php index ead174c79..731842810 100644 --- a/src/Yasumi/data/translations/corpusChristi.php +++ b/src/Yasumi/data/translations/corpusChristi.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Corpus Christi diff --git a/src/Yasumi/data/translations/dayAfterNewYearsDay.php b/src/Yasumi/data/translations/dayAfterNewYearsDay.php index 7d171fa42..ece5d9031 100644 --- a/src/Yasumi/data/translations/dayAfterNewYearsDay.php +++ b/src/Yasumi/data/translations/dayAfterNewYearsDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Day after New Year's Day diff --git a/src/Yasumi/data/translations/dayOfReformation.php b/src/Yasumi/data/translations/dayOfReformation.php new file mode 100755 index 000000000..a0d17a2f3 --- /dev/null +++ b/src/Yasumi/data/translations/dayOfReformation.php @@ -0,0 +1,17 @@ + + */ + +// Translations for Day of Reformation +return [ + 'de_DE' => 'Tag der Reformation', + 'en_US' => 'Day of Reformation', +]; diff --git a/src/Yasumi/data/translations/easter.php b/src/Yasumi/data/translations/easter.php index b9b9384a1..1c1ba739a 100644 --- a/src/Yasumi/data/translations/easter.php +++ b/src/Yasumi/data/translations/easter.php @@ -2,16 +2,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Easter Sunday return [ + 'bs_Latn_BA' => 'Uskrs', 'cy_GB' => 'Sul y Pasg', 'da_DK' => 'Påskedag', 'de_AT' => 'Ostersonntag', diff --git a/src/Yasumi/data/translations/easterMonday.php b/src/Yasumi/data/translations/easterMonday.php index 25484c3d3..45cf0e624 100644 --- a/src/Yasumi/data/translations/easterMonday.php +++ b/src/Yasumi/data/translations/easterMonday.php @@ -2,19 +2,19 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Easter Monday return [ 'cs_CZ' => 'Velikonoční pondělí', 'cy_GB' => 'Llun y Pasg', - 'da_DK' => '2. Påskedag', + 'da_DK' => '2. påskedag', 'de_AT' => 'Ostermontag', 'de_CH' => 'Ostermontag', 'de_DE' => 'Ostermontag', diff --git a/src/Yasumi/data/translations/epiphany.php b/src/Yasumi/data/translations/epiphany.php index 13ae7539f..9e1bbb216 100644 --- a/src/Yasumi/data/translations/epiphany.php +++ b/src/Yasumi/data/translations/epiphany.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Epiphany diff --git a/src/Yasumi/data/translations/fathersDay.php b/src/Yasumi/data/translations/fathersDay.php index d419aa5dc..0a87da240 100755 --- a/src/Yasumi/data/translations/fathersDay.php +++ b/src/Yasumi/data/translations/fathersDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Father's Day diff --git a/src/Yasumi/data/translations/goodFriday.php b/src/Yasumi/data/translations/goodFriday.php index 2722b5287..02823ca89 100644 --- a/src/Yasumi/data/translations/goodFriday.php +++ b/src/Yasumi/data/translations/goodFriday.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Good Friday diff --git a/src/Yasumi/data/translations/immaculateConception.php b/src/Yasumi/data/translations/immaculateConception.php index b710e6f76..c7e677a4a 100644 --- a/src/Yasumi/data/translations/immaculateConception.php +++ b/src/Yasumi/data/translations/immaculateConception.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Immaculate Conception diff --git a/src/Yasumi/data/translations/internationalWorkersDay.php b/src/Yasumi/data/translations/internationalWorkersDay.php index 4c786e410..cea79b49d 100755 --- a/src/Yasumi/data/translations/internationalWorkersDay.php +++ b/src/Yasumi/data/translations/internationalWorkersDay.php @@ -2,17 +2,19 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for International Workers' Day return [ + 'bs_Latn_BA' => 'Praznik rada', 'cs_CZ' => 'Svátek práce', + 'da_DK' => 'Første maj', 'de_AT' => 'Staatsfeiertag', 'de_CH' => 'Tag der Arbeit', 'de_DE' => 'Tag der Arbeit', diff --git a/src/Yasumi/data/translations/labourDay.php b/src/Yasumi/data/translations/labourDay.php index bc12bc95e..50ebce393 100644 --- a/src/Yasumi/data/translations/labourDay.php +++ b/src/Yasumi/data/translations/labourDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Labour Day diff --git a/src/Yasumi/data/translations/maundyThursday.php b/src/Yasumi/data/translations/maundyThursday.php index ced8cc6ef..f3ca528b1 100644 --- a/src/Yasumi/data/translations/maundyThursday.php +++ b/src/Yasumi/data/translations/maundyThursday.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Maundy Thursday diff --git a/src/Yasumi/data/translations/mothersDay.php b/src/Yasumi/data/translations/mothersDay.php index f446608c9..2680faac2 100755 --- a/src/Yasumi/data/translations/mothersDay.php +++ b/src/Yasumi/data/translations/mothersDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Mother's Day diff --git a/src/Yasumi/data/translations/newYearsDay.php b/src/Yasumi/data/translations/newYearsDay.php index 771a33d56..77f3fbf7b 100755 --- a/src/Yasumi/data/translations/newYearsDay.php +++ b/src/Yasumi/data/translations/newYearsDay.php @@ -2,16 +2,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for New Year's Day return [ + 'bs_Latn_BA' => 'Nova godina', 'cs_CZ' => 'Den obnovy samostatného českého státu a Nový rok', 'cy_GB' => 'Dydd Calan', 'da_DK' => 'Nytårsdag', diff --git a/src/Yasumi/data/translations/newYearsEve.php b/src/Yasumi/data/translations/newYearsEve.php new file mode 100755 index 000000000..d080aa58a --- /dev/null +++ b/src/Yasumi/data/translations/newYearsEve.php @@ -0,0 +1,18 @@ + + */ + +// Translations for New Year's Eve +return [ + 'da_DK' => 'Nytårsaften', + 'en_US' => 'New Year\'s Eve', + 'lv_LV' => 'Vecgada vakars', +]; diff --git a/src/Yasumi/data/translations/pentecost.php b/src/Yasumi/data/translations/pentecost.php index d21e2276d..630db0ed4 100755 --- a/src/Yasumi/data/translations/pentecost.php +++ b/src/Yasumi/data/translations/pentecost.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Whitsunday diff --git a/src/Yasumi/data/translations/pentecostMonday.php b/src/Yasumi/data/translations/pentecostMonday.php index f64d81def..1390391db 100755 --- a/src/Yasumi/data/translations/pentecostMonday.php +++ b/src/Yasumi/data/translations/pentecostMonday.php @@ -2,17 +2,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Whitmonday return [ - 'da_DK' => '2. Pinsedag', + 'da_DK' => '2. pinsedag', 'de_AT' => 'Pfingstmontag', 'de_CH' => 'Pfingstmontag', 'de_DE' => 'Pfingstmontag', diff --git a/src/Yasumi/data/translations/portugalDay.php b/src/Yasumi/data/translations/portugalDay.php index c5088c24c..d91a0a165 100644 --- a/src/Yasumi/data/translations/portugalDay.php +++ b/src/Yasumi/data/translations/portugalDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Portugal Day diff --git a/src/Yasumi/data/translations/portugueseRepublicDay.php b/src/Yasumi/data/translations/portugueseRepublicDay.php index 4a596bf65..22d37b3fd 100644 --- a/src/Yasumi/data/translations/portugueseRepublicDay.php +++ b/src/Yasumi/data/translations/portugueseRepublicDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Implantation of the Portuguese Republic diff --git a/src/Yasumi/data/translations/reformationDay.php b/src/Yasumi/data/translations/reformationDay.php index d1751e391..1e29c045a 100755 --- a/src/Yasumi/data/translations/reformationDay.php +++ b/src/Yasumi/data/translations/reformationDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Reformation Day diff --git a/src/Yasumi/data/translations/restorationOfIndepence.php b/src/Yasumi/data/translations/restorationOfIndepence.php index 5e9078c28..50dfdcfbf 100644 --- a/src/Yasumi/data/translations/restorationOfIndepence.php +++ b/src/Yasumi/data/translations/restorationOfIndepence.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Restoration of Independence diff --git a/src/Yasumi/data/translations/secondChristmasDay.php b/src/Yasumi/data/translations/secondChristmasDay.php index 926fe75fd..d7c9af1b3 100755 --- a/src/Yasumi/data/translations/secondChristmasDay.php +++ b/src/Yasumi/data/translations/secondChristmasDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Second Christmas Day diff --git a/src/Yasumi/data/translations/stDavidsDay.php b/src/Yasumi/data/translations/stDavidsDay.php index 21a7ad5fe..b721ee90e 100644 --- a/src/Yasumi/data/translations/stDavidsDay.php +++ b/src/Yasumi/data/translations/stDavidsDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for St. David's Day diff --git a/src/Yasumi/data/translations/stGeorgesDay.php b/src/Yasumi/data/translations/stGeorgesDay.php index 072ae9bc6..d43a97688 100644 --- a/src/Yasumi/data/translations/stGeorgesDay.php +++ b/src/Yasumi/data/translations/stGeorgesDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for St. George's Day diff --git a/src/Yasumi/data/translations/stJohnsDay.php b/src/Yasumi/data/translations/stJohnsDay.php index 04205f1ab..3e2b272e6 100644 --- a/src/Yasumi/data/translations/stJohnsDay.php +++ b/src/Yasumi/data/translations/stJohnsDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for St. John's Day diff --git a/src/Yasumi/data/translations/stJosephsDay.php b/src/Yasumi/data/translations/stJosephsDay.php index 0747b1d5b..9cf6ba0bd 100644 --- a/src/Yasumi/data/translations/stJosephsDay.php +++ b/src/Yasumi/data/translations/stJosephsDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for St. Joseph's Day diff --git a/src/Yasumi/data/translations/stMartinsDay.php b/src/Yasumi/data/translations/stMartinsDay.php index 317beaf39..c7472a78e 100644 --- a/src/Yasumi/data/translations/stMartinsDay.php +++ b/src/Yasumi/data/translations/stMartinsDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for St. Martin's Day diff --git a/src/Yasumi/data/translations/stStephensDay.php b/src/Yasumi/data/translations/stStephensDay.php index bb85caabd..b1b6a71a3 100644 --- a/src/Yasumi/data/translations/stStephensDay.php +++ b/src/Yasumi/data/translations/stStephensDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for St. Stephen's Day diff --git a/src/Yasumi/data/translations/summerTime.php b/src/Yasumi/data/translations/summerTime.php new file mode 100644 index 000000000..4e7cf2428 --- /dev/null +++ b/src/Yasumi/data/translations/summerTime.php @@ -0,0 +1,18 @@ + + */ + +// Translations for Summertime +return [ + 'da_DK' => 'Sommertid starter', + 'en_US' => 'Summertime', + 'nl_NL' => 'Zomertijd', +]; diff --git a/src/Yasumi/data/translations/valentinesDay.php b/src/Yasumi/data/translations/valentinesDay.php index e079de451..31abe86d9 100644 --- a/src/Yasumi/data/translations/valentinesDay.php +++ b/src/Yasumi/data/translations/valentinesDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Valentine's Day diff --git a/src/Yasumi/data/translations/victoryInEuropeDay.php b/src/Yasumi/data/translations/victoryInEuropeDay.php index bcd2be176..b02aa3dc3 100644 --- a/src/Yasumi/data/translations/victoryInEuropeDay.php +++ b/src/Yasumi/data/translations/victoryInEuropeDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Victory in Europe Day diff --git a/src/Yasumi/data/translations/waitangiDay.php b/src/Yasumi/data/translations/waitangiDay.php index c81c6f43e..a7d64b2c6 100644 --- a/src/Yasumi/data/translations/waitangiDay.php +++ b/src/Yasumi/data/translations/waitangiDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for Waitangi Day diff --git a/src/Yasumi/data/translations/winterTime.php b/src/Yasumi/data/translations/winterTime.php new file mode 100644 index 000000000..06f5bdd19 --- /dev/null +++ b/src/Yasumi/data/translations/winterTime.php @@ -0,0 +1,18 @@ + + */ + +// Translations for Wintertime +return [ + 'da_DK' => 'Sommertid slutter', + 'en_US' => 'Wintertime', + 'nl_NL' => 'Wintertijd', +]; diff --git a/src/Yasumi/data/translations/worldAnimalDay.php b/src/Yasumi/data/translations/worldAnimalDay.php index be4bd8cdb..cfb7f1da9 100644 --- a/src/Yasumi/data/translations/worldAnimalDay.php +++ b/src/Yasumi/data/translations/worldAnimalDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ // Translations for World Animal Day diff --git a/tests/Australia/ACT/ACTBaseTestCase.php b/tests/Australia/ACT/ACTBaseTestCase.php new file mode 100644 index 000000000..b11f23907 --- /dev/null +++ b/tests/Australia/ACT/ACTBaseTestCase.php @@ -0,0 +1,34 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +use Yasumi\tests\Australia\AustraliaBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the ACT holiday provider. + */ +abstract class ACTBaseTestCase extends AustraliaBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\ACT'; + + /** + * Timezone in which this provider has holidays defined + */ + public $timezone = 'Australia/ACT'; +} diff --git a/tests/Australia/ACT/ACTTest.php b/tests/Australia/ACT/ACTTest.php new file mode 100644 index 000000000..c57dc2f0e --- /dev/null +++ b/tests/Australia/ACT/ACTTest.php @@ -0,0 +1,57 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in ACT (Australia). + */ +class ACTTest extends ACTBaseTestCase +{ + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in ACT (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'easter', + 'easterSaturday', + 'queensBirthday', + 'labourDay', + 'canberraDay', + 'reconciliationDay' + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(2018, 2100); + } +} diff --git a/tests/Australia/ACT/AnzacDayTest.php b/tests/Australia/ACT/AnzacDayTest.php new file mode 100644 index 000000000..39c85bb1d --- /dev/null +++ b/tests/Australia/ACT/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +/** + * Class for testing ANZAC day in ACT (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\AnzacDayTest +{ +} diff --git a/tests/Australia/ACT/AustraliaDayTest.php b/tests/Australia/ACT/AustraliaDayTest.php new file mode 100644 index 000000000..e78a779ab --- /dev/null +++ b/tests/Australia/ACT/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +/** + * Class for testing Australia day in ACT (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\AustraliaDayTest +{ +} diff --git a/tests/Australia/ACT/BoxingDayTest.php b/tests/Australia/ACT/BoxingDayTest.php new file mode 100644 index 000000000..2fcd804bd --- /dev/null +++ b/tests/Australia/ACT/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +/** + * Class for testing Boxing Day in ACT (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\BoxingDayTest +{ +} diff --git a/tests/Australia/ACT/CanberraDayTest.php b/tests/Australia/ACT/CanberraDayTest.php new file mode 100644 index 000000000..033b3bcda --- /dev/null +++ b/tests/Australia/ACT/CanberraDayTest.php @@ -0,0 +1,107 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Canberra Day in ACT (Australia).. + */ +class CanberraDayTest extends ACTBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'canberraDay'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 1913; + + /** + * Tests Canberra 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-03-08'], + [2011, '2011-03-14'], + [2012, '2012-03-12'], + [2013, '2013-03-11'], + [2014, '2014-03-10'], + [2015, '2015-03-09'], + [2016, '2016-03-14'], + [2017, '2017-03-13'], + [2018, '2018-03-12'], + [2019, '2019-03-11'], + [2020, '2020-03-09'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Canberra Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Australia/ACT/ChristmasDayTest.php b/tests/Australia/ACT/ChristmasDayTest.php new file mode 100644 index 000000000..51c06af9e --- /dev/null +++ b/tests/Australia/ACT/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +/** + * Class for testing Christmas Day in ACT (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\ChristmasDayTest +{ +} diff --git a/tests/Australia/ACT/EasterMondayTest.php b/tests/Australia/ACT/EasterMondayTest.php new file mode 100644 index 000000000..efc85fbe9 --- /dev/null +++ b/tests/Australia/ACT/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +/** + * Class for testing Easter Monday in ACT (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\EasterMondayTest +{ +} diff --git a/tests/Australia/ACT/EasterSaturdayTest.php b/tests/Australia/ACT/EasterSaturdayTest.php new file mode 100644 index 000000000..92c50f97b --- /dev/null +++ b/tests/Australia/ACT/EasterSaturdayTest.php @@ -0,0 +1,95 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Easter Saturday in ACT (Australia).. + */ +class EasterSaturdayTest extends ACTBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'easterSaturday'; + + /** + * Tests Easter Saturday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + $data = []; + + for ($y = 0; $y < 50; $y++) { + $year = $this->generateRandomYear(); + $date = $this->calculateEaster($year, $this->timezone); + $date->sub(new DateInterval('P1D')); + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Easter Saturday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/ACT/EasterSundayTest.php b/tests/Australia/ACT/EasterSundayTest.php new file mode 100644 index 000000000..8cf3efd36 --- /dev/null +++ b/tests/Australia/ACT/EasterSundayTest.php @@ -0,0 +1,93 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Easter Sunday in ACT (Australia).. + */ +class EasterSundayTest extends ACTBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'easter'; + + /** + * Tests Easter Sunday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + $data = []; + + for ($y = 0; $y < 50; $y++) { + $year = $this->generateRandomYear(); + $date = $this->calculateEaster($year, $this->timezone); + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Easter Sunday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/ACT/GoodFridayTest.php b/tests/Australia/ACT/GoodFridayTest.php new file mode 100644 index 000000000..ed63492d3 --- /dev/null +++ b/tests/Australia/ACT/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +/** + * Class for testing Good Friday in ACT (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\GoodFridayTest +{ +} diff --git a/tests/Australia/ACT/LabourDayTest.php b/tests/Australia/ACT/LabourDayTest.php new file mode 100644 index 000000000..391af8199 --- /dev/null +++ b/tests/Australia/ACT/LabourDayTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Labour Day in ACT (Australia).. + */ +class LabourDayTest extends ACTBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-10-04'], + [2011, '2011-10-03'], + [2012, '2012-10-01'], + [2013, '2013-10-07'], + [2014, '2014-10-06'], + [2015, '2015-10-05'], + [2016, '2016-10-03'], + [2017, '2017-10-02'], + [2018, '2018-10-01'], + [2019, '2019-10-07'], + [2020, '2020-10-05'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Labour Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/ACT/NewYearsDayTest.php b/tests/Australia/ACT/NewYearsDayTest.php new file mode 100644 index 000000000..5a217b06d --- /dev/null +++ b/tests/Australia/ACT/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +/** + * Class for testing New Years Day in ACT (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\NewYearsDayTest +{ +} diff --git a/tests/Australia/ACT/QueensBirthdayTest.php b/tests/Australia/ACT/QueensBirthdayTest.php new file mode 100644 index 000000000..4f271bd8b --- /dev/null +++ b/tests/Australia/ACT/QueensBirthdayTest.php @@ -0,0 +1,107 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Queen's Birthday in ACT (Australia).. + */ +class QueensBirthdayTest extends ACTBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'queensBirthday'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 1950; + + /** + * Tests Queen's Birthday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-06-14'], + [2011, '2011-06-13'], + [2012, '2012-06-11'], + [2013, '2013-06-10'], + [2014, '2014-06-09'], + [2015, '2015-06-08'], + [2016, '2016-06-13'], + [2017, '2017-06-12'], + [2018, '2018-06-11'], + [2019, '2019-06-10'], + [2020, '2020-06-08'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Queen\'s Birthday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Australia/ACT/ReconciliationDayTest.php b/tests/Australia/ACT/ReconciliationDayTest.php new file mode 100644 index 000000000..00f55ee6e --- /dev/null +++ b/tests/Australia/ACT/ReconciliationDayTest.php @@ -0,0 +1,109 @@ + + */ + +namespace Yasumi\tests\Australia\ACT; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Reconciliation Day in ACT (Australia).. + */ +class ReconciliationDayTest extends ACTBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'reconciliationDay'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 2018; + + /** + * Tests Reconciliation 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2018, '2018-05-28'], + [2019, '2019-05-27'], + [2020, '2020-06-01'], + [2021, '2021-05-31'], + [2022, '2022-05-30'], + [2023, '2023-05-29'], + [2024, '2024-05-27'], + [2025, '2025-06-02'], + [2026, '2026-06-01'], + [2027, '2027-05-31'], + [2028, '2028-05-29'], + [2029, '2029-05-28'], + [2030, '2030-05-27'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Reconciliation Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Australia/AnzacDayTest.php b/tests/Australia/AnzacDayTest.php index a9d74c474..ad5b8a2de 100644 --- a/tests/Australia/AnzacDayTest.php +++ b/tests/Australia/AnzacDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia; @@ -25,12 +25,12 @@ class AnzacDayTest extends AustraliaBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'anzacDay'; + public const HOLIDAY = 'anzacDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1921; + public const ESTABLISHMENT_YEAR = 1921; /** * Tests ANZAC Day @@ -39,6 +39,9 @@ class AnzacDayTest extends AustraliaBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -51,7 +54,8 @@ public function testHoliday($year, $expected) } /** - * Tests that Labour Day is not present before 1921 + * Tests that ANZAC Day is not present before 1921 + * @throws \ReflectionException */ public function testNotHoliday() { @@ -63,21 +67,21 @@ public function testNotHoliday() * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = [ - [2010, '2010-04-26'], + [2010, '2010-04-25'], [2011, '2011-04-25'], [2012, '2012-04-25'], [2013, '2013-04-25'], [2014, '2014-04-25'], - [2015, '2015-04-27'], + [2015, '2015-04-25'], [2016, '2016-04-25'], [2017, '2017-04-25'], [2018, '2018-04-25'], [2019, '2019-04-25'], [2019, '2019-04-25'], - [2020, '2020-04-27'], + [2020, '2020-04-25'], ]; return $data; @@ -85,8 +89,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( $this->region, @@ -98,8 +103,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( $this->region, diff --git a/tests/Australia/AustraliaBaseTestCase.php b/tests/Australia/AustraliaBaseTestCase.php index 7d204ac2b..3f9b406a8 100644 --- a/tests/Australia/AustraliaBaseTestCase.php +++ b/tests/Australia/AustraliaBaseTestCase.php @@ -2,30 +2,30 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Australia holiday provider. */ -abstract class AustraliaBaseTestCase extends PHPUnit_Framework_TestCase +abstract class AustraliaBaseTestCase extends TestCase { use YasumiBase; /** * Locale that is considered common for this provider */ - const LOCALE = 'en_AU'; + public const LOCALE = 'en_AU'; /** * Name of the region (e.g. country / state) to be tested */ diff --git a/tests/Australia/AustraliaDayTest.php b/tests/Australia/AustraliaDayTest.php index b8a431643..7e565261b 100644 --- a/tests/Australia/AustraliaDayTest.php +++ b/tests/Australia/AustraliaDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia; @@ -25,7 +25,7 @@ class AustraliaDayTest extends AustraliaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'australiaDay'; + public const HOLIDAY = 'australiaDay'; /** * Tests Australia Day @@ -34,6 +34,9 @@ class AustraliaDayTest extends AustraliaBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -48,8 +51,9 @@ public function testHoliday($year, $expected) /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( $this->region, @@ -61,8 +65,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(2000), Holiday::TYPE_OFFICIAL); } @@ -72,7 +77,7 @@ public function testHolidayType() * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = [ [2010, '2010-01-26'], diff --git a/tests/Australia/AustraliaTest.php b/tests/Australia/AustraliaTest.php index 285593903..6b8066988 100644 --- a/tests/Australia/AustraliaTest.php +++ b/tests/Australia/AustraliaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia; @@ -26,8 +26,9 @@ class AustraliaTest extends AustraliaBaseTestCase /** * Tests if all official holidays in Australia are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -42,32 +43,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Australia are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], $this->region, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Australia are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], $this->region, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Australia are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], $this->region, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Australia are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], $this->region, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Australia/BoxingDayTest.php b/tests/Australia/BoxingDayTest.php index 4418a9885..2ddf836e3 100644 --- a/tests/Australia/BoxingDayTest.php +++ b/tests/Australia/BoxingDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia; @@ -25,17 +25,22 @@ class BoxingDayTest extends AustraliaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY2 = 'secondChristmasHoliday'; /** * 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 + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param string $expected the expected date + * @param string $expectedExtra the expected date for the additional holiday, or null if no additional holiday + * + * @throws \ReflectionException + * @throws \Exception */ - public function testHoliday($year, $expected) + public function testHoliday($year, $expected, $expectedExtra) { $this->assertHoliday( $this->region, @@ -43,6 +48,20 @@ public function testHoliday($year, $expected) $year, new DateTime($expected, new DateTimeZone($this->timezone)) ); + if ($expectedExtra === null) { + $this->assertNotHoliday( + $this->region, + self::HOLIDAY2, + $year + ); + } else { + $this->assertHoliday( + $this->region, + self::HOLIDAY2, + $year, + new DateTime($expectedExtra, new DateTimeZone($this->timezone)) + ); + } } /** @@ -50,20 +69,20 @@ public function testHoliday($year, $expected) * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = [ - [2010, '2010-12-28'], - [2011, '2011-12-26'], - [2012, '2012-12-26'], - [2013, '2013-12-26'], - [2014, '2014-12-26'], - [2015, '2015-12-28'], - [2016, '2016-12-26'], - [2017, '2017-12-26'], - [2018, '2018-12-26'], - [2019, '2019-12-26'], - [2020, '2020-12-28'], + [2010, '2010-12-26', '2010-12-28'], + [2011, '2011-12-26', null], + [2012, '2012-12-26', null], + [2013, '2013-12-26', null], + [2014, '2014-12-26', null], + [2015, '2015-12-26', '2015-12-28'], + [2016, '2016-12-26', null], + [2017, '2017-12-26', null], + [2018, '2018-12-26', null], + [2019, '2019-12-26', null], + [2020, '2020-12-26', '2020-12-28'], ]; return $data; @@ -71,8 +90,10 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( $this->region, @@ -80,13 +101,22 @@ public function testTranslation() $this->generateRandomYear(), [self::LOCALE => 'Boxing Day'] ); + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY2, + 2020, + [self::LOCALE => 'Boxing Day Holiday'] + ); } /** * Tests type of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY2, 2020, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/ChristmasDayTest.php b/tests/Australia/ChristmasDayTest.php index c9a9966e0..70bc08cab 100644 --- a/tests/Australia/ChristmasDayTest.php +++ b/tests/Australia/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia; @@ -18,24 +18,29 @@ use Yasumi\tests\YasumiTestCaseInterface; /** - * Class for testing Christmas Day in the Australia. + * Class for testing Christmas Day in Australia. */ class ChristmasDayTest extends AustraliaBaseTestCase implements YasumiTestCaseInterface { /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; + public const HOLIDAY2 = 'christmasHoliday'; /** * 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 + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param string $expected the expected date + * @param string $expectedExtra the expected date for the additional holiday, or null if no additional holiday + * + * @throws \ReflectionException + * @throws \Exception */ - public function testHoliday($year, $expected) + public function testHoliday($year, $expected, $expectedExtra) { $this->assertHoliday( $this->region, @@ -43,6 +48,20 @@ public function testHoliday($year, $expected) $year, new DateTime($expected, new DateTimeZone($this->timezone)) ); + if ($expectedExtra === null) { + $this->assertNotHoliday( + $this->region, + self::HOLIDAY2, + $year + ); + } else { + $this->assertHoliday( + $this->region, + self::HOLIDAY2, + $year, + new DateTime($expectedExtra, new DateTimeZone($this->timezone)) + ); + } } /** @@ -50,20 +69,20 @@ public function testHoliday($year, $expected) * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = [ - [2010, '2010-12-27'], - [2011, '2011-12-27'], - [2012, '2012-12-25'], - [2013, '2013-12-25'], - [2014, '2014-12-25'], - [2015, '2015-12-25'], - [2016, '2016-12-27'], - [2017, '2017-12-25'], - [2018, '2018-12-25'], - [2019, '2019-12-25'], - [2020, '2020-12-25'], + [2010, '2010-12-25', '2010-12-27'], + [2011, '2011-12-25', '2011-12-27'], + [2012, '2012-12-25', null], + [2013, '2013-12-25', null], + [2014, '2014-12-25', null], + [2015, '2015-12-25', null], + [2016, '2016-12-25', '2016-12-27'], + [2017, '2017-12-25', null], + [2018, '2018-12-25', null], + [2019, '2019-12-25', null], + [2020, '2020-12-25', null], ]; return $data; @@ -71,8 +90,10 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( $this->region, @@ -80,13 +101,22 @@ public function testTranslation() $this->generateRandomYear(), [self::LOCALE => 'Christmas Day'] ); + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY2, + 2016, + [self::LOCALE => 'Christmas Holiday'] + ); } /** * Tests type of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY2, 2016, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/EasterMondayTest.php b/tests/Australia/EasterMondayTest.php index a98201b1e..f0039d19b 100644 --- a/tests/Australia/EasterMondayTest.php +++ b/tests/Australia/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia; @@ -26,7 +26,8 @@ class EasterMondayTest extends AustraliaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; + public const HOLIDAY2 = 'easterTuesday'; /** * Tests Easter Monday @@ -35,6 +36,9 @@ class EasterMondayTest extends AustraliaBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -46,12 +50,34 @@ public function testHoliday($year, $expected) ); } + /** + * Tests Easter Tuesday for those years when ANZAC Day clashes with Easter Sunday or Monday + * + * @dataProvider HolidayDataProvider2 + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday2($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY2, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + /** * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -66,10 +92,29 @@ public function HolidayDataProvider() return $data; } + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider2(): array + { + $data = [ + [2011, '2011-04-26'], + [2038, '2038-04-27'], + [2095, '2095-04-26'], + [2163, '2163-04-26'], + ]; + + return $data; + } + /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( $this->region, @@ -77,13 +122,22 @@ public function testTranslation() $this->generateRandomYear(), [self::LOCALE => 'Easter Monday'] ); + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY2, + 2011, + [self::LOCALE => 'Easter Tuesday'] + ); } /** * Tests type of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY2, 2011, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/GoodFridayTest.php b/tests/Australia/GoodFridayTest.php index c28d82033..e0c7a64d4 100644 --- a/tests/Australia/GoodFridayTest.php +++ b/tests/Australia/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia; @@ -26,7 +26,7 @@ class GoodFridayTest extends AustraliaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests Good Friday @@ -35,6 +35,9 @@ class GoodFridayTest extends AustraliaBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -50,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -67,8 +71,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( $this->region, @@ -80,8 +85,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Australia/NSW/AnzacDayTest.php b/tests/Australia/NSW/AnzacDayTest.php new file mode 100644 index 000000000..8f0fc86f7 --- /dev/null +++ b/tests/Australia/NSW/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +/** + * Class for testing ANZAC day in NSW (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\AnzacDayTest +{ +} diff --git a/tests/Australia/NSW/AustraliaDayTest.php b/tests/Australia/NSW/AustraliaDayTest.php new file mode 100644 index 000000000..817635ae3 --- /dev/null +++ b/tests/Australia/NSW/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +/** + * Class for testing Australia day in NSW (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\AustraliaDayTest +{ +} diff --git a/tests/Australia/NSW/BankHolidayTest.php b/tests/Australia/NSW/BankHolidayTest.php new file mode 100644 index 000000000..def296b86 --- /dev/null +++ b/tests/Australia/NSW/BankHolidayTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Bank Holiday in NSW (Australia).. + */ +class BankHolidayTest extends NSWBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'bankHoliday'; + + /** + * Tests Bank Holiday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-08-02'], + [2011, '2011-08-01'], + [2012, '2012-08-06'], + [2013, '2013-08-05'], + [2014, '2014-08-04'], + [2015, '2015-08-03'], + [2016, '2016-08-01'], + [2017, '2017-08-07'], + [2018, '2018-08-06'], + [2019, '2019-08-05'], + [2020, '2020-08-03'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Bank Holiday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_BANK); + } +} diff --git a/tests/Australia/NSW/BoxingDayTest.php b/tests/Australia/NSW/BoxingDayTest.php new file mode 100644 index 000000000..aee9e45cb --- /dev/null +++ b/tests/Australia/NSW/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +/** + * Class for testing Boxing Day in NSW (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\BoxingDayTest +{ +} diff --git a/tests/Australia/NSW/ChristmasDayTest.php b/tests/Australia/NSW/ChristmasDayTest.php new file mode 100644 index 000000000..0d026f482 --- /dev/null +++ b/tests/Australia/NSW/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +/** + * Class for testing Christmas Day in NSW (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\ChristmasDayTest +{ +} diff --git a/tests/Australia/NSW/EasterMondayTest.php b/tests/Australia/NSW/EasterMondayTest.php new file mode 100644 index 000000000..e90802d32 --- /dev/null +++ b/tests/Australia/NSW/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +/** + * Class for testing Easter Monday in NSW (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\EasterMondayTest +{ +} diff --git a/tests/Australia/NSW/EasterSaturdayTest.php b/tests/Australia/NSW/EasterSaturdayTest.php new file mode 100644 index 000000000..064aca9eb --- /dev/null +++ b/tests/Australia/NSW/EasterSaturdayTest.php @@ -0,0 +1,95 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Easter Saturday in NSW (Australia).. + */ +class EasterSaturdayTest extends NSWBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'easterSaturday'; + + /** + * Tests Easter Saturday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + $data = []; + + for ($y = 0; $y < 50; $y++) { + $year = $this->generateRandomYear(); + $date = $this->calculateEaster($year, $this->timezone); + $date->sub(new DateInterval('P1D')); + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Easter Saturday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/NSW/EasterSundayTest.php b/tests/Australia/NSW/EasterSundayTest.php new file mode 100644 index 000000000..f14724a66 --- /dev/null +++ b/tests/Australia/NSW/EasterSundayTest.php @@ -0,0 +1,93 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Easter Sunday in NSW (Australia).. + */ +class EasterSundayTest extends NSWBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'easter'; + + /** + * Tests Easter Sunday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + $data = []; + + for ($y = 0; $y < 50; $y++) { + $year = $this->generateRandomYear(); + $date = $this->calculateEaster($year, $this->timezone); + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Easter Sunday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/NSW/GoodFridayTest.php b/tests/Australia/NSW/GoodFridayTest.php new file mode 100644 index 000000000..c00ee1c37 --- /dev/null +++ b/tests/Australia/NSW/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +/** + * Class for testing Good Friday in NSW (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\GoodFridayTest +{ +} diff --git a/tests/Australia/NSW/LabourDayTest.php b/tests/Australia/NSW/LabourDayTest.php new file mode 100644 index 000000000..56c7bdcaf --- /dev/null +++ b/tests/Australia/NSW/LabourDayTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Labour Day in NSW (Australia).. + */ +class LabourDayTest extends NSWBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-10-04'], + [2011, '2011-10-03'], + [2012, '2012-10-01'], + [2013, '2013-10-07'], + [2014, '2014-10-06'], + [2015, '2015-10-05'], + [2016, '2016-10-03'], + [2017, '2017-10-02'], + [2018, '2018-10-01'], + [2019, '2019-10-07'], + [2020, '2020-10-05'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Labour Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/NSW/NSWBaseTestCase.php b/tests/Australia/NSW/NSWBaseTestCase.php new file mode 100644 index 000000000..80150e9b8 --- /dev/null +++ b/tests/Australia/NSW/NSWBaseTestCase.php @@ -0,0 +1,34 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +use Yasumi\tests\Australia\AustraliaBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the NSW holiday provider. + */ +abstract class NSWBaseTestCase extends AustraliaBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\NSW'; + + /** + * Timezone in which this provider has holidays defined + */ + public $timezone = 'Australia/NSW'; +} diff --git a/tests/Australia/NSW/NSWTest.php b/tests/Australia/NSW/NSWTest.php new file mode 100644 index 000000000..f777d1012 --- /dev/null +++ b/tests/Australia/NSW/NSWTest.php @@ -0,0 +1,66 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in NSW (Australia). + */ +class NSWTest extends NSWBaseTestCase +{ + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in NSW (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'easter', + 'easterSaturday', + 'queensBirthday', + 'labourDay', + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Tests if all bank holidays in NSW (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testBankHolidays(): void + { + $this->assertDefinedHolidays([ + 'bankHoliday', + ], $this->region, $this->year, Holiday::TYPE_BANK); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/NSW/NewYearsDayTest.php b/tests/Australia/NSW/NewYearsDayTest.php new file mode 100644 index 000000000..d218e6e59 --- /dev/null +++ b/tests/Australia/NSW/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +/** + * Class for testing New Years Day in NSW (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\NewYearsDayTest +{ +} diff --git a/tests/Australia/NSW/QueensBirthdayTest.php b/tests/Australia/NSW/QueensBirthdayTest.php new file mode 100644 index 000000000..4c587d53a --- /dev/null +++ b/tests/Australia/NSW/QueensBirthdayTest.php @@ -0,0 +1,107 @@ + + */ + +namespace Yasumi\tests\Australia\NSW; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Queen's Birthday in NSW (Australia).. + */ +class QueensBirthdayTest extends NSWBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'queensBirthday'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 1950; + + /** + * Tests Queen's Birthday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-06-14'], + [2011, '2011-06-13'], + [2012, '2012-06-11'], + [2013, '2013-06-10'], + [2014, '2014-06-09'], + [2015, '2015-06-08'], + [2016, '2016-06-13'], + [2017, '2017-06-12'], + [2018, '2018-06-11'], + [2019, '2019-06-10'], + [2020, '2020-06-08'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Queen\'s Birthday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Australia/NT/AnzacDayTest.php b/tests/Australia/NT/AnzacDayTest.php new file mode 100644 index 000000000..18bc01578 --- /dev/null +++ b/tests/Australia/NT/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NT; + +/** + * Class for testing ANZAC day in NT (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\AnzacDayTest +{ +} diff --git a/tests/Australia/NT/AustraliaDayTest.php b/tests/Australia/NT/AustraliaDayTest.php new file mode 100644 index 000000000..4a815f3e0 --- /dev/null +++ b/tests/Australia/NT/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NT; + +/** + * Class for testing Australia day in NT (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\AustraliaDayTest +{ +} diff --git a/tests/Australia/NT/BoxingDayTest.php b/tests/Australia/NT/BoxingDayTest.php new file mode 100644 index 000000000..4f4b44d06 --- /dev/null +++ b/tests/Australia/NT/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NT; + +/** + * Class for testing Boxing Day in NT (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\BoxingDayTest +{ +} diff --git a/tests/Australia/NT/ChristmasDayTest.php b/tests/Australia/NT/ChristmasDayTest.php new file mode 100644 index 000000000..53c4a8117 --- /dev/null +++ b/tests/Australia/NT/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NT; + +/** + * Class for testing Christmas Day in NT (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\ChristmasDayTest +{ +} diff --git a/tests/Australia/NT/EasterMondayTest.php b/tests/Australia/NT/EasterMondayTest.php new file mode 100644 index 000000000..291006489 --- /dev/null +++ b/tests/Australia/NT/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NT; + +/** + * Class for testing Easter Monday in NT (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\EasterMondayTest +{ +} diff --git a/tests/Australia/NT/EasterSaturdayTest.php b/tests/Australia/NT/EasterSaturdayTest.php new file mode 100644 index 000000000..79c8b2dc5 --- /dev/null +++ b/tests/Australia/NT/EasterSaturdayTest.php @@ -0,0 +1,95 @@ + + */ + +namespace Yasumi\tests\Australia\NT; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Easter Saturday in NT (Australia).. + */ +class EasterSaturdayTest extends NTBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'easterSaturday'; + + /** + * Tests Easter Saturday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + $data = []; + + for ($y = 0; $y < 50; $y++) { + $year = $this->generateRandomYear(); + $date = $this->calculateEaster($year, $this->timezone); + $date->sub(new DateInterval('P1D')); + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Easter Saturday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/NT/GoodFridayTest.php b/tests/Australia/NT/GoodFridayTest.php new file mode 100644 index 000000000..ce7811b86 --- /dev/null +++ b/tests/Australia/NT/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NT; + +/** + * Class for testing Good Friday in NT (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\GoodFridayTest +{ +} diff --git a/tests/Australia/NT/MayDayTest.php b/tests/Australia/NT/MayDayTest.php new file mode 100644 index 000000000..d8b760927 --- /dev/null +++ b/tests/Australia/NT/MayDayTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\NT; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing May Day in NT (Australia).. + */ +class MayDayTest extends NTBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'mayDay'; + + /** + * Tests May 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-05-03'], + [2011, '2011-05-02'], + [2012, '2012-05-07'], + [2013, '2013-05-06'], + [2014, '2014-05-05'], + [2015, '2015-05-04'], + [2016, '2016-05-02'], + [2017, '2017-05-01'], + [2018, '2018-05-07'], + [2019, '2019-05-06'], + [2020, '2020-05-04'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'May Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/NT/NTBaseTestCase.php b/tests/Australia/NT/NTBaseTestCase.php new file mode 100644 index 000000000..78c59a549 --- /dev/null +++ b/tests/Australia/NT/NTBaseTestCase.php @@ -0,0 +1,34 @@ + + */ + +namespace Yasumi\tests\Australia\NT; + +use Yasumi\tests\Australia\AustraliaBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the NT holiday provider. + */ +abstract class NTBaseTestCase extends AustraliaBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\NT'; + + /** + * Timezone in which this provider has holidays defined + */ + public $timezone = 'Australia/North'; +} diff --git a/tests/Australia/NT/NTTest.php b/tests/Australia/NT/NTTest.php new file mode 100644 index 000000000..d33118c3e --- /dev/null +++ b/tests/Australia/NT/NTTest.php @@ -0,0 +1,55 @@ + + */ + +namespace Yasumi\tests\Australia\NT; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in NT (Australia). + */ +class NTTest extends NTBaseTestCase +{ + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in NT (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'easterSaturday', + 'queensBirthday', + 'mayDay', + 'picnicDay', + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/NT/NewYearsDayTest.php b/tests/Australia/NT/NewYearsDayTest.php new file mode 100644 index 000000000..16aa4cdf6 --- /dev/null +++ b/tests/Australia/NT/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\NT; + +/** + * Class for testing New Years Day in NT (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\NewYearsDayTest +{ +} diff --git a/tests/Australia/NT/PicnicDayTest.php b/tests/Australia/NT/PicnicDayTest.php new file mode 100644 index 000000000..f67d2320a --- /dev/null +++ b/tests/Australia/NT/PicnicDayTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\NT; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Picnic Day in NT (Australia).. + */ +class PicnicDayTest extends NTBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'picnicDay'; + + /** + * Tests Picnic 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-08-02'], + [2011, '2011-08-01'], + [2012, '2012-08-06'], + [2013, '2013-08-05'], + [2014, '2014-08-04'], + [2015, '2015-08-03'], + [2016, '2016-08-01'], + [2017, '2017-08-07'], + [2018, '2018-08-06'], + [2019, '2019-08-05'], + [2020, '2020-08-03'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Picnic Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/QueensBirthdayTest.php b/tests/Australia/NT/QueensBirthdayTest.php similarity index 73% rename from tests/Australia/QueensBirthdayTest.php rename to tests/Australia/NT/QueensBirthdayTest.php index 8e96d0387..9e3c4ec83 100644 --- a/tests/Australia/QueensBirthdayTest.php +++ b/tests/Australia/NT/QueensBirthdayTest.php @@ -2,15 +2,15 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ -namespace Yasumi\tests\Australia; +namespace Yasumi\tests\Australia\NT; use DateTime; use DateTimeZone; @@ -18,29 +18,30 @@ use Yasumi\tests\YasumiTestCaseInterface; /** - * Class for testing QueensBirthday in Australia. + * Class for testing Queen's Birthday in NT (Australia).. */ -abstract class QueensBirthdayTest extends AustraliaBaseTestCase implements YasumiTestCaseInterface +class QueensBirthdayTest extends NTBaseTestCase implements YasumiTestCaseInterface { /** * The name of the holiday */ - const HOLIDAY = 'queensBirthday'; + public const HOLIDAY = 'queensBirthday'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1950; - - protected $dateFormat; // picked a random date -- sorry :) + public const ESTABLISHMENT_YEAR = 1950; /** - * Tests Labour Day + * Tests Queen's Birthday * * @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 + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -52,13 +53,12 @@ public function testHoliday($year, $expected) ); } - /** * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = [ [2010, '2010-06-14'], @@ -79,21 +79,23 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), - [self::LOCALE => 'Queens Birthday'] + [self::LOCALE => 'Queen\'s Birthday'] ); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( $this->region, diff --git a/tests/Australia/NewYearsDayTest.php b/tests/Australia/NewYearsDayTest.php index 94bd3f095..4af07ea72 100644 --- a/tests/Australia/NewYearsDayTest.php +++ b/tests/Australia/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia; @@ -25,17 +25,22 @@ class NewYearsDayTest extends AustraliaBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; + public const HOLIDAY2 = 'newYearsHoliday'; /** * 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 + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param string $expected the expected date + * @param string $expectedExtra the expected date for the additional holiday, or null if no additional holiday + * + * @throws \ReflectionException + * @throws \Exception */ - public function testHoliday($year, $expected) + public function testHoliday($year, $expected, $expectedExtra) { $this->assertHoliday( $this->region, @@ -43,6 +48,20 @@ public function testHoliday($year, $expected) $year, new DateTime($expected, new DateTimeZone($this->timezone)) ); + if ($expectedExtra === null) { + $this->assertNotHoliday( + $this->region, + self::HOLIDAY2, + $year + ); + } else { + $this->assertHoliday( + $this->region, + self::HOLIDAY2, + $year, + new DateTime($expectedExtra, new DateTimeZone($this->timezone)) + ); + } } /** @@ -50,30 +69,31 @@ public function testHoliday($year, $expected) * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = [ - [2010, '2010-01-01'], - [2011, '2011-01-03'], - [2012, '2012-01-02'], - [2013, '2013-01-01'], - [2014, '2014-01-01'], - [2015, '2015-01-01'], - [2016, '2016-01-01'], - [2017, '2017-01-02'], - [2018, '2018-01-01'], - [2019, '2019-01-01'], - [2020, '2020-01-01'], + [2010, '2010-01-01', null], + [2011, '2011-01-01', '2011-01-03'], + [2012, '2012-01-01', '2012-01-02'], + [2013, '2013-01-01', null], + [2014, '2014-01-01', null], + [2015, '2015-01-01', null], + [2016, '2016-01-01', null], + [2017, '2017-01-01', '2017-01-02'], + [2018, '2018-01-01', null], + [2019, '2019-01-01', null], + [2020, '2020-01-01', null], ]; - return $data; } /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( $this->region, @@ -81,13 +101,22 @@ public function testTranslation() $this->generateRandomYear(), [self::LOCALE => 'New Year\'s Day'] ); + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY2, + 2017, + [self::LOCALE => 'New Year\'s Holiday'] + ); } /** * Tests type of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY2, 2017, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Queensland/AnzacDayTest.php b/tests/Australia/Queensland/AnzacDayTest.php new file mode 100644 index 000000000..61c58c4bb --- /dev/null +++ b/tests/Australia/Queensland/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland; + +/** + * Class for testing ANZAC day in Queensland (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\AnzacDayTest +{ +} diff --git a/tests/Australia/Queensland/AustraliaDayTest.php b/tests/Australia/Queensland/AustraliaDayTest.php new file mode 100644 index 000000000..7b54b9a35 --- /dev/null +++ b/tests/Australia/Queensland/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland; + +/** + * Class for testing Australia day in Queensland (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\AustraliaDayTest +{ +} diff --git a/tests/Australia/Queensland/BoxingDayTest.php b/tests/Australia/Queensland/BoxingDayTest.php new file mode 100644 index 000000000..4e5fdd989 --- /dev/null +++ b/tests/Australia/Queensland/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland; + +/** + * Class for testing Boxing Day in Queensland (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\BoxingDayTest +{ +} diff --git a/tests/Australia/Queensland/Brisbane/AnzacDayTest.php b/tests/Australia/Queensland/Brisbane/AnzacDayTest.php new file mode 100644 index 000000000..2bb71dd5e --- /dev/null +++ b/tests/Australia/Queensland/Brisbane/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland\Brisbane; + +/** + * Class for testing ANZAC day in Brisbane (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\Queensland\AnzacDayTest +{ +} diff --git a/tests/Australia/Queensland/Brisbane/AustraliaDayTest.php b/tests/Australia/Queensland/Brisbane/AustraliaDayTest.php new file mode 100644 index 000000000..a0514fa9b --- /dev/null +++ b/tests/Australia/Queensland/Brisbane/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland\Brisbane; + +/** + * Class for testing Australia day in Brisbane (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\Queensland\AustraliaDayTest +{ +} diff --git a/tests/Australia/Queensland/Brisbane/BoxingDayTest.php b/tests/Australia/Queensland/Brisbane/BoxingDayTest.php new file mode 100644 index 000000000..2c0ec104a --- /dev/null +++ b/tests/Australia/Queensland/Brisbane/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland\Brisbane; + +/** + * Class for testing Boxing Day in Brisbane (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\Queensland\BoxingDayTest +{ +} diff --git a/tests/Australia/Queensland/Brisbane/BrisbaneBaseTestCase.php b/tests/Australia/Queensland/Brisbane/BrisbaneBaseTestCase.php new file mode 100644 index 000000000..98abcf3a0 --- /dev/null +++ b/tests/Australia/Queensland/Brisbane/BrisbaneBaseTestCase.php @@ -0,0 +1,34 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland\Brisbane; + +use Yasumi\tests\Australia\Queensland\QueenslandBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the Queensland holiday provider. + */ +abstract class BrisbaneBaseTestCase extends QueenslandBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\Queensland\Brisbane'; + + /** + * Timezone in which this provider has holidays defined + */ + public $timezone = 'Australia/Brisbane'; +} diff --git a/tests/Australia/Queensland/Brisbane/BrisbaneTest.php b/tests/Australia/Queensland/Brisbane/BrisbaneTest.php new file mode 100644 index 000000000..33417dcbb --- /dev/null +++ b/tests/Australia/Queensland/Brisbane/BrisbaneTest.php @@ -0,0 +1,55 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland\Brisbane; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in Queensland (Australia). + */ +class BrisbaneTest extends BrisbaneBaseTestCase +{ + + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in Queensland (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'queensBirthday', + 'labourDay', + 'peoplesDay', + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/Queensland/Brisbane/ChristmasDayTest.php b/tests/Australia/Queensland/Brisbane/ChristmasDayTest.php new file mode 100644 index 000000000..c998796c2 --- /dev/null +++ b/tests/Australia/Queensland/Brisbane/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland\Brisbane; + +/** + * Class for testing Christmas Day in Brisbane (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\Queensland\ChristmasDayTest +{ +} diff --git a/tests/Australia/Queensland/Brisbane/EasterMondayTest.php b/tests/Australia/Queensland/Brisbane/EasterMondayTest.php new file mode 100644 index 000000000..a16b31bb4 --- /dev/null +++ b/tests/Australia/Queensland/Brisbane/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland\Brisbane; + +/** + * Class for testing Easter Monday in Brisbane (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\Queensland\EasterMondayTest +{ +} diff --git a/tests/Australia/Queensland/Brisbane/GoodFridayTest.php b/tests/Australia/Queensland/Brisbane/GoodFridayTest.php new file mode 100644 index 000000000..35892c630 --- /dev/null +++ b/tests/Australia/Queensland/Brisbane/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland\Brisbane; + +/** + * Class for testing Good Friday in Brisbane (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\Queensland\GoodFridayTest +{ +} diff --git a/tests/Australia/Queensland/Brisbane/LabourDayTest.php b/tests/Australia/Queensland/Brisbane/LabourDayTest.php new file mode 100644 index 000000000..dec835440 --- /dev/null +++ b/tests/Australia/Queensland/Brisbane/LabourDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland\Brisbane; + +/** + * Class for testing Labour Day in Brisbane (Australia).. + */ +class LabourDayTest extends \Yasumi\tests\Australia\Queensland\LabourDayTest +{ +} diff --git a/tests/Australia/Queensland/Brisbane/NewYearsDayTest.php b/tests/Australia/Queensland/Brisbane/NewYearsDayTest.php new file mode 100644 index 000000000..afe4577d6 --- /dev/null +++ b/tests/Australia/Queensland/Brisbane/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland\Brisbane; + +/** + * Class for testing New Years Day in Brisbane (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\Queensland\NewYearsDayTest +{ +} diff --git a/tests/Australia/Queensland/Brisbane/PeoplesDayTest.php b/tests/Australia/Queensland/Brisbane/PeoplesDayTest.php new file mode 100644 index 000000000..0b977a7b3 --- /dev/null +++ b/tests/Australia/Queensland/Brisbane/PeoplesDayTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland\Brisbane; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Ekka People's Day in Brisbane (Australia).. + */ +class PeoplesDayTest extends BrisbaneBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'peoplesDay'; + + /** + * Tests Ekka People's 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-08-11'], + [2011, '2011-08-10'], + [2012, '2012-08-15'], + [2013, '2013-08-14'], + [2014, '2014-08-13'], + [2015, '2015-08-12'], + [2016, '2016-08-10'], + [2017, '2017-08-16'], + [2018, '2018-08-15'], + [2019, '2019-08-14'], + [2020, '2020-08-12'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Ekka People\'s Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Queensland/Brisbane/QueensBirthdayTest.php b/tests/Australia/Queensland/Brisbane/QueensBirthdayTest.php new file mode 100644 index 000000000..f6afc0b8a --- /dev/null +++ b/tests/Australia/Queensland/Brisbane/QueensBirthdayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland\Brisbane; + +/** + * Class for testing Queen's Birthday in Brisbane (Australia).. + */ +class QueensBirthdayTest extends \Yasumi\tests\Australia\Queensland\QueensBirthdayTest +{ +} diff --git a/tests/Australia/Queensland/ChristmasDayTest.php b/tests/Australia/Queensland/ChristmasDayTest.php new file mode 100644 index 000000000..bbf67f363 --- /dev/null +++ b/tests/Australia/Queensland/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland; + +/** + * Class for testing Christmas Day in Queensland (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\ChristmasDayTest +{ +} diff --git a/tests/Australia/Queensland/EasterMondayTest.php b/tests/Australia/Queensland/EasterMondayTest.php new file mode 100644 index 000000000..8207d77dd --- /dev/null +++ b/tests/Australia/Queensland/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland; + +/** + * Class for testing Easter Monday in Queensland (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\EasterMondayTest +{ +} diff --git a/tests/Australia/Queensland/GoodFridayTest.php b/tests/Australia/Queensland/GoodFridayTest.php new file mode 100644 index 000000000..c0df3ec6a --- /dev/null +++ b/tests/Australia/Queensland/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland; + +/** + * Class for testing Good Friday in Queensland (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\GoodFridayTest +{ +} diff --git a/tests/Australia/Queensland/LabourDayTest.php b/tests/Australia/Queensland/LabourDayTest.php new file mode 100644 index 000000000..18bb0db61 --- /dev/null +++ b/tests/Australia/Queensland/LabourDayTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Labour Day in Queensland (Australia).. + */ +class LabourDayTest extends QueenslandBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-05-03'], + [2011, '2011-05-02'], + [2012, '2012-05-07'], + [2013, '2013-10-07'], + [2014, '2014-10-06'], + [2015, '2015-10-05'], + [2016, '2016-05-02'], + [2017, '2017-05-01'], + [2018, '2018-05-07'], + [2019, '2019-05-06'], + [2020, '2020-05-04'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Labour Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Queensland/NewYearsDayTest.php b/tests/Australia/Queensland/NewYearsDayTest.php new file mode 100644 index 000000000..b3a624f08 --- /dev/null +++ b/tests/Australia/Queensland/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland; + +/** + * Class for testing New Years Day in Queensland (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\NewYearsDayTest +{ +} diff --git a/tests/Australia/Queensland/QueensBirthdayTest.php b/tests/Australia/Queensland/QueensBirthdayTest.php new file mode 100644 index 000000000..d2054a83e --- /dev/null +++ b/tests/Australia/Queensland/QueensBirthdayTest.php @@ -0,0 +1,107 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Queen's Birthday in Queensland (Australia).. + */ +class QueensBirthdayTest extends QueenslandBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'queensBirthday'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 1950; + + /** + * Tests Queen's Birthday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-06-14'], + [2011, '2011-06-13'], + [2012, '2012-10-01'], + [2013, '2013-06-10'], + [2014, '2014-06-09'], + [2015, '2015-06-08'], + [2016, '2016-10-03'], + [2017, '2017-10-02'], + [2018, '2018-10-01'], + [2019, '2019-10-07'], + [2020, '2020-10-05'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Queen\'s Birthday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Australia/Queensland/QueenslandBaseTestCase.php b/tests/Australia/Queensland/QueenslandBaseTestCase.php new file mode 100644 index 000000000..64b581a65 --- /dev/null +++ b/tests/Australia/Queensland/QueenslandBaseTestCase.php @@ -0,0 +1,34 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland; + +use Yasumi\tests\Australia\AustraliaBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the Queensland holiday provider. + */ +abstract class QueenslandBaseTestCase extends AustraliaBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\Queensland'; + + /** + * Timezone in which this provider has holidays defined + */ + public $timezone = 'Australia/Queensland'; +} diff --git a/tests/Australia/Queensland/QueenslandTest.php b/tests/Australia/Queensland/QueenslandTest.php new file mode 100644 index 000000000..996375bde --- /dev/null +++ b/tests/Australia/Queensland/QueenslandTest.php @@ -0,0 +1,54 @@ + + */ + +namespace Yasumi\tests\Australia\Queensland; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in Queensland (Australia). + */ +class QueenslandTest extends QueenslandBaseTestCase +{ + + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in Queensland (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'queensBirthday', + 'labourDay', + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/SA/AdelaideCupDayTest.php b/tests/Australia/SA/AdelaideCupDayTest.php new file mode 100644 index 000000000..559b939a3 --- /dev/null +++ b/tests/Australia/SA/AdelaideCupDayTest.php @@ -0,0 +1,117 @@ + + */ + +namespace Yasumi\tests\Australia\SA; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Adelaide Cup Day in SA (Australia).. + */ +class AdelaideCupDayTest extends SABaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'adelaideCup'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 1973; + + /** + * Tests Adelaide Cup 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2000, '2000-05-15'], + [2001, '2001-05-21'], + [2002, '2002-05-20'], + [2003, '2003-05-19'], + [2004, '2004-05-17'], + [2005, '2005-05-16'], + [2006, '2006-03-13'], + [2007, '2007-03-12'], + [2008, '2008-03-10'], + [2009, '2009-03-09'], + [2010, '2010-03-08'], + [2011, '2011-03-14'], + [2012, '2012-03-12'], + [2013, '2013-03-11'], + [2014, '2014-03-10'], + [2015, '2015-03-09'], + [2016, '2016-03-14'], + [2017, '2017-03-13'], + [2018, '2018-03-12'], + [2019, '2019-03-11'], + [2020, '2020-03-09'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Adelaide Cup'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Australia/SA/AnzacDayTest.php b/tests/Australia/SA/AnzacDayTest.php new file mode 100644 index 000000000..a128e5a56 --- /dev/null +++ b/tests/Australia/SA/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\SA; + +/** + * Class for testing ANZAC day in SA (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\AnzacDayTest +{ +} diff --git a/tests/Australia/SA/AustraliaDayTest.php b/tests/Australia/SA/AustraliaDayTest.php new file mode 100644 index 000000000..7564e768f --- /dev/null +++ b/tests/Australia/SA/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\SA; + +/** + * Class for testing Australia day in SA (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\AustraliaDayTest +{ +} diff --git a/tests/Australia/SA/ChristmasDayTest.php b/tests/Australia/SA/ChristmasDayTest.php new file mode 100644 index 000000000..e7b248eb4 --- /dev/null +++ b/tests/Australia/SA/ChristmasDayTest.php @@ -0,0 +1,122 @@ + + */ + +namespace Yasumi\tests\Australia\SA; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Christmas Day in South Australia. + */ +class ChristmasDayTest extends SABaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'christmasDay'; + public const HOLIDAY2 = 'christmasHoliday'; + + /** + * 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 + * @param string $expectedExtra the expected date for the additional holiday, or null if no additional holiday + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected, $expectedExtra) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + if ($expectedExtra === null) { + $this->assertNotHoliday( + $this->region, + self::HOLIDAY2, + $year + ); + } else { + $this->assertHoliday( + $this->region, + self::HOLIDAY2, + $year, + new DateTime($expectedExtra, new DateTimeZone($this->timezone)) + ); + } + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-12-25', '2010-12-27'], + [2011, '2011-12-25', '2011-12-26'], + [2012, '2012-12-25', null], + [2013, '2013-12-25', null], + [2014, '2014-12-25', null], + [2015, '2015-12-25', null], + [2016, '2016-12-25', '2016-12-26'], + [2017, '2017-12-25', null], + [2018, '2018-12-25', null], + [2019, '2019-12-25', null], + [2020, '2020-12-25', null], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Christmas Day'] + ); + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY2, + 2016, + [self::LOCALE => 'Christmas Holiday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY2, 2016, Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/SA/EasterMondayTest.php b/tests/Australia/SA/EasterMondayTest.php new file mode 100644 index 000000000..e6e43ca9b --- /dev/null +++ b/tests/Australia/SA/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\SA; + +/** + * Class for testing Easter Monday in SA (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\EasterMondayTest +{ +} diff --git a/tests/Australia/SA/EasterSaturdayTest.php b/tests/Australia/SA/EasterSaturdayTest.php new file mode 100644 index 000000000..068d5d493 --- /dev/null +++ b/tests/Australia/SA/EasterSaturdayTest.php @@ -0,0 +1,95 @@ + + */ + +namespace Yasumi\tests\Australia\SA; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Easter Saturday in SA (Australia).. + */ +class EasterSaturdayTest extends SABaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'easterSaturday'; + + /** + * Tests Easter Saturday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + $data = []; + + for ($y = 0; $y < 50; $y++) { + $year = $this->generateRandomYear(); + $date = $this->calculateEaster($year, $this->timezone); + $date->sub(new DateInterval('P1D')); + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Easter Saturday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/SA/GoodFridayTest.php b/tests/Australia/SA/GoodFridayTest.php new file mode 100644 index 000000000..67a1f54c8 --- /dev/null +++ b/tests/Australia/SA/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\SA; + +/** + * Class for testing Good Friday in SA (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\GoodFridayTest +{ +} diff --git a/tests/Australia/LabourDayTest.php b/tests/Australia/SA/LabourDayTest.php similarity index 59% rename from tests/Australia/LabourDayTest.php rename to tests/Australia/SA/LabourDayTest.php index df355db0d..5207d9bd6 100644 --- a/tests/Australia/LabourDayTest.php +++ b/tests/Australia/SA/LabourDayTest.php @@ -2,15 +2,15 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ -namespace Yasumi\tests\Australia; +namespace Yasumi\tests\Australia\SA; use DateTime; use DateTimeZone; @@ -18,17 +18,14 @@ use Yasumi\tests\YasumiTestCaseInterface; /** - * Class for testing Labour Day in Australia. + * Class for testing Labour Day in SA (Australia).. */ -abstract class LabourDayTest extends AustraliaBaseTestCase implements YasumiTestCaseInterface +class LabourDayTest extends SABaseTestCase implements YasumiTestCaseInterface { /** * The name of the holiday */ - const HOLIDAY = 'labourDay'; - - - protected $dateFormat; // picked a random date -- sorry :) + public const HOLIDAY = 'labourDay'; /** * Tests Labour Day @@ -37,6 +34,9 @@ abstract class LabourDayTest extends AustraliaBaseTestCase implements YasumiTest * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -48,21 +48,35 @@ public function testHoliday($year, $expected) ); } - /** * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { - return []; + $data = [ + [2010, '2010-10-04'], + [2011, '2011-10-03'], + [2012, '2012-10-01'], + [2013, '2013-10-07'], + [2014, '2014-10-06'], + [2015, '2015-10-05'], + [2016, '2016-10-03'], + [2017, '2017-10-02'], + [2018, '2018-10-01'], + [2019, '2019-10-07'], + [2020, '2020-10-05'], + ]; + + return $data; } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( $this->region, @@ -74,8 +88,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Australia/SA/NewYearsDayTest.php b/tests/Australia/SA/NewYearsDayTest.php new file mode 100644 index 000000000..c5df3ba4d --- /dev/null +++ b/tests/Australia/SA/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\SA; + +/** + * Class for testing New Years Day in SA (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\NewYearsDayTest +{ +} diff --git a/tests/Australia/SA/ProclamationDayTest.php b/tests/Australia/SA/ProclamationDayTest.php new file mode 100644 index 000000000..19ed2d373 --- /dev/null +++ b/tests/Australia/SA/ProclamationDayTest.php @@ -0,0 +1,102 @@ + + */ + +namespace Yasumi\tests\Australia\SA; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Proclamation Day in SA (Australia).. + */ +class ProclamationDayTest extends SABaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'proclamationDay'; + + /** + * Tests Proclamation 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-12-28'], + [2011, '2011-12-27'], + [2012, '2012-12-26'], + [2013, '2013-12-26'], + [2014, '2014-12-26'], + [2015, '2015-12-28'], + [2016, '2016-12-27'], + [2017, '2017-12-26'], + [2018, '2018-12-26'], + [2019, '2019-12-26'], + [2020, '2020-12-28'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Proclamation Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Australia/SA/QueensBirthdayTest.php b/tests/Australia/SA/QueensBirthdayTest.php new file mode 100644 index 000000000..97d1e58d6 --- /dev/null +++ b/tests/Australia/SA/QueensBirthdayTest.php @@ -0,0 +1,107 @@ + + */ + +namespace Yasumi\tests\Australia\SA; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Queen's Birthday in SA (Australia).. + */ +class QueensBirthdayTest extends SABaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'queensBirthday'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 1950; + + /** + * Tests Queen's Birthday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-06-14'], + [2011, '2011-06-13'], + [2012, '2012-06-11'], + [2013, '2013-06-10'], + [2014, '2014-06-09'], + [2015, '2015-06-08'], + [2016, '2016-06-13'], + [2017, '2017-06-12'], + [2018, '2018-06-11'], + [2019, '2019-06-10'], + [2020, '2020-06-08'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Queen\'s Birthday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Australia/SA/SABaseTestCase.php b/tests/Australia/SA/SABaseTestCase.php new file mode 100644 index 000000000..b71aee408 --- /dev/null +++ b/tests/Australia/SA/SABaseTestCase.php @@ -0,0 +1,34 @@ + + */ + +namespace Yasumi\tests\Australia\SA; + +use Yasumi\tests\Australia\AustraliaBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the Victoria holiday provider. + */ +abstract class SABaseTestCase extends AustraliaBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\SA'; + + /** + * Timezone in which this provider has holidays defined + */ + public $timezone = 'Australia/South'; +} diff --git a/tests/Australia/SA/SATest.php b/tests/Australia/SA/SATest.php new file mode 100644 index 000000000..b2baaffec --- /dev/null +++ b/tests/Australia/SA/SATest.php @@ -0,0 +1,55 @@ + + */ + +namespace Yasumi\tests\Australia\SA; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in SA (Australia). + */ +class SATest extends SABaseTestCase +{ + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in SA (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'proclamationDay', + 'australiaDay', + 'anzacDay', + 'easterSaturday', + 'queensBirthday', + 'labourDay', + 'adelaideCup' + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1973); + } +} diff --git a/tests/Australia/Tasmania/AnzacDayTest.php b/tests/Australia/Tasmania/AnzacDayTest.php new file mode 100644 index 000000000..b2dd07789 --- /dev/null +++ b/tests/Australia/Tasmania/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania; + +/** + * Class for testing ANZAC day in Tasmania (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\AnzacDayTest +{ +} diff --git a/tests/Australia/Tasmania/AustraliaDayTest.php b/tests/Australia/Tasmania/AustraliaDayTest.php new file mode 100644 index 000000000..c28c3d104 --- /dev/null +++ b/tests/Australia/Tasmania/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania; + +/** + * Class for testing Australia day in Tasmania (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\AustraliaDayTest +{ +} diff --git a/tests/Australia/Tasmania/BoxingDayTest.php b/tests/Australia/Tasmania/BoxingDayTest.php new file mode 100644 index 000000000..ad0421687 --- /dev/null +++ b/tests/Australia/Tasmania/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania; + +/** + * Class for testing Boxing Day in Tasmania (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\BoxingDayTest +{ +} diff --git a/tests/Australia/Tasmania/CentralNorth/AnzacDayTest.php b/tests/Australia/Tasmania/CentralNorth/AnzacDayTest.php new file mode 100644 index 000000000..e27fb1b78 --- /dev/null +++ b/tests/Australia/Tasmania/CentralNorth/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\CentralNorth; + +/** + * Class for testing ANZAC day in central north Tasmania (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\Tasmania\AnzacDayTest +{ +} diff --git a/tests/Australia/Tasmania/CentralNorth/AustraliaDayTest.php b/tests/Australia/Tasmania/CentralNorth/AustraliaDayTest.php new file mode 100644 index 000000000..977d97b45 --- /dev/null +++ b/tests/Australia/Tasmania/CentralNorth/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\CentralNorth; + +/** + * Class for testing Australia day in central north Tasmania (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\Tasmania\AustraliaDayTest +{ +} diff --git a/tests/Australia/Tasmania/CentralNorth/BoxingDayTest.php b/tests/Australia/Tasmania/CentralNorth/BoxingDayTest.php new file mode 100644 index 000000000..867fe918c --- /dev/null +++ b/tests/Australia/Tasmania/CentralNorth/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\CentralNorth; + +/** + * Class for testing Boxing Day in central north Tasmania (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\Tasmania\BoxingDayTest +{ +} diff --git a/tests/Australia/Tasmania/CentralNorth/CentralNorthBaseTestCase.php b/tests/Australia/Tasmania/CentralNorth/CentralNorthBaseTestCase.php new file mode 100644 index 000000000..7dce26cc5 --- /dev/null +++ b/tests/Australia/Tasmania/CentralNorth/CentralNorthBaseTestCase.php @@ -0,0 +1,29 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\CentralNorth; + +use Yasumi\tests\Australia\Tasmania\TasmaniaBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the central north Tasmania holiday provider. + */ +abstract class CentralNorthBaseTestCase extends TasmaniaBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\Tasmania\CentralNorth'; +} diff --git a/tests/Australia/Tasmania/CentralNorth/CentralNorthTest.php b/tests/Australia/Tasmania/CentralNorth/CentralNorthTest.php new file mode 100644 index 000000000..2d9daf03a --- /dev/null +++ b/tests/Australia/Tasmania/CentralNorth/CentralNorthTest.php @@ -0,0 +1,55 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\CentralNorth; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in central north Tasmania (Australia). + */ +class CentralNorthTest extends CentralNorthBaseTestCase +{ + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in central north Tasmania (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'queensBirthday', + 'eightHourDay', + 'recreationDay', + 'devonportShow' + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/Tasmania/CentralNorth/ChristmasDayTest.php b/tests/Australia/Tasmania/CentralNorth/ChristmasDayTest.php new file mode 100644 index 000000000..023e55c52 --- /dev/null +++ b/tests/Australia/Tasmania/CentralNorth/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\CentralNorth; + +/** + * Class for testing Christmas Day in central north Tasmania (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\Tasmania\ChristmasDayTest +{ +} diff --git a/tests/Australia/Tasmania/CentralNorth/DevonportShowTest.php b/tests/Australia/Tasmania/CentralNorth/DevonportShowTest.php new file mode 100644 index 000000000..d986a775f --- /dev/null +++ b/tests/Australia/Tasmania/CentralNorth/DevonportShowTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\CentralNorth; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Devonport Show Day in central north Tasmania (Australia).. + */ +class DevonportShowTest extends CentralNorthBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'devonportShow'; + + /** + * Tests Devonport Show 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-11-26'], + [2011, '2011-11-25'], + [2012, '2012-11-30'], + [2013, '2013-11-29'], + [2014, '2014-11-28'], + [2015, '2015-11-27'], + [2016, '2016-11-25'], + [2017, '2017-12-01'], + [2018, '2018-11-30'], + [2019, '2019-11-29'], + [2020, '2020-11-27'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Devonport Show'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Tasmania/CentralNorth/EasterMondayTest.php b/tests/Australia/Tasmania/CentralNorth/EasterMondayTest.php new file mode 100644 index 000000000..a730e6c02 --- /dev/null +++ b/tests/Australia/Tasmania/CentralNorth/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\CentralNorth; + +/** + * Class for testing Easter Monday in central north Tasmania (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\Tasmania\EasterMondayTest +{ +} diff --git a/tests/Australia/Tasmania/CentralNorth/EightHourDayTest.php b/tests/Australia/Tasmania/CentralNorth/EightHourDayTest.php new file mode 100644 index 000000000..cceb8ce7a --- /dev/null +++ b/tests/Australia/Tasmania/CentralNorth/EightHourDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\CentralNorth; + +/** + * Class for testing Eight Hour Day in central north Tasmania (Australia).. + */ +class EightHourDayTest extends \Yasumi\tests\Australia\Tasmania\EightHourDayTest +{ +} diff --git a/tests/Australia/Tasmania/CentralNorth/GoodFridayTest.php b/tests/Australia/Tasmania/CentralNorth/GoodFridayTest.php new file mode 100644 index 000000000..58ab84376 --- /dev/null +++ b/tests/Australia/Tasmania/CentralNorth/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\CentralNorth; + +/** + * Class for testing Good Friday in central north Tasmania (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\Tasmania\GoodFridayTest +{ +} diff --git a/tests/Australia/Tasmania/CentralNorth/NewYearsDayTest.php b/tests/Australia/Tasmania/CentralNorth/NewYearsDayTest.php new file mode 100644 index 000000000..501644b05 --- /dev/null +++ b/tests/Australia/Tasmania/CentralNorth/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\CentralNorth; + +/** + * Class for testing New Years Day in central north Tasmania (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\Tasmania\NewYearsDayTest +{ +} diff --git a/tests/Australia/Tasmania/CentralNorth/QueensBirthdayTest.php b/tests/Australia/Tasmania/CentralNorth/QueensBirthdayTest.php new file mode 100644 index 000000000..0795af672 --- /dev/null +++ b/tests/Australia/Tasmania/CentralNorth/QueensBirthdayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\CentralNorth; + +/** + * Class for testing Queen's Birthday in central north Tasmania (Australia).. + */ +class QueensBirthdayTest extends \Yasumi\tests\Australia\Tasmania\QueensBirthdayTest +{ +} diff --git a/tests/Australia/Tasmania/CentralNorth/RecreationDayTest.php b/tests/Australia/Tasmania/CentralNorth/RecreationDayTest.php new file mode 100644 index 000000000..15c901eb7 --- /dev/null +++ b/tests/Australia/Tasmania/CentralNorth/RecreationDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\CentralNorth; + +/** + * Class for testing Recreation Day in central north Tasmania (Australia).. + */ +class RecreationDayTest extends \Yasumi\tests\Australia\Tasmania\RecreationDayTest +{ +} diff --git a/tests/Australia/Tasmania/ChristmasDayTest.php b/tests/Australia/Tasmania/ChristmasDayTest.php new file mode 100644 index 000000000..c4e41e496 --- /dev/null +++ b/tests/Australia/Tasmania/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania; + +/** + * Class for testing Christmas Day in Tasmania (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\ChristmasDayTest +{ +} diff --git a/tests/Australia/Tasmania/EasterMondayTest.php b/tests/Australia/Tasmania/EasterMondayTest.php new file mode 100644 index 000000000..52d4e67ce --- /dev/null +++ b/tests/Australia/Tasmania/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania; + +/** + * Class for testing Easter Monday in Tasmania (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\EasterMondayTest +{ +} diff --git a/tests/Australia/Tasmania/EightHourDayTest.php b/tests/Australia/Tasmania/EightHourDayTest.php new file mode 100644 index 000000000..ac7c4fd39 --- /dev/null +++ b/tests/Australia/Tasmania/EightHourDayTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Eight Hour Day in Tasmania (Australia).. + */ +class EightHourDayTest extends TasmaniaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'eightHourDay'; + + /** + * Tests Eight Hour 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-03-08'], + [2011, '2011-03-14'], + [2012, '2012-03-12'], + [2013, '2013-03-11'], + [2014, '2014-03-10'], + [2015, '2015-03-09'], + [2016, '2016-03-14'], + [2017, '2017-03-13'], + [2018, '2018-03-12'], + [2019, '2019-03-11'], + [2020, '2020-03-09'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Eight Hour Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Tasmania/FlindersIsland/AnzacDayTest.php b/tests/Australia/Tasmania/FlindersIsland/AnzacDayTest.php new file mode 100644 index 000000000..cd0025998 --- /dev/null +++ b/tests/Australia/Tasmania/FlindersIsland/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\FlindersIsland; + +/** + * Class for testing ANZAC day in Flinders Island (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\Tasmania\AnzacDayTest +{ +} diff --git a/tests/Australia/Tasmania/FlindersIsland/AustraliaDayTest.php b/tests/Australia/Tasmania/FlindersIsland/AustraliaDayTest.php new file mode 100644 index 000000000..553934567 --- /dev/null +++ b/tests/Australia/Tasmania/FlindersIsland/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\FlindersIsland; + +/** + * Class for testing Australia day in Flinders Island (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\Tasmania\AustraliaDayTest +{ +} diff --git a/tests/Australia/Tasmania/FlindersIsland/BoxingDayTest.php b/tests/Australia/Tasmania/FlindersIsland/BoxingDayTest.php new file mode 100644 index 000000000..9eeb201dd --- /dev/null +++ b/tests/Australia/Tasmania/FlindersIsland/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\FlindersIsland; + +/** + * Class for testing Boxing Day in Flinders Island (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\Tasmania\BoxingDayTest +{ +} diff --git a/tests/Australia/Tasmania/FlindersIsland/ChristmasDayTest.php b/tests/Australia/Tasmania/FlindersIsland/ChristmasDayTest.php new file mode 100644 index 000000000..0ef6a657b --- /dev/null +++ b/tests/Australia/Tasmania/FlindersIsland/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\FlindersIsland; + +/** + * Class for testing Christmas Day in Flinders Island (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\Tasmania\ChristmasDayTest +{ +} diff --git a/tests/Australia/Tasmania/FlindersIsland/EasterMondayTest.php b/tests/Australia/Tasmania/FlindersIsland/EasterMondayTest.php new file mode 100644 index 000000000..6ad4c0acb --- /dev/null +++ b/tests/Australia/Tasmania/FlindersIsland/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\FlindersIsland; + +/** + * Class for testing Easter Monday in Flinders Island (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\Tasmania\EasterMondayTest +{ +} diff --git a/tests/Australia/Tasmania/FlindersIsland/EightHourDayTest.php b/tests/Australia/Tasmania/FlindersIsland/EightHourDayTest.php new file mode 100644 index 000000000..f16e44970 --- /dev/null +++ b/tests/Australia/Tasmania/FlindersIsland/EightHourDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\FlindersIsland; + +/** + * Class for testing Eight Hour Day in Flinders Island (Australia).. + */ +class EightHourDayTest extends \Yasumi\tests\Australia\Tasmania\EightHourDayTest +{ +} diff --git a/tests/Australia/Tasmania/FlindersIsland/FlindersIslandBaseTestCase.php b/tests/Australia/Tasmania/FlindersIsland/FlindersIslandBaseTestCase.php new file mode 100644 index 000000000..aba5e54c8 --- /dev/null +++ b/tests/Australia/Tasmania/FlindersIsland/FlindersIslandBaseTestCase.php @@ -0,0 +1,29 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\FlindersIsland; + +use Yasumi\tests\Australia\Tasmania\TasmaniaBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the Flinders Island holiday provider. + */ +abstract class FlindersIslandBaseTestCase extends TasmaniaBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\Tasmania\FlindersIsland'; +} diff --git a/tests/Australia/Tasmania/FlindersIsland/FlindersIslandShowTest.php b/tests/Australia/Tasmania/FlindersIsland/FlindersIslandShowTest.php new file mode 100644 index 000000000..4dbbc762a --- /dev/null +++ b/tests/Australia/Tasmania/FlindersIsland/FlindersIslandShowTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\FlindersIsland; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Flinders Island Show Day in Flinders Island (Australia).. + */ +class FlindersIslandShowTest extends FlindersIslandBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'flindersIslandShow'; + + /** + * Tests Flinders Island Show 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-10-15'], + [2011, '2011-10-14'], + [2012, '2012-10-19'], + [2013, '2013-10-18'], + [2014, '2014-10-17'], + [2015, '2015-10-16'], + [2016, '2016-10-14'], + [2017, '2017-10-20'], + [2018, '2018-10-19'], + [2019, '2019-10-18'], + [2020, '2020-10-16'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Flinders Island Show'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Tasmania/FlindersIsland/FlindersIslandTest.php b/tests/Australia/Tasmania/FlindersIsland/FlindersIslandTest.php new file mode 100644 index 000000000..7c3abf6db --- /dev/null +++ b/tests/Australia/Tasmania/FlindersIsland/FlindersIslandTest.php @@ -0,0 +1,56 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\FlindersIsland; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in Flinders Island (Australia). + */ +class FlindersIslandTest extends FlindersIslandBaseTestCase +{ + + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in Flinders Island (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'queensBirthday', + 'eightHourDay', + 'recreationDay', + 'flindersIslandShow' + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/Tasmania/FlindersIsland/GoodFridayTest.php b/tests/Australia/Tasmania/FlindersIsland/GoodFridayTest.php new file mode 100644 index 000000000..067967bd4 --- /dev/null +++ b/tests/Australia/Tasmania/FlindersIsland/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\FlindersIsland; + +/** + * Class for testing Good Friday in Flinders Island (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\Tasmania\GoodFridayTest +{ +} diff --git a/tests/Australia/Tasmania/FlindersIsland/NewYearsDayTest.php b/tests/Australia/Tasmania/FlindersIsland/NewYearsDayTest.php new file mode 100644 index 000000000..65428ddcc --- /dev/null +++ b/tests/Australia/Tasmania/FlindersIsland/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\FlindersIsland; + +/** + * Class for testing New Years Day in Flinders Island (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\Tasmania\NewYearsDayTest +{ +} diff --git a/tests/Australia/Tasmania/FlindersIsland/QueensBirthdayTest.php b/tests/Australia/Tasmania/FlindersIsland/QueensBirthdayTest.php new file mode 100644 index 000000000..2a5be2f05 --- /dev/null +++ b/tests/Australia/Tasmania/FlindersIsland/QueensBirthdayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\FlindersIsland; + +/** + * Class for testing Queen's Birthday in Flinders Island (Australia).. + */ +class QueensBirthdayTest extends \Yasumi\tests\Australia\Tasmania\QueensBirthdayTest +{ +} diff --git a/tests/Australia/Tasmania/FlindersIsland/RecreationDayTest.php b/tests/Australia/Tasmania/FlindersIsland/RecreationDayTest.php new file mode 100644 index 000000000..9b6e4aa17 --- /dev/null +++ b/tests/Australia/Tasmania/FlindersIsland/RecreationDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\FlindersIsland; + +/** + * Class for testing Recreation Day in Flinders Island (Australia).. + */ +class RecreationDayTest extends \Yasumi\tests\Australia\Tasmania\RecreationDayTest +{ +} diff --git a/tests/Australia/Tasmania/GoodFridayTest.php b/tests/Australia/Tasmania/GoodFridayTest.php new file mode 100644 index 000000000..2fd43d9ed --- /dev/null +++ b/tests/Australia/Tasmania/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania; + +/** + * Class for testing Good Friday in Tasmania (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\GoodFridayTest +{ +} diff --git a/tests/Australia/Tasmania/KingIsland/AnzacDayTest.php b/tests/Australia/Tasmania/KingIsland/AnzacDayTest.php new file mode 100644 index 000000000..49ff14db8 --- /dev/null +++ b/tests/Australia/Tasmania/KingIsland/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\KingIsland; + +/** + * Class for testing ANZAC day in King Island (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\Tasmania\AnzacDayTest +{ +} diff --git a/tests/Australia/Tasmania/KingIsland/AustraliaDayTest.php b/tests/Australia/Tasmania/KingIsland/AustraliaDayTest.php new file mode 100644 index 000000000..399db25d5 --- /dev/null +++ b/tests/Australia/Tasmania/KingIsland/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\KingIsland; + +/** + * Class for testing Australia day in King Island (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\Tasmania\AustraliaDayTest +{ +} diff --git a/tests/Australia/Tasmania/KingIsland/BoxingDayTest.php b/tests/Australia/Tasmania/KingIsland/BoxingDayTest.php new file mode 100644 index 000000000..7b61efe41 --- /dev/null +++ b/tests/Australia/Tasmania/KingIsland/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\KingIsland; + +/** + * Class for testing Boxing Day in King Island (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\Tasmania\BoxingDayTest +{ +} diff --git a/tests/Australia/Tasmania/KingIsland/ChristmasDayTest.php b/tests/Australia/Tasmania/KingIsland/ChristmasDayTest.php new file mode 100644 index 000000000..ce36f9d18 --- /dev/null +++ b/tests/Australia/Tasmania/KingIsland/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\KingIsland; + +/** + * Class for testing Christmas Day in King Island (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\Tasmania\ChristmasDayTest +{ +} diff --git a/tests/Australia/Tasmania/KingIsland/EasterMondayTest.php b/tests/Australia/Tasmania/KingIsland/EasterMondayTest.php new file mode 100644 index 000000000..5c8fbf70a --- /dev/null +++ b/tests/Australia/Tasmania/KingIsland/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\KingIsland; + +/** + * Class for testing Easter Monday in King Island (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\Tasmania\EasterMondayTest +{ +} diff --git a/tests/Australia/Tasmania/KingIsland/EightHourDayTest.php b/tests/Australia/Tasmania/KingIsland/EightHourDayTest.php new file mode 100644 index 000000000..03313451a --- /dev/null +++ b/tests/Australia/Tasmania/KingIsland/EightHourDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\KingIsland; + +/** + * Class for testing Eight Hour Day in King Island (Australia).. + */ +class EightHourDayTest extends \Yasumi\tests\Australia\Tasmania\EightHourDayTest +{ +} diff --git a/tests/Australia/Tasmania/KingIsland/GoodFridayTest.php b/tests/Australia/Tasmania/KingIsland/GoodFridayTest.php new file mode 100644 index 000000000..b8206f19b --- /dev/null +++ b/tests/Australia/Tasmania/KingIsland/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\KingIsland; + +/** + * Class for testing Good Friday in King Island (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\Tasmania\GoodFridayTest +{ +} diff --git a/tests/Australia/Tasmania/KingIsland/KingIslandBaseTestCase.php b/tests/Australia/Tasmania/KingIsland/KingIslandBaseTestCase.php new file mode 100644 index 000000000..eac356a2c --- /dev/null +++ b/tests/Australia/Tasmania/KingIsland/KingIslandBaseTestCase.php @@ -0,0 +1,29 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\KingIsland; + +use Yasumi\tests\Australia\Tasmania\TasmaniaBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the King Island holiday provider. + */ +abstract class KingIslandBaseTestCase extends TasmaniaBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\Tasmania\KingIsland'; +} diff --git a/tests/Australia/Tasmania/KingIsland/KingIslandShowTest.php b/tests/Australia/Tasmania/KingIsland/KingIslandShowTest.php new file mode 100644 index 000000000..ed87f8dde --- /dev/null +++ b/tests/Australia/Tasmania/KingIsland/KingIslandShowTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\KingIsland; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing King Island Show Day in King Island (Australia).. + */ +class KingIslandShowTest extends KingIslandBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'kingIslandShow'; + + /** + * Tests King Island Show 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-03-02'], + [2011, '2011-03-01'], + [2012, '2012-03-06'], + [2013, '2013-03-05'], + [2014, '2014-03-04'], + [2015, '2015-03-03'], + [2016, '2016-03-01'], + [2017, '2017-03-07'], + [2018, '2018-03-06'], + [2019, '2019-03-05'], + [2020, '2020-03-03'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'King Island Show'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Tasmania/KingIsland/KingIslandTest.php b/tests/Australia/Tasmania/KingIsland/KingIslandTest.php new file mode 100644 index 000000000..1fe944563 --- /dev/null +++ b/tests/Australia/Tasmania/KingIsland/KingIslandTest.php @@ -0,0 +1,56 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\KingIsland; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in Flinders Island (Australia). + */ +class KingIslandTest extends KingIslandBaseTestCase +{ + + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in King Island (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'queensBirthday', + 'eightHourDay', + 'recreationDay', + 'kingIslandShow' + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/Tasmania/KingIsland/NewYearsDayTest.php b/tests/Australia/Tasmania/KingIsland/NewYearsDayTest.php new file mode 100644 index 000000000..46b718343 --- /dev/null +++ b/tests/Australia/Tasmania/KingIsland/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\KingIsland; + +/** + * Class for testing New Years Day in King Island (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\Tasmania\NewYearsDayTest +{ +} diff --git a/tests/Australia/Tasmania/KingIsland/QueensBirthdayTest.php b/tests/Australia/Tasmania/KingIsland/QueensBirthdayTest.php new file mode 100644 index 000000000..4a84a1a41 --- /dev/null +++ b/tests/Australia/Tasmania/KingIsland/QueensBirthdayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\KingIsland; + +/** + * Class for testing Queen's Birthday in King Island (Australia).. + */ +class QueensBirthdayTest extends \Yasumi\tests\Australia\Tasmania\QueensBirthdayTest +{ +} diff --git a/tests/Australia/Tasmania/KingIsland/RecreationDayTest.php b/tests/Australia/Tasmania/KingIsland/RecreationDayTest.php new file mode 100644 index 000000000..aeac76ccd --- /dev/null +++ b/tests/Australia/Tasmania/KingIsland/RecreationDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\KingIsland; + +/** + * Class for testing Recreation Day in King Island (Australia).. + */ +class RecreationDayTest extends \Yasumi\tests\Australia\Tasmania\RecreationDayTest +{ +} diff --git a/tests/Australia/Tasmania/NewYearsDayTest.php b/tests/Australia/Tasmania/NewYearsDayTest.php new file mode 100644 index 000000000..5a147f7fe --- /dev/null +++ b/tests/Australia/Tasmania/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania; + +/** + * Class for testing New Years Day in Tasmania (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\NewYearsDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northeast/AnzacDayTest.php b/tests/Australia/Tasmania/Northeast/AnzacDayTest.php new file mode 100644 index 000000000..2af01ec9e --- /dev/null +++ b/tests/Australia/Tasmania/Northeast/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northeast; + +/** + * Class for testing ANZAC day in northeastern Tasmania (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\Tasmania\AnzacDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northeast/AustraliaDayTest.php b/tests/Australia/Tasmania/Northeast/AustraliaDayTest.php new file mode 100644 index 000000000..5a77a9b7e --- /dev/null +++ b/tests/Australia/Tasmania/Northeast/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northeast; + +/** + * Class for testing Australia day in northeastern Tasmania (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\Tasmania\AustraliaDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northeast/BoxingDayTest.php b/tests/Australia/Tasmania/Northeast/BoxingDayTest.php new file mode 100644 index 000000000..d974c0768 --- /dev/null +++ b/tests/Australia/Tasmania/Northeast/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northeast; + +/** + * Class for testing Boxing Day in northeastern Tasmania (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\Tasmania\BoxingDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northeast/ChristmasDayTest.php b/tests/Australia/Tasmania/Northeast/ChristmasDayTest.php new file mode 100644 index 000000000..7e5b57825 --- /dev/null +++ b/tests/Australia/Tasmania/Northeast/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northeast; + +/** + * Class for testing Christmas Day in northeastern Tasmania (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\Tasmania\ChristmasDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northeast/EasterMondayTest.php b/tests/Australia/Tasmania/Northeast/EasterMondayTest.php new file mode 100644 index 000000000..3abf25766 --- /dev/null +++ b/tests/Australia/Tasmania/Northeast/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northeast; + +/** + * Class for testing Easter Monday in northeastern Tasmania (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\Tasmania\EasterMondayTest +{ +} diff --git a/tests/Australia/Tasmania/Northeast/EightHourDayTest.php b/tests/Australia/Tasmania/Northeast/EightHourDayTest.php new file mode 100644 index 000000000..8927ec3f9 --- /dev/null +++ b/tests/Australia/Tasmania/Northeast/EightHourDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northeast; + +/** + * Class for testing Eight Hour Day in northeastern Tasmania (Australia).. + */ +class EightHourDayTest extends \Yasumi\tests\Australia\Tasmania\EightHourDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northeast/GoodFridayTest.php b/tests/Australia/Tasmania/Northeast/GoodFridayTest.php new file mode 100644 index 000000000..928498765 --- /dev/null +++ b/tests/Australia/Tasmania/Northeast/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northeast; + +/** + * Class for testing Good Friday in northeastern Tasmania (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\Tasmania\GoodFridayTest +{ +} diff --git a/tests/Australia/Tasmania/Northeast/LauncestonShowTest.php b/tests/Australia/Tasmania/Northeast/LauncestonShowTest.php new file mode 100644 index 000000000..51e600325 --- /dev/null +++ b/tests/Australia/Tasmania/Northeast/LauncestonShowTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northeast; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Launceston Show Day in northeastern Tasmania (Australia).. + */ +class LauncestonShowTest extends NortheastBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'launcestonShow'; + + /** + * Tests Launceston Show 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-10-07'], + [2011, '2011-10-06'], + [2012, '2012-10-11'], + [2013, '2013-10-10'], + [2014, '2014-10-09'], + [2015, '2015-10-08'], + [2016, '2016-10-06'], + [2017, '2017-10-12'], + [2018, '2018-10-11'], + [2019, '2019-10-10'], + [2020, '2020-10-08'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Royal Launceston Show'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Tasmania/Northeast/NewYearsDayTest.php b/tests/Australia/Tasmania/Northeast/NewYearsDayTest.php new file mode 100644 index 000000000..a331566db --- /dev/null +++ b/tests/Australia/Tasmania/Northeast/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northeast; + +/** + * Class for testing New Years Day in northeastern Tasmania (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\Tasmania\NewYearsDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northeast/NortheastBaseTestCase.php b/tests/Australia/Tasmania/Northeast/NortheastBaseTestCase.php new file mode 100644 index 000000000..3a3bc0057 --- /dev/null +++ b/tests/Australia/Tasmania/Northeast/NortheastBaseTestCase.php @@ -0,0 +1,29 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northeast; + +use Yasumi\tests\Australia\Tasmania\TasmaniaBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the northeastern Tasmania holiday provider. + */ +abstract class NortheastBaseTestCase extends TasmaniaBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\Tasmania\Northeast'; +} diff --git a/tests/Australia/Tasmania/Northeast/NortheastTest.php b/tests/Australia/Tasmania/Northeast/NortheastTest.php new file mode 100644 index 000000000..231fc9a35 --- /dev/null +++ b/tests/Australia/Tasmania/Northeast/NortheastTest.php @@ -0,0 +1,56 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northeast; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in northeastern Tasmania (Australia). + */ +class NortheastTest extends NortheastBaseTestCase +{ + + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in northeastern Tasmania (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'queensBirthday', + 'eightHourDay', + 'recreationDay', + 'launcestonShow' + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/Tasmania/Northeast/QueensBirthdayTest.php b/tests/Australia/Tasmania/Northeast/QueensBirthdayTest.php new file mode 100644 index 000000000..7802e766b --- /dev/null +++ b/tests/Australia/Tasmania/Northeast/QueensBirthdayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northeast; + +/** + * Class for testing Queen's Birthday in northeast Tasmania (Australia).. + */ +class QueensBirthdayTest extends \Yasumi\tests\Australia\Tasmania\QueensBirthdayTest +{ +} diff --git a/tests/Australia/Tasmania/Northeast/RecreationDayTest.php b/tests/Australia/Tasmania/Northeast/RecreationDayTest.php new file mode 100644 index 000000000..d52925b20 --- /dev/null +++ b/tests/Australia/Tasmania/Northeast/RecreationDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northeast; + +/** + * Class for testing Recreation Day in northeastern Tasmania (Australia).. + */ +class RecreationDayTest extends \Yasumi\tests\Australia\Tasmania\RecreationDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/AnzacDayTest.php b/tests/Australia/Tasmania/Northwest/AnzacDayTest.php new file mode 100644 index 000000000..afbafe71c --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest; + +/** + * Class for testing ANZAC day in northwestern Tasmania (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\Tasmania\AnzacDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/AustraliaDayTest.php b/tests/Australia/Tasmania/Northwest/AustraliaDayTest.php new file mode 100644 index 000000000..52bc61bae --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest; + +/** + * Class for testing Australia day in northwestern Tasmania (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\Tasmania\AustraliaDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/BoxingDayTest.php b/tests/Australia/Tasmania/Northwest/BoxingDayTest.php new file mode 100644 index 000000000..5f707f9cc --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest; + +/** + * Class for testing Boxing Day in northwestern Tasmania (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\Tasmania\BoxingDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/BurnieShowTest.php b/tests/Australia/Tasmania/Northwest/BurnieShowTest.php new file mode 100644 index 000000000..f620814d1 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/BurnieShowTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Burnie Show Day in northwestern Tasmania (Australia).. + */ +class BurnieShowTest extends NorthwestBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'burnieShow'; + + /** + * Tests Burnie Show 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-10-01'], + [2011, '2011-09-30'], + [2012, '2012-10-05'], + [2013, '2013-10-04'], + [2014, '2014-10-03'], + [2015, '2015-10-02'], + [2016, '2016-09-30'], + [2017, '2017-10-06'], + [2018, '2018-10-05'], + [2019, '2019-10-04'], + [2020, '2020-10-02'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Burnie Show'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Tasmania/Northwest/ChristmasDayTest.php b/tests/Australia/Tasmania/Northwest/ChristmasDayTest.php new file mode 100644 index 000000000..c540b93f4 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest; + +/** + * Class for testing Christmas Day in northwestern Tasmania (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\Tasmania\ChristmasDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/AGFESTTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/AGFESTTest.php new file mode 100644 index 000000000..95df6fefd --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/AGFESTTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing AGFEST in northwestern Tasmania (Australia).. + */ +class AGFESTTest extends CircularHeadBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'agfest'; + + /** + * Tests AGFEST + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-05-07'], + [2011, '2011-05-06'], + [2012, '2012-05-04'], + [2013, '2013-05-03'], + [2014, '2014-05-02'], + [2015, '2015-05-08'], + [2016, '2016-05-06'], + [2017, '2017-05-05'], + [2018, '2018-05-04'], + [2019, '2019-05-03'], + [2020, '2020-05-08'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'AGFEST'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/AnzacDayTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/AnzacDayTest.php new file mode 100644 index 000000000..fc18dc3ef --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +/** + * Class for testing ANZAC day in Circular Head (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\Tasmania\Northwest\AnzacDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/AustraliaDayTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/AustraliaDayTest.php new file mode 100644 index 000000000..cac6dafa2 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +/** + * Class for testing Australia day in Circular Head (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\Tasmania\Northwest\AustraliaDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/BoxingDayTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/BoxingDayTest.php new file mode 100644 index 000000000..a5cf2dee0 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +/** + * Class for testing Boxing Day in Circular Head (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\Tasmania\Northwest\BoxingDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/BurnieShowTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/BurnieShowTest.php new file mode 100644 index 000000000..25b23a024 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/BurnieShowTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +/** + * Class for testing Burnie Show Day in Circular Head (Australia).. + */ +class BurnieShowTest extends \Yasumi\tests\Australia\Tasmania\Northwest\BurnieShowTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/ChristmasDayTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/ChristmasDayTest.php new file mode 100644 index 000000000..ec8c65ce6 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +/** + * Class for testing Christmas Day in Circular Head (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\Tasmania\Northwest\ChristmasDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/CircularHeadBaseTestCase.php b/tests/Australia/Tasmania/Northwest/CircularHead/CircularHeadBaseTestCase.php new file mode 100644 index 000000000..08f395dc9 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/CircularHeadBaseTestCase.php @@ -0,0 +1,29 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +use Yasumi\tests\Australia\Tasmania\Northwest\NorthwestBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the northwestern Tasmania holiday provider. + */ +abstract class CircularHeadBaseTestCase extends NorthwestBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\Tasmania\Northwest\CircularHead'; +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/CircularHeadTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/CircularHeadTest.php new file mode 100644 index 000000000..add83b131 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/CircularHeadTest.php @@ -0,0 +1,57 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in Circular Head (Australia). + */ +class CircularHeadTest extends CircularHeadBaseTestCase +{ + + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in Circular Head (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'queensBirthday', + 'eightHourDay', + 'recreationDay', + 'burnieShow', + 'agfest', + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/EasterMondayTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/EasterMondayTest.php new file mode 100644 index 000000000..79c4d2d1a --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +/** + * Class for testing Easter Monday in Circular Head (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\Tasmania\Northwest\EasterMondayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/EightHourDayTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/EightHourDayTest.php new file mode 100644 index 000000000..66bb0c8ad --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/EightHourDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +/** + * Class for testing Eight Hour Day in Circular Head (Australia).. + */ +class EightHourDayTest extends \Yasumi\tests\Australia\Tasmania\Northwest\EightHourDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/GoodFridayTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/GoodFridayTest.php new file mode 100644 index 000000000..99436a4f5 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +/** + * Class for testing Good Friday in Circular Head (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\Tasmania\Northwest\GoodFridayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/NewYearsDayTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/NewYearsDayTest.php new file mode 100644 index 000000000..470d8b5b1 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +/** + * Class for testing New Years Day in Circular Head (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\Tasmania\Northwest\NewYearsDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/QueensBirthdayTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/QueensBirthdayTest.php new file mode 100644 index 000000000..5748fde16 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/QueensBirthdayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +/** + * Class for testing Queen's Birthday in Circular Head (Australia).. + */ +class QueensBirthdayTest extends \Yasumi\tests\Australia\Tasmania\Northwest\QueensBirthdayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/RecreationDayTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/RecreationDayTest.php new file mode 100644 index 000000000..d0e0d5ffb --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/CircularHead/RecreationDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest\CircularHead; + +/** + * Class for testing Recreation Day in Circular Head (Australia).. + */ +class RecreationDayTest extends \Yasumi\tests\Australia\Tasmania\Northwest\RecreationDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/EasterMondayTest.php b/tests/Australia/Tasmania/Northwest/EasterMondayTest.php new file mode 100644 index 000000000..627b8431d --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest; + +/** + * Class for testing Easter Monday in northwestern Tasmania (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\Tasmania\EasterMondayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/EightHourDayTest.php b/tests/Australia/Tasmania/Northwest/EightHourDayTest.php new file mode 100644 index 000000000..c7b21e5ee --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/EightHourDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest; + +/** + * Class for testing Eight Hour Day in northwestern Tasmania (Australia).. + */ +class EightHourDayTest extends \Yasumi\tests\Australia\Tasmania\EightHourDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/GoodFridayTest.php b/tests/Australia/Tasmania/Northwest/GoodFridayTest.php new file mode 100644 index 000000000..9689bf640 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest; + +/** + * Class for testing Good Friday in northwestern Tasmania (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\Tasmania\GoodFridayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/NewYearsDayTest.php b/tests/Australia/Tasmania/Northwest/NewYearsDayTest.php new file mode 100644 index 000000000..190dd45ad --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest; + +/** + * Class for testing New Years Day in northwestern Tasmania (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\Tasmania\NewYearsDayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/NorthwestBaseTestCase.php b/tests/Australia/Tasmania/Northwest/NorthwestBaseTestCase.php new file mode 100644 index 000000000..604b6f8f5 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/NorthwestBaseTestCase.php @@ -0,0 +1,29 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest; + +use Yasumi\tests\Australia\Tasmania\TasmaniaBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the northwestern Tasmania holiday provider. + */ +abstract class NorthwestBaseTestCase extends TasmaniaBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\Tasmania\Northwest'; +} diff --git a/tests/Australia/Tasmania/Northwest/NorthwestTest.php b/tests/Australia/Tasmania/Northwest/NorthwestTest.php new file mode 100644 index 000000000..65bcb955a --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/NorthwestTest.php @@ -0,0 +1,56 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in northwestern Tasmania (Australia). + */ +class NorthwestTest extends NorthwestBaseTestCase +{ + + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in northwestern Tasmania (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'queensBirthday', + 'eightHourDay', + 'recreationDay', + 'burnieShow' + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/Tasmania/Northwest/QueensBirthdayTest.php b/tests/Australia/Tasmania/Northwest/QueensBirthdayTest.php new file mode 100644 index 000000000..7cf5ba4e1 --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/QueensBirthdayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest; + +/** + * Class for testing Queen's Birthday in northwest Tasmania (Australia).. + */ +class QueensBirthdayTest extends \Yasumi\tests\Australia\Tasmania\QueensBirthdayTest +{ +} diff --git a/tests/Australia/Tasmania/Northwest/RecreationDayTest.php b/tests/Australia/Tasmania/Northwest/RecreationDayTest.php new file mode 100644 index 000000000..19ea420ba --- /dev/null +++ b/tests/Australia/Tasmania/Northwest/RecreationDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\Northwest; + +/** + * Class for testing Recreation Day in northwestern Tasmania (Australia).. + */ +class RecreationDayTest extends \Yasumi\tests\Australia\Tasmania\RecreationDayTest +{ +} diff --git a/tests/Australia/Tasmania/QueensBirthdayTest.php b/tests/Australia/Tasmania/QueensBirthdayTest.php new file mode 100644 index 000000000..ce5d70ba1 --- /dev/null +++ b/tests/Australia/Tasmania/QueensBirthdayTest.php @@ -0,0 +1,107 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Queen's Birthday in Tasmania (Australia).. + */ +class QueensBirthdayTest extends TasmaniaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'queensBirthday'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 1950; + + /** + * Tests Queen's Birthday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-06-14'], + [2011, '2011-06-13'], + [2012, '2012-06-11'], + [2013, '2013-06-10'], + [2014, '2014-06-09'], + [2015, '2015-06-08'], + [2016, '2016-06-13'], + [2017, '2017-06-12'], + [2018, '2018-06-11'], + [2019, '2019-06-10'], + [2020, '2020-06-08'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Queen\'s Birthday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Australia/Tasmania/RecreationDayTest.php b/tests/Australia/Tasmania/RecreationDayTest.php new file mode 100644 index 000000000..12ca81c54 --- /dev/null +++ b/tests/Australia/Tasmania/RecreationDayTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Recreation Day in Tasmania (Australia).. + */ +class RecreationDayTest extends TasmaniaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'recreationDay'; + + /** + * Tests Recreation 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-11-01'], + [2011, '2011-11-07'], + [2012, '2012-11-05'], + [2013, '2013-11-04'], + [2014, '2014-11-03'], + [2015, '2015-11-02'], + [2016, '2016-11-07'], + [2017, '2017-11-06'], + [2018, '2018-11-05'], + [2019, '2019-11-04'], + [2020, '2020-11-02'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Recreation Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Tasmania/South/AnzacDayTest.php b/tests/Australia/Tasmania/South/AnzacDayTest.php new file mode 100644 index 000000000..1eae5ad8e --- /dev/null +++ b/tests/Australia/Tasmania/South/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South; + +/** + * Class for testing ANZAC day in southern Tasmania (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\Tasmania\AnzacDayTest +{ +} diff --git a/tests/Australia/Tasmania/South/AustraliaDayTest.php b/tests/Australia/Tasmania/South/AustraliaDayTest.php new file mode 100644 index 000000000..b1c646d10 --- /dev/null +++ b/tests/Australia/Tasmania/South/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South; + +/** + * Class for testing Australia day in southern Tasmania (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\Tasmania\AustraliaDayTest +{ +} diff --git a/tests/Australia/Tasmania/South/BoxingDayTest.php b/tests/Australia/Tasmania/South/BoxingDayTest.php new file mode 100644 index 000000000..865f22c6d --- /dev/null +++ b/tests/Australia/Tasmania/South/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South; + +/** + * Class for testing Boxing Day in soutehrn Tasmania (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\Tasmania\BoxingDayTest +{ +} diff --git a/tests/Australia/Tasmania/South/ChristmasDayTest.php b/tests/Australia/Tasmania/South/ChristmasDayTest.php new file mode 100644 index 000000000..877f4ceb3 --- /dev/null +++ b/tests/Australia/Tasmania/South/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South; + +/** + * Class for testing Christmas Day in southern Tasmania (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\Tasmania\ChristmasDayTest +{ +} diff --git a/tests/Australia/Tasmania/South/EasterMondayTest.php b/tests/Australia/Tasmania/South/EasterMondayTest.php new file mode 100644 index 000000000..e81977465 --- /dev/null +++ b/tests/Australia/Tasmania/South/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South; + +/** + * Class for testing Easter Monday in southern Tasmania (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\Tasmania\EasterMondayTest +{ +} diff --git a/tests/Australia/Tasmania/South/EightHourDayTest.php b/tests/Australia/Tasmania/South/EightHourDayTest.php new file mode 100644 index 000000000..b0baa1360 --- /dev/null +++ b/tests/Australia/Tasmania/South/EightHourDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South; + +/** + * Class for testing Eight Hour Day in southern Tasmania (Australia).. + */ +class EightHourDayTest extends \Yasumi\tests\Australia\Tasmania\EightHourDayTest +{ +} diff --git a/tests/Australia/Tasmania/South/GoodFridayTest.php b/tests/Australia/Tasmania/South/GoodFridayTest.php new file mode 100644 index 000000000..5ca71f528 --- /dev/null +++ b/tests/Australia/Tasmania/South/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South; + +/** + * Class for testing Good Friday in southern Tasmania (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\Tasmania\GoodFridayTest +{ +} diff --git a/tests/Australia/Tasmania/South/HobartShowTest.php b/tests/Australia/Tasmania/South/HobartShowTest.php new file mode 100644 index 000000000..516f6c300 --- /dev/null +++ b/tests/Australia/Tasmania/South/HobartShowTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Royal Hobart Show Day in southern Tasmania (Australia).. + */ +class HobartShowTest extends SouthBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'hobartShow'; + + /** + * Tests Royal Hobart Show 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-10-21'], + [2011, '2011-10-20'], + [2012, '2012-10-25'], + [2013, '2013-10-24'], + [2014, '2014-10-23'], + [2015, '2015-10-22'], + [2016, '2016-10-20'], + [2017, '2017-10-26'], + [2018, '2018-10-25'], + [2019, '2019-10-24'], + [2020, '2020-10-22'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Royal Hobart Show'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Tasmania/South/NewYearsDayTest.php b/tests/Australia/Tasmania/South/NewYearsDayTest.php new file mode 100644 index 000000000..99c06ad4f --- /dev/null +++ b/tests/Australia/Tasmania/South/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South; + +/** + * Class for testing New Years Day in soutehrn Tasmania (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\Tasmania\NewYearsDayTest +{ +} diff --git a/tests/Australia/Tasmania/South/QueensBirthdayTest.php b/tests/Australia/Tasmania/South/QueensBirthdayTest.php new file mode 100644 index 000000000..5c40f5b25 --- /dev/null +++ b/tests/Australia/Tasmania/South/QueensBirthdayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South; + +/** + * Class for testing Queen's Birthday in southe0rn Tasmania (Australia).. + */ +class QueensBirthdayTest extends \Yasumi\tests\Australia\Tasmania\QueensBirthdayTest +{ +} diff --git a/tests/Australia/Tasmania/South/RecreationDayTest.php b/tests/Australia/Tasmania/South/RecreationDayTest.php new file mode 100644 index 000000000..6aa6affee --- /dev/null +++ b/tests/Australia/Tasmania/South/RecreationDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South; + +/** + * Class for testing Recreation Day in southern Tasmania (Australia).. + */ +class RecreationDayTest extends \Yasumi\tests\Australia\Tasmania\RecreationDayTest +{ +} diff --git a/tests/Australia/Tasmania/South/SouthBaseTestCase.php b/tests/Australia/Tasmania/South/SouthBaseTestCase.php new file mode 100644 index 000000000..8a0510677 --- /dev/null +++ b/tests/Australia/Tasmania/South/SouthBaseTestCase.php @@ -0,0 +1,29 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South; + +use Yasumi\tests\Australia\Tasmania\TasmaniaBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the northwestern Tasmania holiday provider. + */ +abstract class SouthBaseTestCase extends TasmaniaBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\Tasmania\South'; +} diff --git a/tests/Australia/Tasmania/South/SouthTest.php b/tests/Australia/Tasmania/South/SouthTest.php new file mode 100644 index 000000000..6d83ed001 --- /dev/null +++ b/tests/Australia/Tasmania/South/SouthTest.php @@ -0,0 +1,56 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in southern Tasmania (Australia). + */ +class SouthTest extends SouthBaseTestCase +{ + + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in northwestern Tasmania (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'queensBirthday', + 'eightHourDay', + 'recreationDay', + 'hobartShow' + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/Tasmania/South/Southeast/AnzacDayTest.php b/tests/Australia/Tasmania/South/Southeast/AnzacDayTest.php new file mode 100644 index 000000000..c39d68b6b --- /dev/null +++ b/tests/Australia/Tasmania/South/Southeast/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South\Southeast; + +/** + * Class for testing ANZAC day in southeastern Tasmania (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\Tasmania\South\AnzacDayTest +{ +} diff --git a/tests/Australia/Tasmania/South/Southeast/AustraliaDayTest.php b/tests/Australia/Tasmania/South/Southeast/AustraliaDayTest.php new file mode 100644 index 000000000..4aa64f9ea --- /dev/null +++ b/tests/Australia/Tasmania/South/Southeast/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South\Southeast; + +/** + * Class for testing Australia day in southeastern Tasmania (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\Tasmania\South\AustraliaDayTest +{ +} diff --git a/tests/Australia/Tasmania/South/Southeast/BoxingDayTest.php b/tests/Australia/Tasmania/South/Southeast/BoxingDayTest.php new file mode 100644 index 000000000..2d1a9a759 --- /dev/null +++ b/tests/Australia/Tasmania/South/Southeast/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South\Southeast; + +/** + * Class for testing Boxing Day in southeastern Tasmania (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\Tasmania\South\BoxingDayTest +{ +} diff --git a/tests/Australia/Tasmania/South/Southeast/ChristmasDayTest.php b/tests/Australia/Tasmania/South/Southeast/ChristmasDayTest.php new file mode 100644 index 000000000..44686a5fe --- /dev/null +++ b/tests/Australia/Tasmania/South/Southeast/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South\Southeast; + +/** + * Class for testing Christmas Day in southeastern Tasmania (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\Tasmania\South\ChristmasDayTest +{ +} diff --git a/tests/Australia/Tasmania/South/Southeast/EasterMondayTest.php b/tests/Australia/Tasmania/South/Southeast/EasterMondayTest.php new file mode 100644 index 000000000..e29293fa1 --- /dev/null +++ b/tests/Australia/Tasmania/South/Southeast/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South\Southeast; + +/** + * Class for testing Easter Monday in southeastern Tasmania (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\Tasmania\South\EasterMondayTest +{ +} diff --git a/tests/Australia/Tasmania/South/Southeast/EightHourDayTest.php b/tests/Australia/Tasmania/South/Southeast/EightHourDayTest.php new file mode 100644 index 000000000..e9aabad70 --- /dev/null +++ b/tests/Australia/Tasmania/South/Southeast/EightHourDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South\Southeast; + +/** + * Class for testing Eight Hour Day in southeastern Tasmania (Australia).. + */ +class EightHourDayTest extends \Yasumi\tests\Australia\Tasmania\South\EightHourDayTest +{ +} diff --git a/tests/Australia/Tasmania/South/Southeast/GoodFridayTest.php b/tests/Australia/Tasmania/South/Southeast/GoodFridayTest.php new file mode 100644 index 000000000..6ea1e9235 --- /dev/null +++ b/tests/Australia/Tasmania/South/Southeast/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South\Southeast; + +/** + * Class for testing Good Friday in southeastern Tasmania (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\Tasmania\South\GoodFridayTest +{ +} diff --git a/tests/Australia/Tasmania/South/Southeast/HobartRegattaTest.php b/tests/Australia/Tasmania/South/Southeast/HobartRegattaTest.php new file mode 100644 index 000000000..e8d689368 --- /dev/null +++ b/tests/Australia/Tasmania/South/Southeast/HobartRegattaTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South\Southeast; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Burnie Show Day in northwestern Tasmania (Australia).. + */ +class HobartRegattaTest extends SoutheastBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'hobartRegatta'; + + /** + * Tests Royal Hobart Regatta + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-02-08'], + [2011, '2011-02-14'], + [2012, '2012-02-13'], + [2013, '2013-02-11'], + [2014, '2014-02-10'], + [2015, '2015-02-09'], + [2016, '2016-02-08'], + [2017, '2017-02-13'], + [2018, '2018-02-12'], + [2019, '2019-02-11'], + [2020, '2020-02-10'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Royal Hobart Regatta'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Tasmania/South/Southeast/HobartShowTest.php b/tests/Australia/Tasmania/South/Southeast/HobartShowTest.php new file mode 100644 index 000000000..cf4a2627c --- /dev/null +++ b/tests/Australia/Tasmania/South/Southeast/HobartShowTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South\Southeast; + +/** + * Class for testing Hobart Show Day in southeastern Tasmania (Australia).. + */ +class HobartShowTest extends \Yasumi\tests\Australia\Tasmania\South\HobartShowTest +{ +} diff --git a/tests/Australia/Tasmania/South/Southeast/NewYearsDayTest.php b/tests/Australia/Tasmania/South/Southeast/NewYearsDayTest.php new file mode 100644 index 000000000..d5f1892b5 --- /dev/null +++ b/tests/Australia/Tasmania/South/Southeast/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South\Southeast; + +/** + * Class for testing New Years Day in southeastern Tasmania (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\Tasmania\South\NewYearsDayTest +{ +} diff --git a/tests/Australia/Tasmania/South/Southeast/QueensBirthdayTest.php b/tests/Australia/Tasmania/South/Southeast/QueensBirthdayTest.php new file mode 100644 index 000000000..9adad28f0 --- /dev/null +++ b/tests/Australia/Tasmania/South/Southeast/QueensBirthdayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South\Southeast; + +/** + * Class for testing Queen's Birthday in southeastern Tasmania (Australia).. + */ +class QueensBirthdayTest extends \Yasumi\tests\Australia\Tasmania\South\QueensBirthdayTest +{ +} diff --git a/tests/Australia/Tasmania/South/Southeast/SoutheastBaseTestCase.php b/tests/Australia/Tasmania/South/Southeast/SoutheastBaseTestCase.php new file mode 100644 index 000000000..6cb9fa56a --- /dev/null +++ b/tests/Australia/Tasmania/South/Southeast/SoutheastBaseTestCase.php @@ -0,0 +1,34 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South\Southeast; + +use Yasumi\tests\Australia\Tasmania\South\SouthBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the northwestern Tasmania holiday provider. + */ +abstract class SoutheastBaseTestCase extends SouthBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\Tasmania\South\Southeast'; + + /** + * Timezone in which this provider has holidays defined + */ + public $timezone = 'Australia/Hobart'; +} diff --git a/tests/Australia/Tasmania/South/Southeast/SoutheastTest.php b/tests/Australia/Tasmania/South/Southeast/SoutheastTest.php new file mode 100644 index 000000000..d4bff35ab --- /dev/null +++ b/tests/Australia/Tasmania/South/Southeast/SoutheastTest.php @@ -0,0 +1,56 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania\South\Southeast; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in southeastern Tasmania (Australia). + */ +class SoutheastTest extends SoutheastBaseTestCase +{ + + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in Circular Head (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'queensBirthday', + 'eightHourDay', + 'hobartShow', + 'hobartRegatta', + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/Tasmania/TasmaniaBaseTestCase.php b/tests/Australia/Tasmania/TasmaniaBaseTestCase.php new file mode 100644 index 000000000..42628ec02 --- /dev/null +++ b/tests/Australia/Tasmania/TasmaniaBaseTestCase.php @@ -0,0 +1,34 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania; + +use Yasumi\tests\Australia\AustraliaBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the Victoria holiday provider. + */ +abstract class TasmaniaBaseTestCase extends AustraliaBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\Tasmania'; + + /** + * Timezone in which this provider has holidays defined + */ + public $timezone = 'Australia/Tasmania'; +} diff --git a/tests/Australia/Tasmania/TasmaniaTest.php b/tests/Australia/Tasmania/TasmaniaTest.php new file mode 100644 index 000000000..bb977385f --- /dev/null +++ b/tests/Australia/Tasmania/TasmaniaTest.php @@ -0,0 +1,54 @@ + + */ + +namespace Yasumi\tests\Australia\Tasmania; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in Tasmania (Australia). + */ +class TasmaniaTest extends TasmaniaBaseTestCase +{ + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in Tasmania (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'queensBirthday', + 'eightHourDay', + 'recreationDay', + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/Victoria/AFLGrandFinalFridayTest.php b/tests/Australia/Victoria/AFLGrandFinalFridayTest.php index 5ef8f1b30..07c9a6ef1 100644 --- a/tests/Australia/Victoria/AFLGrandFinalFridayTest.php +++ b/tests/Australia/Victoria/AFLGrandFinalFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia\Victoria; @@ -25,10 +25,10 @@ class AFLGrandFinalFridayTest extends VictoriaBaseTestCase implements YasumiTest /** * The name of the holiday */ - const HOLIDAY = 'aflGrandFinalFriday'; + public const HOLIDAY = 'aflGrandFinalFriday'; - const ESTABLISHMENT_YEAR = 2015; - const LAST_KNOWN_YEAR = 2016; + public const ESTABLISHMENT_YEAR = 2015; + public const LAST_KNOWN_YEAR = 2018; /** * Tests AFL Grand Final Friday @@ -37,6 +37,9 @@ class AFLGrandFinalFridayTest extends VictoriaBaseTestCase implements YasumiTest * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -51,8 +54,9 @@ public function testHoliday($year, $expected) /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( $this->region, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( $this->region, @@ -77,6 +82,7 @@ public function testHolidayType() /** * Tests that Holiday is not present before establishment year + * @throws \ReflectionException */ public function testNotHoliday() { @@ -88,11 +94,13 @@ public function testNotHoliday() * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = [ [2015, '2015-10-02'], [2016, '2016-09-30'], + [2017, '2017-09-29'], + [2018, '2018-09-28'], ]; return $data; diff --git a/tests/Australia/Victoria/AnzacDayTest.php b/tests/Australia/Victoria/AnzacDayTest.php index 6d3f5e1ec..f71aee4e7 100644 --- a/tests/Australia/Victoria/AnzacDayTest.php +++ b/tests/Australia/Victoria/AnzacDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia\Victoria; diff --git a/tests/Australia/Victoria/AustraliaDayTest.php b/tests/Australia/Victoria/AustraliaDayTest.php index dbd47c196..7f9f169b1 100644 --- a/tests/Australia/Victoria/AustraliaDayTest.php +++ b/tests/Australia/Victoria/AustraliaDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia\Victoria; diff --git a/tests/Australia/Victoria/BoxingDayTest.php b/tests/Australia/Victoria/BoxingDayTest.php index 94f4af34f..7b3a2ea1f 100644 --- a/tests/Australia/Victoria/BoxingDayTest.php +++ b/tests/Australia/Victoria/BoxingDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia\Victoria; diff --git a/tests/Australia/Victoria/ChristmasDayTest.php b/tests/Australia/Victoria/ChristmasDayTest.php index 3e8c38a09..2f6dd4ac0 100644 --- a/tests/Australia/Victoria/ChristmasDayTest.php +++ b/tests/Australia/Victoria/ChristmasDayTest.php @@ -2,18 +2,18 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia\Victoria; /** - * Class for testing Christmas Day in the Victoria (Australia).. + * Class for testing Christmas Day in Victoria (Australia).. */ class ChristmasDayTest extends \Yasumi\tests\Australia\ChristmasDayTest { diff --git a/tests/Australia/Victoria/EasterMondayTest.php b/tests/Australia/Victoria/EasterMondayTest.php index c5f278e4f..35cf5ac09 100644 --- a/tests/Australia/Victoria/EasterMondayTest.php +++ b/tests/Australia/Victoria/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia\Victoria; diff --git a/tests/Australia/Victoria/EasterSaturdayTest.php b/tests/Australia/Victoria/EasterSaturdayTest.php new file mode 100644 index 000000000..a7e53fd63 --- /dev/null +++ b/tests/Australia/Victoria/EasterSaturdayTest.php @@ -0,0 +1,95 @@ + + */ + +namespace Yasumi\tests\Australia\Victoria; + +use DateInterval; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Easter Saturday in Victoria (Australia).. + */ +class EasterSaturdayTest extends VictoriaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'easterSaturday'; + + /** + * Tests Easter Saturday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + $data = []; + + for ($y = 0; $y < 50; $y++) { + $year = $this->generateRandomYear(); + $date = $this->calculateEaster($year, $this->timezone); + $date->sub(new DateInterval('P1D')); + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Easter Saturday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Victoria/EasterSundayTest.php b/tests/Australia/Victoria/EasterSundayTest.php new file mode 100644 index 000000000..370b718d8 --- /dev/null +++ b/tests/Australia/Victoria/EasterSundayTest.php @@ -0,0 +1,93 @@ + + */ + +namespace Yasumi\tests\Australia\Victoria; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Easter Sunday in Victoria (Australia).. + */ +class EasterSundayTest extends VictoriaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'easter'; + + /** + * Tests Easter Sunday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + $data = []; + + for ($y = 0; $y < 50; $y++) { + $year = $this->generateRandomYear(); + $date = $this->calculateEaster($year, $this->timezone); + + $data[] = [$year, $date->format('Y-m-d')]; + } + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Easter Sunday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/Victoria/GoodFridayTest.php b/tests/Australia/Victoria/GoodFridayTest.php index 07d02749d..b16efaa80 100644 --- a/tests/Australia/Victoria/GoodFridayTest.php +++ b/tests/Australia/Victoria/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia\Victoria; diff --git a/tests/Australia/Victoria/LabourDayTest.php b/tests/Australia/Victoria/LabourDayTest.php index 443a13cb0..55332201c 100644 --- a/tests/Australia/Victoria/LabourDayTest.php +++ b/tests/Australia/Victoria/LabourDayTest.php @@ -2,33 +2,58 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia\Victoria; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + /** * Class for testing Labour Day in Victoria (Australia).. */ -class LabourDayTest extends \Yasumi\tests\Australia\LabourDayTest +class LabourDayTest extends VictoriaBaseTestCase implements YasumiTestCaseInterface { - public $region = 'Australia\Victoria'; - - public $timezone = 'Australia/Melbourne'; + /** + * The name of the holiday + */ + public const HOLIDAY = 'labourDay'; - protected $dateFormat = 'second Monday of March'; + /** + * 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } /** * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = [ [2010, '2010-03-08'], @@ -44,7 +69,29 @@ public function HolidayDataProvider() [2020, '2020-03-09'], ]; - return $data; } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Labour Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } } diff --git a/tests/Australia/Victoria/MelbourneCupDayTest.php b/tests/Australia/Victoria/MelbourneCupDayTest.php new file mode 100644 index 000000000..2d6b914c7 --- /dev/null +++ b/tests/Australia/Victoria/MelbourneCupDayTest.php @@ -0,0 +1,107 @@ + + */ + +namespace Yasumi\tests\Australia\Victoria; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Melbourne cup Day in Victoria (Australia).. + */ +class MelbourneCupDayTest extends VictoriaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'melbourneCup'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 1877; + + /** + * Tests Melbourne Cup 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-11-02'], + [2011, '2011-11-01'], + [2012, '2012-11-06'], + [2013, '2013-11-05'], + [2014, '2014-11-04'], + [2015, '2015-11-03'], + [2016, '2016-11-01'], + [2017, '2017-11-07'], + [2018, '2018-11-06'], + [2019, '2019-11-05'], + [2020, '2020-11-03'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Melbourne Cup'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Australia/Victoria/NewYearsDayTest.php b/tests/Australia/Victoria/NewYearsDayTest.php index 9da3bc418..2132010f0 100644 --- a/tests/Australia/Victoria/NewYearsDayTest.php +++ b/tests/Australia/Victoria/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia\Victoria; diff --git a/tests/Australia/Victoria/QueensBirthdayTest.php b/tests/Australia/Victoria/QueensBirthdayTest.php index 39fe62d18..b7ce7cc56 100644 --- a/tests/Australia/Victoria/QueensBirthdayTest.php +++ b/tests/Australia/Victoria/QueensBirthdayTest.php @@ -2,22 +2,106 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia\Victoria; +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + /** - * Class for testing Queens Birthday in Victoria (Australia).. + * Class for testing Queen's Birthday in Victoria (Australia).. */ -class QueensBirthdayTest extends \Yasumi\tests\Australia\QueensBirthdayTest +class QueensBirthdayTest extends VictoriaBaseTestCase implements YasumiTestCaseInterface { - public $region = 'Australia\Victoria'; + /** + * The name of the holiday + */ + public const HOLIDAY = 'queensBirthday'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 1950; + + /** + * Tests Queen's Birthday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-06-14'], + [2011, '2011-06-13'], + [2012, '2012-06-11'], + [2013, '2013-06-10'], + [2014, '2014-06-09'], + [2015, '2015-06-08'], + [2016, '2016-06-13'], + [2017, '2017-06-12'], + [2018, '2018-06-11'], + [2019, '2019-06-10'], + [2020, '2020-06-08'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Queen\'s Birthday'] + ); + } - protected $dateFormat = 'second monday of june'; + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + Holiday::TYPE_OFFICIAL + ); + } } diff --git a/tests/Australia/Victoria/VictoriaBaseTestCase.php b/tests/Australia/Victoria/VictoriaBaseTestCase.php index 666b40d94..1a19decf4 100644 --- a/tests/Australia/Victoria/VictoriaBaseTestCase.php +++ b/tests/Australia/Victoria/VictoriaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia\Victoria; @@ -30,5 +30,5 @@ abstract class VictoriaBaseTestCase extends AustraliaBaseTestCase /** * Timezone in which this provider has holidays defined */ - public $timezone = 'Australia/Melbourne'; + public $timezone = 'Australia/Victoria'; } diff --git a/tests/Australia/Victoria/VictoriaTest.php b/tests/Australia/Victoria/VictoriaTest.php index 7cf9ccc10..d9713f62d 100644 --- a/tests/Australia/Victoria/VictoriaTest.php +++ b/tests/Australia/Victoria/VictoriaTest.php @@ -2,25 +2,23 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Australia\Victoria; use Yasumi\Holiday; -use Yasumi\tests\Australia\AustraliaTest; /** * Class for testing holidays in Victoria (Australia). */ -class VictoriaTest extends AustraliaTest +class VictoriaTest extends VictoriaBaseTestCase { - public $region = 'Australia\Victoria'; /** * @var int year random year number used for all tests in this Test Case @@ -29,8 +27,9 @@ class VictoriaTest extends AustraliaTest /** * Tests if all official holidays in Victoria (Australia) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -40,9 +39,12 @@ public function testOfficialHolidays() 'secondChristmasDay', 'australiaDay', 'anzacDay', + 'easter', + 'easterSaturday', 'queensBirthday', 'labourDay', - 'aflGrandFinalFriday' + 'aflGrandFinalFriday', + 'melbourneCup' ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); } @@ -51,6 +53,6 @@ public function testOfficialHolidays() */ protected function setUp() { - $this->year = $this->generateRandomYear(2015, 2016); + $this->year = $this->generateRandomYear(2015, 2018); } } diff --git a/tests/Australia/WA/AnzacDayTest.php b/tests/Australia/WA/AnzacDayTest.php new file mode 100644 index 000000000..8399a86b7 --- /dev/null +++ b/tests/Australia/WA/AnzacDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\WA; + +/** + * Class for testing ANZAC day in WA (Australia).. + */ +class AnzacDayTest extends \Yasumi\tests\Australia\AnzacDayTest +{ +} diff --git a/tests/Australia/WA/AustraliaDayTest.php b/tests/Australia/WA/AustraliaDayTest.php new file mode 100644 index 000000000..6848d4740 --- /dev/null +++ b/tests/Australia/WA/AustraliaDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\WA; + +/** + * Class for testing Australia day in WA (Australia).. + */ +class AustraliaDayTest extends \Yasumi\tests\Australia\AustraliaDayTest +{ +} diff --git a/tests/Australia/WA/BoxingDayTest.php b/tests/Australia/WA/BoxingDayTest.php new file mode 100644 index 000000000..bba0bffdf --- /dev/null +++ b/tests/Australia/WA/BoxingDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\WA; + +/** + * Class for testing Boxing Day in WA (Australia).. + */ +class BoxingDayTest extends \Yasumi\tests\Australia\BoxingDayTest +{ +} diff --git a/tests/Australia/WA/ChristmasDayTest.php b/tests/Australia/WA/ChristmasDayTest.php new file mode 100644 index 000000000..ccc9ce74e --- /dev/null +++ b/tests/Australia/WA/ChristmasDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\WA; + +/** + * Class for testing Christmas Day in WA (Australia).. + */ +class ChristmasDayTest extends \Yasumi\tests\Australia\ChristmasDayTest +{ +} diff --git a/tests/Australia/WA/EasterMondayTest.php b/tests/Australia/WA/EasterMondayTest.php new file mode 100644 index 000000000..fc3dc7555 --- /dev/null +++ b/tests/Australia/WA/EasterMondayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\WA; + +/** + * Class for testing Easter Monday in WA (Australia).. + */ +class EasterMondayTest extends \Yasumi\tests\Australia\EasterMondayTest +{ +} diff --git a/tests/Australia/WA/GoodFridayTest.php b/tests/Australia/WA/GoodFridayTest.php new file mode 100644 index 000000000..507410ca6 --- /dev/null +++ b/tests/Australia/WA/GoodFridayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\WA; + +/** + * Class for testing Good Friday in WA (Australia).. + */ +class GoodFridayTest extends \Yasumi\tests\Australia\GoodFridayTest +{ +} diff --git a/tests/Australia/WA/LabourDayTest.php b/tests/Australia/WA/LabourDayTest.php new file mode 100644 index 000000000..fad438794 --- /dev/null +++ b/tests/Australia/WA/LabourDayTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\WA; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Labour Day in WA (Australia).. + */ +class LabourDayTest extends WABaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-03-01'], + [2011, '2011-03-07'], + [2012, '2012-03-05'], + [2013, '2013-03-04'], + [2014, '2014-03-03'], + [2015, '2015-03-02'], + [2016, '2016-03-07'], + [2017, '2017-03-06'], + [2018, '2018-03-05'], + [2019, '2019-03-04'], + [2020, '2020-03-02'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Labour Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Australia/WA/NewYearsDayTest.php b/tests/Australia/WA/NewYearsDayTest.php new file mode 100644 index 000000000..f6a3c225f --- /dev/null +++ b/tests/Australia/WA/NewYearsDayTest.php @@ -0,0 +1,20 @@ + + */ + +namespace Yasumi\tests\Australia\WA; + +/** + * Class for testing New Years Day in WA (Australia).. + */ +class NewYearsDayTest extends \Yasumi\tests\Australia\NewYearsDayTest +{ +} diff --git a/tests/Australia/WA/QueensBirthdayTest.php b/tests/Australia/WA/QueensBirthdayTest.php new file mode 100644 index 000000000..ca4bdab20 --- /dev/null +++ b/tests/Australia/WA/QueensBirthdayTest.php @@ -0,0 +1,107 @@ + + */ + +namespace Yasumi\tests\Australia\WA; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Queen's Birthday in WA (Australia).. + */ +class QueensBirthdayTest extends WABaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'queensBirthday'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 1950; + + /** + * Tests Queen's Birthday + * + * @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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-09-27'], + [2011, '2011-10-28'], + [2012, '2012-10-01'], + [2013, '2013-09-30'], + [2014, '2014-09-29'], + [2015, '2015-09-28'], + [2016, '2016-09-26'], + [2017, '2017-09-25'], + [2018, '2018-09-24'], + [2019, '2019-09-30'], + [2020, '2020-09-28'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Queen\'s Birthday'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Australia/WA/WABaseTestCase.php b/tests/Australia/WA/WABaseTestCase.php new file mode 100644 index 000000000..88deff40b --- /dev/null +++ b/tests/Australia/WA/WABaseTestCase.php @@ -0,0 +1,34 @@ + + */ + +namespace Yasumi\tests\Australia\WA; + +use Yasumi\tests\Australia\AustraliaBaseTestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the Queensland holiday provider. + */ +abstract class WABaseTestCase extends AustraliaBaseTestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + public $region = 'Australia\WA'; + + /** + * Timezone in which this provider has holidays defined + */ + public $timezone = 'Australia/West'; +} diff --git a/tests/Australia/WA/WATest.php b/tests/Australia/WA/WATest.php new file mode 100644 index 000000000..bb55af236 --- /dev/null +++ b/tests/Australia/WA/WATest.php @@ -0,0 +1,55 @@ + + */ + +namespace Yasumi\tests\Australia\WA; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in WA (Australia). + */ +class WATest extends WABaseTestCase +{ + + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in WA (Australia) are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'christmasDay', + 'secondChristmasDay', + 'australiaDay', + 'anzacDay', + 'queensBirthday', + 'labourDay', + 'westernAustraliaDay', + ], $this->region, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1921); + } +} diff --git a/tests/Australia/WA/WesternAustraliaDayTest.php b/tests/Australia/WA/WesternAustraliaDayTest.php new file mode 100644 index 000000000..8c1148dbf --- /dev/null +++ b/tests/Australia/WA/WesternAustraliaDayTest.php @@ -0,0 +1,97 @@ + + */ + +namespace Yasumi\tests\Australia\WA; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Western Australia Day in WA (Australia).. + */ +class WesternAustraliaDayTest extends WABaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'westernAustraliaDay'; + + /** + * Tests Western Australia 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 + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday( + $this->region, + self::HOLIDAY, + $year, + new DateTime($expected, new DateTimeZone($this->timezone)) + ); + } + + /** + * Returns a list of test dates + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider(): array + { + $data = [ + [2010, '2010-06-07'], + [2011, '2011-06-06'], + [2012, '2012-06-04'], + [2013, '2013-06-03'], + [2014, '2014-06-02'], + [2015, '2015-06-01'], + [2016, '2016-06-06'], + [2017, '2017-06-05'], + [2018, '2018-06-04'], + [2019, '2019-06-03'], + [2020, '2020-06-01'], + ]; + + return $data; + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + $this->region, + self::HOLIDAY, + $this->generateRandomYear(1990), + [self::LOCALE => 'Western Australia Day'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Austria/AllSaintsDayTest.php b/tests/Austria/AllSaintsDayTest.php index 6794f02c8..764da59b5 100644 --- a/tests/Austria/AllSaintsDayTest.php +++ b/tests/Austria/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends AustriaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends AustriaBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Austria/AscensionDayTest.php b/tests/Austria/AscensionDayTest.php index fdaee3482..35368a152 100644 --- a/tests/Austria/AscensionDayTest.php +++ b/tests/Austria/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -25,10 +25,12 @@ class AscensionDayTest extends AustriaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Austria/AssumptionOfMaryTest.php b/tests/Austria/AssumptionOfMaryTest.php index cb21affb7..f194d72dc 100644 --- a/tests/Austria/AssumptionOfMaryTest.php +++ b/tests/Austria/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends AustriaBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends AustriaBaseTestCase implements YasumiTestCase * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Austria/AustriaBaseTestCase.php b/tests/Austria/AustriaBaseTestCase.php index 100624594..daa68b8f9 100644 --- a/tests/Austria/AustriaBaseTestCase.php +++ b/tests/Austria/AustriaBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Austria holiday provider. */ -abstract class AustriaBaseTestCase extends PHPUnit_Framework_TestCase +abstract class AustriaBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Austria'; + public const REGION = 'Austria'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Vienna'; + public const TIMEZONE = 'Europe/Vienna'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_AT'; + public const LOCALE = 'de_AT'; } diff --git a/tests/Austria/AustriaTest.php b/tests/Austria/AustriaTest.php index b53e3bdbc..64cc5dda0 100644 --- a/tests/Austria/AustriaTest.php +++ b/tests/Austria/AustriaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -26,8 +26,9 @@ class AustriaTest extends AustriaBaseTestCase /** * Tests if all official holidays in Austria are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'ascensionDay', @@ -48,32 +49,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Austria are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays(['pentecost'], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Austria are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Austria are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Austria are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Austria/ChristmasTest.php b/tests/Austria/ChristmasTest.php index 8ac8dc38f..1a1b3e0ed 100644 --- a/tests/Austria/ChristmasTest.php +++ b/tests/Austria/ChristmasTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -24,7 +24,7 @@ class ChristmasTest extends AustriaBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ChristmasTest extends AustriaBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Austria/CorpusChristiTest.php b/tests/Austria/CorpusChristiTest.php index 6597e7d63..a82338d25 100644 --- a/tests/Austria/CorpusChristiTest.php +++ b/tests/Austria/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -27,10 +27,13 @@ class CorpusChristiTest extends AustriaBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests the holiday defined in this test. + * + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -45,8 +48,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Austria/EasterMondayTest.php b/tests/Austria/EasterMondayTest.php index 2fa22ec1f..659bc9180 100644 --- a/tests/Austria/EasterMondayTest.php +++ b/tests/Austria/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -25,10 +25,12 @@ class EasterMondayTest extends AustriaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Austria/EasterTest.php b/tests/Austria/EasterTest.php index 5c10252ba..e0cd2b9ff 100644 --- a/tests/Austria/EasterTest.php +++ b/tests/Austria/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -25,10 +25,12 @@ class EasterTest extends AustriaBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Austria/EpiphanyTest.php b/tests/Austria/EpiphanyTest.php index f2a195949..6c9de7bd4 100644 --- a/tests/Austria/EpiphanyTest.php +++ b/tests/Austria/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -24,7 +24,7 @@ class EpiphanyTest extends AustriaBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday to be tested */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class EpiphanyTest extends AustriaBaseTestCase implements YasumiTestCaseInterfac * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Austria/ImmaculateConceptionTest.php b/tests/Austria/ImmaculateConceptionTest.php index 2e47a0146..aaf254201 100644 --- a/tests/Austria/ImmaculateConceptionTest.php +++ b/tests/Austria/ImmaculateConceptionTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -24,7 +24,7 @@ class ImmaculateConceptionTest extends AustriaBaseTestCase implements YasumiTest /** * The name of the holiday to be tested */ - const HOLIDAY = 'immaculateConception'; + public const HOLIDAY = 'immaculateConception'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ImmaculateConceptionTest extends AustriaBaseTestCase implements YasumiTest * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Austria/InternationalWorkersDayTest.php b/tests/Austria/InternationalWorkersDayTest.php index 4c078f852..c24c41ddc 100644 --- a/tests/Austria/InternationalWorkersDayTest.php +++ b/tests/Austria/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends AustriaBaseTestCase implements YasumiT /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends AustriaBaseTestCase implements YasumiT * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Austria/NationalDayTest.php b/tests/Austria/NationalDayTest.php index 900ff0b9a..8e1a35a8c 100644 --- a/tests/Austria/NationalDayTest.php +++ b/tests/Austria/NationalDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -25,15 +25,17 @@ class NationalDayTest extends AustriaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'nationalDay'; + public const HOLIDAY = 'nationalDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1955; + public const ESTABLISHMENT_YEAR = 1955; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Austria/NewYearsDayTest.php b/tests/Austria/NewYearsDayTest.php index a55a4b125..50129f6cd 100644 --- a/tests/Austria/NewYearsDayTest.php +++ b/tests/Austria/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -24,7 +24,7 @@ class NewYearsDayTest extends AustriaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends AustriaBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Austria/PentecostMondayTest.php b/tests/Austria/PentecostMondayTest.php index 0b04e402c..505e05db6 100644 --- a/tests/Austria/PentecostMondayTest.php +++ b/tests/Austria/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -25,10 +25,12 @@ class PentecostMondayTest extends AustriaBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Austria/PentecostTest.php b/tests/Austria/PentecostTest.php index 153a50d23..c14858829 100644 --- a/tests/Austria/PentecostTest.php +++ b/tests/Austria/PentecostTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -25,10 +25,12 @@ class PentecostTest extends AustriaBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Austria/SecondChristmasDayTest.php b/tests/Austria/SecondChristmasDayTest.php index 2dc1f4dff..4a30a6898 100644 --- a/tests/Austria/SecondChristmasDayTest.php +++ b/tests/Austria/SecondChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Austria; @@ -24,7 +24,7 @@ class SecondChristmasDayTest extends AustriaBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class SecondChristmasDayTest extends AustriaBaseTestCase implements YasumiTestCa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Base/HolidayBetweenFilterTest.php b/tests/Base/HolidayBetweenFilterTest.php index 6ab4febf5..3d269c450 100644 --- a/tests/Base/HolidayBetweenFilterTest.php +++ b/tests/Base/HolidayBetweenFilterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Base; @@ -15,7 +15,7 @@ use DateTime; use DateTimeZone; use InvalidArgumentException; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; use Yasumi\Yasumi; @@ -24,14 +24,17 @@ * * Contains tests for testing the BetweenFilter class */ -class HolidayBetweenFilterTest extends PHPUnit_Framework_TestCase +class HolidayBetweenFilterTest extends TestCase { use YasumiBase; /** * Tests the basic usage of the BetweenFilter. + * + * @throws \Exception + * @throws \ReflectionException */ - public function testHolidaysBetweenDateRange() + public function testHolidaysBetweenDateRange(): void { $timezone = 'Europe/Amsterdam'; $holidays = Yasumi::create('Netherlands', 2016); @@ -41,7 +44,7 @@ public function testHolidaysBetweenDateRange() new DateTime('07/25/2016', new DateTimeZone($timezone)) ); - $betweenHolidays = iterator_to_array($between); + $betweenHolidays = \iterator_to_array($between); $this->assertArrayHasKey('goodFriday', $betweenHolidays); $this->assertArrayHasKey('easter', $betweenHolidays); @@ -74,16 +77,19 @@ public function testHolidaysBetweenDateRange() $this->assertArrayNotHasKey('secondChristmasDay', $betweenHolidays); $this->assertCount(13, $between); - $this->assertNotCount(count($holidays), $between); + $this->assertNotCount(\count($holidays), $between); $this->assertEquals(13, $between->count()); - $this->assertNotEquals(count($holidays), $between->count()); + $this->assertNotEquals(\count($holidays), $between->count()); } /** * Tests the basic usage of the BetweenFilter using DateTimeImmutable objects. + * + * @throws \Exception + * @throws \ReflectionException */ - public function testHolidaysBetweenDateRangeWithDateTimeImmutable() + public function testHolidaysBetweenDateRangeWithDateTimeImmutable(): void { $timezone = 'Europe/Amsterdam'; $holidays = Yasumi::create('Netherlands', 2016); @@ -93,7 +99,7 @@ public function testHolidaysBetweenDateRangeWithDateTimeImmutable() new \DateTimeImmutable('07/25/2016', new \DateTimeZone($timezone)) ); - $betweenHolidays = iterator_to_array($between); + $betweenHolidays = \iterator_to_array($between); $this->assertArrayHasKey('goodFriday', $betweenHolidays); $this->assertArrayHasKey('easter', $betweenHolidays); @@ -126,17 +132,46 @@ public function testHolidaysBetweenDateRangeWithDateTimeImmutable() $this->assertArrayNotHasKey('secondChristmasDay', $betweenHolidays); $this->assertCount(13, $between); - $this->assertNotCount(count($holidays), $between); + $this->assertNotCount(\count($holidays), $between); $this->assertEquals(13, $between->count()); - $this->assertNotEquals(count($holidays), $between->count()); + $this->assertNotEquals(\count($holidays), $between->count()); } + /** + * Tests that BetweenFilter considers the date and ignores timezones and time of day. + * + * @throws \Exception + * @throws \ReflectionException + */ + public function testHolidaysBetweenDateRangeDifferentTimezone(): void + { + $holidays = Yasumi::create('Netherlands', 2016); + + $timezones = ['Pacific/Honolulu', 'Europe/Amsterdam', 'Asia/Tokyo']; + + foreach ($timezones as $timezone) { + $between = $holidays->between( + new DateTime('01/01/2016', new DateTimeZone($timezone)), + new DateTime('01/01/2016', new DateTimeZone($timezone)) + ); + $this->assertCount(1, $between); + + $between = $holidays->between( + new DateTime('01/01/2016 23:59:59', new DateTimeZone($timezone)), + new DateTime('01/01/2016 23:59:59', new DateTimeZone($timezone)) + ); + $this->assertCount(1, $between); + } + } /** * Tests the BetweenFilter with date range where start and end date are exclusive of the comparison. + * + * @throws \Exception + * @throws \ReflectionException */ - public function testHolidaysBetweenDateRangeExclusiveStartEndDate() + public function testHolidaysBetweenDateRangeExclusiveStartEndDate(): void { $timezone = 'Europe/Amsterdam'; $holidays = Yasumi::create('Netherlands', 2016); @@ -147,7 +182,7 @@ public function testHolidaysBetweenDateRangeExclusiveStartEndDate() false ); - $betweenHolidays = iterator_to_array($between); + $betweenHolidays = \iterator_to_array($between); $this->assertArrayHasKey('epiphany', $betweenHolidays); $this->assertArrayHasKey('carnivalDay', $betweenHolidays); @@ -180,16 +215,19 @@ public function testHolidaysBetweenDateRangeExclusiveStartEndDate() $this->assertArrayNotHasKey('secondChristmasDay', $betweenHolidays); $this->assertCount(19, $between); - $this->assertNotCount(count($holidays), $between); + $this->assertNotCount(\count($holidays), $between); $this->assertEquals(19, $between->count()); - $this->assertNotEquals(count($holidays), $between->count()); + $this->assertNotEquals(\count($holidays), $between->count()); } /** * Tests the BetweenFilter where the start date lies before the year of the Holiday Provider instance. + * + * @throws \Exception + * @throws \ReflectionException */ - public function testHolidaysBetweenDateRangeWithStartBeforeInstanceYear() + public function testHolidaysBetweenDateRangeWithStartBeforeInstanceYear(): void { $year = 2015; $timezone = 'Europe/Oslo'; @@ -200,7 +238,7 @@ public function testHolidaysBetweenDateRangeWithStartBeforeInstanceYear() new DateTime('05/17/' . $year, new DateTimeZone($timezone)) ); - $betweenHolidays = iterator_to_array($between); + $betweenHolidays = \iterator_to_array($between); $this->assertArrayHasKey('newYearsDay', $betweenHolidays); $this->assertArrayHasKey('maundyThursday', $betweenHolidays); @@ -217,16 +255,19 @@ public function testHolidaysBetweenDateRangeWithStartBeforeInstanceYear() $this->assertArrayNotHasKey('secondChristmasDay', $betweenHolidays); $this->assertCount(8, $between); - $this->assertNotCount(count($holidays), $between); + $this->assertNotCount(\count($holidays), $between); $this->assertEquals(8, $between->count()); - $this->assertNotEquals(count($holidays), $between->count()); + $this->assertNotEquals(\count($holidays), $between->count()); } /** * Tests the BetweenFilter where the end date lies beyond the year of the Holiday Provider instance. + * + * @throws \Exception + * @throws \ReflectionException */ - public function testHolidaysBetweenDateRangeWithEndAfterInstanceYear() + public function testHolidaysBetweenDateRangeWithEndAfterInstanceYear(): void { $year = 2000; $timezone = 'Europe/Rome'; @@ -237,7 +278,7 @@ public function testHolidaysBetweenDateRangeWithEndAfterInstanceYear() new DateTime('09/21/2021', new DateTimeZone($timezone)) ); - $betweenHolidays = iterator_to_array($between); + $betweenHolidays = \iterator_to_array($between); $this->assertArrayNotHasKey('newYearsDay', $betweenHolidays); $this->assertArrayNotHasKey('epiphany', $betweenHolidays); @@ -254,18 +295,20 @@ public function testHolidaysBetweenDateRangeWithEndAfterInstanceYear() $this->assertArrayHasKey('stStephensDay', $betweenHolidays); $this->assertCount(10, $between); - $this->assertNotCount(count($holidays), $between); + $this->assertNotCount(\count($holidays), $between); $this->assertEquals(10, $between->count()); - $this->assertNotEquals(count($holidays), $between->count()); + $this->assertNotEquals(\count($holidays), $between->count()); } /** * Tests that an InvalidArgumentException is thrown in case an invalid holiday provider is given. * * @expectedException InvalidArgumentException + * @throws \Exception + * @throws \ReflectionException */ - public function testWrongDates() + public function testWrongDates(): void { $year = 2017; $timezone = 'America/New_York'; @@ -281,8 +324,11 @@ public function testWrongDates() * Tests the BetweenFilter so that a substituted holiday is only counted once. * * This test covers the scenario that the requested date range covers all know holidays. + * + * @throws \Exception + * @throws \ReflectionException */ - public function testCountBetweenWithSubstitutes() + public function testCountBetweenWithSubstitutes(): void { // There are official 12 holidays in Ireland in the year 2018, with 1 substituted holiday. $year = 2018; @@ -294,7 +340,7 @@ public function testCountBetweenWithSubstitutes() new DateTime('12/31/' . $year, new DateTimeZone($timezone)) ); - $betweenHolidays = iterator_to_array($between); + $betweenHolidays = \iterator_to_array($between); // Assert array definitions $this->assertArrayHasKey('newYearsDay', $betweenHolidays); @@ -319,8 +365,11 @@ public function testCountBetweenWithSubstitutes() * Tests the BetweenFilter so that a substituted holiday is only counted once. * * This test covers the scenario that the requested date range excludes a substituted holiday. + * + * @throws \Exception + * @throws \ReflectionException */ - public function testCountBetweenExcludingSubstituteHoliday() + public function testCountBetweenExcludingSubstituteHoliday(): void { // There are 2 official holidays in Ireland in the given date range, with 1 substituted holiday. $year = 2018; @@ -332,7 +381,7 @@ public function testCountBetweenExcludingSubstituteHoliday() new DateTime('03/20/' . $year, new DateTimeZone($timezone)) ); - $betweenHolidays = iterator_to_array($between); + $betweenHolidays = \iterator_to_array($between); // Assert array definitions $this->assertArrayHasKey('newYearsDay', $betweenHolidays); @@ -350,10 +399,10 @@ public function testCountBetweenExcludingSubstituteHoliday() $this->assertArrayNotHasKey('pentecostMonday', $betweenHolidays); $this->assertCount(2, $between); - $this->assertNotCount(count($holidays), $between); + $this->assertNotCount(\count($holidays), $between); $this->assertEquals(2, $between->count()); - $this->assertNotEquals(count($holidays), $between->count()); + $this->assertNotEquals(\count($holidays), $between->count()); } /** @@ -361,8 +410,11 @@ public function testCountBetweenExcludingSubstituteHoliday() * * This test covers the scenario that the requested date range excludes a substituted holiday, but includes * the original substituted holiday. + * + * @throws \Exception + * @throws \ReflectionException */ - public function testCountBetweenExcludingSubstituteHolidayIncludingOriginalHoliday() + public function testCountBetweenExcludingSubstituteHolidayIncludingOriginalHoliday(): void { // There are 2 official holidays in Ireland in the given date range, with 1 substituted holiday. $year = 2018; @@ -374,7 +426,7 @@ public function testCountBetweenExcludingSubstituteHolidayIncludingOriginalHolid new DateTime('03/18/' . $year, new DateTimeZone($timezone)) ); - $betweenHolidays = iterator_to_array($between); + $betweenHolidays = \iterator_to_array($between); // Assert array definitions $this->assertArrayHasKey('newYearsDay', $betweenHolidays); @@ -393,10 +445,10 @@ public function testCountBetweenExcludingSubstituteHolidayIncludingOriginalHolid $this->assertArrayNotHasKey('pentecostMonday', $betweenHolidays); $this->assertCount(2, $between); - $this->assertNotCount(count($holidays), $between); + $this->assertNotCount(\count($holidays), $between); $this->assertEquals(2, $between->count()); - $this->assertNotEquals(count($holidays), $between->count()); + $this->assertNotEquals(\count($holidays), $between->count()); } /** @@ -404,8 +456,11 @@ public function testCountBetweenExcludingSubstituteHolidayIncludingOriginalHolid * * This test covers the scenario that the requested date range excludes a substituted holiday and also * the original substituted holiday. + * + * @throws \Exception + * @throws \ReflectionException */ - public function testCountBetweenExcludingSubstituteHolidayAndOriginalHoliday() + public function testCountBetweenExcludingSubstituteHolidayAndOriginalHoliday(): void { // There is 1 official holidays in Ireland in the given date range. $year = 2018; @@ -417,7 +472,7 @@ public function testCountBetweenExcludingSubstituteHolidayAndOriginalHoliday() new DateTime('03/16/' . $year, new DateTimeZone($timezone)) ); - $betweenHolidays = iterator_to_array($between); + $betweenHolidays = \iterator_to_array($between); // Assert array definitions $this->assertArrayHasKey('newYearsDay', $betweenHolidays); @@ -435,9 +490,9 @@ public function testCountBetweenExcludingSubstituteHolidayAndOriginalHoliday() $this->assertArrayNotHasKey('pentecostMonday', $betweenHolidays); $this->assertCount(1, $between); - $this->assertNotCount(count($holidays), $between); + $this->assertNotCount(\count($holidays), $between); $this->assertEquals(1, $between->count()); - $this->assertNotEquals(count($holidays), $between->count()); + $this->assertNotEquals(\count($holidays), $between->count()); } } diff --git a/tests/Base/HolidayFiltersTest.php b/tests/Base/HolidayFiltersTest.php index 41dcd62cc..fac3abb26 100644 --- a/tests/Base/HolidayFiltersTest.php +++ b/tests/Base/HolidayFiltersTest.php @@ -2,17 +2,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Base; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\Filters\BankHolidaysFilter; use Yasumi\Filters\ObservedHolidaysFilter; use Yasumi\Filters\OfficialHolidaysFilter; @@ -26,20 +26,21 @@ * * Contains tests for testing the filter classes */ -class HolidayFiltersTest extends PHPUnit_Framework_TestCase +class HolidayFiltersTest extends TestCase { use YasumiBase; /** * Tests the Official Holidays filter + * @throws \ReflectionException */ - public function testOfficialHolidaysFilter() + public function testOfficialHolidaysFilter(): void { // There are 11 official holidays in Ireland in the year 2018, with 1 substituted holiday. $holidays = Yasumi::create('Ireland', 2018); $filteredHolidays = new OfficialHolidaysFilter($holidays->getIterator()); - $filteredHolidaysArray = iterator_to_array($filteredHolidays); + $filteredHolidaysArray = \iterator_to_array($filteredHolidays); // Assert array definitions $this->assertArrayHasKey('newYearsDay', $filteredHolidaysArray); @@ -58,21 +59,22 @@ public function testOfficialHolidaysFilter() // Assert number of results returned $this->assertCount(10, $filteredHolidays); - $this->assertNotCount(count($holidays), $filteredHolidays); + $this->assertNotCount(\count($holidays), $filteredHolidays); $this->assertEquals(10, $filteredHolidays->count()); - $this->assertNotEquals(count($holidays), $filteredHolidays->count()); + $this->assertNotEquals(\count($holidays), $filteredHolidays->count()); } /** * Tests the Observed Holidays filter + * @throws \ReflectionException */ - public function testObservedHolidaysFilter() + public function testObservedHolidaysFilter(): void { // There are 2 observed holidays in Ireland in the year 2018. $holidays = Yasumi::create('Ireland', 2018); $filteredHolidays = new ObservedHolidaysFilter($holidays->getIterator()); - $filteredHolidaysArray = iterator_to_array($filteredHolidays); + $filteredHolidaysArray = \iterator_to_array($filteredHolidays); // Assert array definitions $this->assertArrayNotHasKey('newYearsDay', $filteredHolidaysArray); @@ -91,21 +93,22 @@ public function testObservedHolidaysFilter() // Assert number of results returned $this->assertCount(2, $filteredHolidays); - $this->assertNotCount(count($holidays), $filteredHolidays); + $this->assertNotCount(\count($holidays), $filteredHolidays); $this->assertEquals(2, $filteredHolidays->count()); - $this->assertNotEquals(count($holidays), $filteredHolidays->count()); + $this->assertNotEquals(\count($holidays), $filteredHolidays->count()); } /** * Tests Bank Holidays + * @throws \ReflectionException */ - public function testBankHolidaysFilter() + public function testBankHolidaysFilter(): void { // There are no bank holidays in Ireland in the year 2018. $holidays = Yasumi::create('Ireland', 2018); $filteredHolidays = new BankHolidaysFilter($holidays->getIterator()); - $filteredHolidaysArray = iterator_to_array($filteredHolidays); + $filteredHolidaysArray = \iterator_to_array($filteredHolidays); // Assert array definitions $this->assertArrayNotHasKey('newYearsDay', $filteredHolidaysArray); @@ -124,20 +127,21 @@ public function testBankHolidaysFilter() // Assert number of results returned $this->assertCount(0, $filteredHolidays); - $this->assertNotCount(count($holidays), $filteredHolidays); + $this->assertNotCount(\count($holidays), $filteredHolidays); $this->assertEquals(0, $filteredHolidays->count()); - $this->assertNotEquals(count($holidays), $filteredHolidays->count()); + $this->assertNotEquals(\count($holidays), $filteredHolidays->count()); } /** * Tests Seasonal Holidays + * @throws \ReflectionException */ - public function testSeasonalHolidaysFilter() + public function testSeasonalHolidaysFilter(): void { $holidays = Yasumi::create('Netherlands', 2017); $filteredHolidays = new SeasonalHolidaysFilter($holidays->getIterator()); - $filteredHolidaysArray = iterator_to_array($filteredHolidays); + $filteredHolidaysArray = \iterator_to_array($filteredHolidays); // Assert array definitions $this->assertArrayHasKey('summerTime', $filteredHolidaysArray); @@ -171,20 +175,21 @@ public function testSeasonalHolidaysFilter() // Assert number of results returned $this->assertCount(2, $filteredHolidays); - $this->assertNotCount(count($holidays), $filteredHolidays); + $this->assertNotCount(\count($holidays), $filteredHolidays); $this->assertEquals(2, $filteredHolidays->count()); - $this->assertNotEquals(count($holidays), $filteredHolidays->count()); + $this->assertNotEquals(\count($holidays), $filteredHolidays->count()); } /** * Tests other type of Holidays + * @throws \ReflectionException */ - public function testOtherHolidaysFilter() + public function testOtherHolidaysFilter(): void { $holidays = Yasumi::create('Netherlands', 2017); $filteredHolidays = new OtherHolidaysFilter($holidays->getIterator()); - $filteredHolidaysArray = iterator_to_array($filteredHolidays); + $filteredHolidaysArray = \iterator_to_array($filteredHolidays); // Assert array definitions $this->assertArrayHasKey('internationalWorkersDay', $filteredHolidaysArray); @@ -218,8 +223,8 @@ public function testOtherHolidaysFilter() // Assert number of results returned $this->assertCount(7, $filteredHolidays); - $this->assertNotCount(count($holidays), $filteredHolidays); + $this->assertNotCount(\count($holidays), $filteredHolidays); $this->assertEquals(7, $filteredHolidays->count()); - $this->assertNotEquals(count($holidays), $filteredHolidays->count()); + $this->assertNotEquals(\count($holidays), $filteredHolidays->count()); } } diff --git a/tests/Base/HolidayOnFilterTest.php b/tests/Base/HolidayOnFilterTest.php new file mode 100644 index 000000000..21d7bc787 --- /dev/null +++ b/tests/Base/HolidayOnFilterTest.php @@ -0,0 +1,101 @@ + + */ + +namespace Yasumi\tests\Base; + +use DateTime; +use DateTimeZone; +use PHPUnit\Framework\TestCase; +use Yasumi\tests\YasumiBase; +use Yasumi\Yasumi; + +/** + * Class HolidayOnFilterTest. + * + * Contains tests for testing the OnFilter class + */ +class HolidayOnFilterTest extends TestCase +{ + use YasumiBase; + + /** + * Tests the basic usage of the OnFilter. + * + * @throws \ReflectionException + * @throws \Exception + */ + public function testHolidaysOnDate(): void + { + $timezone = 'Europe/Amsterdam'; + $holidays = Yasumi::create('Netherlands', 2016); + + $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) { + $holidaysOnDate = $holidays->on( + $date + ); + + $this->assertArrayHasKey($name, \iterator_to_array($holidaysOnDate)); + } + } + + /** + * @throws \ReflectionException + * @throws \Exception + */ + public function testHolidaysNotOnDate(): void + { + $timezone = 'Europe/Amsterdam'; + $holidays = Yasumi::create('Netherlands', 2016); + + $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) { + $holidaysOnDate = $holidays->on( + $date + ); + + $this->assertArrayNotHasKey($name, \iterator_to_array($holidaysOnDate)); + } + } + + /** + * @throws \ReflectionException + * @throws \Exception + */ + public function testCorrectNumberOfHolidaysOnDate(): void + { + $timezone = 'Europe/Amsterdam'; + $holidays = Yasumi::create('Netherlands', 2016); + + // No holidays + $holidaysOnDate = $holidays->on(new \DateTime('11/19/2016', new DateTimeZone($timezone))); + $this->assertEquals(0, $holidaysOnDate->count()); + + // One holiday + $holidaysOnDate = $holidays->on(new \DateTime('12/25/2016', new DateTimeZone($timezone))); + $this->assertEquals(1, $holidaysOnDate->count()); + + // Multiple holidays + $holidaysOnDate = $holidays->on(new \DateTime('03/27/2016', new DateTimeZone($timezone))); + $this->assertGreaterThan(1, $holidaysOnDate->count()); + } +} diff --git a/tests/Base/HolidayTest.php b/tests/Base/HolidayTest.php index 9372628b6..4f7608064 100644 --- a/tests/Base/HolidayTest.php +++ b/tests/Base/HolidayTest.php @@ -2,19 +2,19 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Base; use DateTime; use InvalidArgumentException; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\Holiday; use Yasumi\tests\YasumiBase; use Yasumi\TranslationsInterface; @@ -24,7 +24,7 @@ * * Contains tests for testing the Holiday class */ -class HolidayTest extends PHPUnit_Framework_TestCase +class HolidayTest extends TestCase { use YasumiBase; @@ -32,8 +32,9 @@ class HolidayTest extends PHPUnit_Framework_TestCase * Tests that an InvalidArgumentException is thrown in case an blank short name is given. * * @expectedException InvalidArgumentException + * @throws \Exception */ - public function testHolidayBlankNameInvalidArgumentException() + public function testHolidayBlankNameInvalidArgumentException(): void { new Holiday('', [], new \DateTime()); } @@ -42,22 +43,24 @@ public function testHolidayBlankNameInvalidArgumentException() * Tests that an Yasumi\Exception\UnknownLocaleException is thrown in case an invalid locale is given. * * @expectedException \Yasumi\Exception\UnknownLocaleException + * @throws \Exception */ - public function testCreateHolidayUnknownLocaleException() + public function testCreateHolidayUnknownLocaleException(): void { new Holiday('testHoliday', [], new DateTime(), 'wx-YZ'); } /** * Tests that a Yasumi holiday instance can be serialized to a JSON object. + * @throws \Exception */ - public function testHolidayIsJsonSerializable() + public function testHolidayIsJsonSerializable(): void { $holiday = new Holiday('testHoliday', [], new DateTime(), 'en_US'); - $json = json_encode($holiday); - $instance = json_decode($json, true); + $json = \json_encode($holiday); + $instance = \json_decode($json, true); - $this->assertInternalType('array', $instance); + $this->assertIsArray($instance); $this->assertNotNull($instance); $this->assertArrayHasKey('shortName', $instance); } @@ -65,8 +68,9 @@ public function testHolidayIsJsonSerializable() /** * Tests that a Yasumi holiday instance can be created using an object that implements the DateTimeInterface (e.g. * DateTime or DateTimeImmutable) + * @throws \Exception */ - public function testHolidayWithDateTimeInterface() + public function testHolidayWithDateTimeInterface(): void { // Assert with DateTime instance $holiday = new Holiday('testHoliday', [], new \DateTime(), 'en_US'); @@ -81,48 +85,53 @@ public function testHolidayWithDateTimeInterface() /** * Tests the getName function of the Holiday object with no translations for the name given. + * @throws \Exception */ - public function testHolidayGetNameWithNoTranslations() + public function testHolidayGetNameWithNoTranslations(): void { $name = 'testHoliday'; $holiday = new Holiday($name, [], new DateTime(), 'en_US'); - $this->assertInternalType('string', $holiday->getName()); + $this->assertIsString($holiday->getName()); $this->assertEquals($name, $holiday->getName()); } /** * Tests the getName function of the Holiday object with only a default translation for the name given. + * @throws \Exception */ - public function testHolidayGetNameWithOnlyDefaultTranslation() + public function testHolidayGetNameWithOnlyDefaultTranslation(): void { $name = 'testHoliday'; $translation = 'My Holiday'; $locale = 'en_US'; $holiday = new Holiday($name, [$locale => $translation], new DateTime(), $locale); - $this->assertInternalType('string', $holiday->getName()); + $this->assertIsString($holiday->getName()); $this->assertEquals($translation, $holiday->getName()); } /** * Tests the getName function of the Holiday object with only a default translation for the name given. + * + * @throws \Exception */ - public function testHolidayGetNameWithOneNonDefaultTranslation() + public function testHolidayGetNameWithOneNonDefaultTranslation(): void { $name = 'testHoliday'; $translation = 'My Holiday'; $holiday = new Holiday($name, ['en_US' => $translation], new DateTime(), 'nl_NL'); $this->assertNotNull($holiday->getName()); - $this->assertInternalType('string', $holiday->getName()); + $this->assertIsString($holiday->getName()); $this->assertEquals($translation, $holiday->getName()); } /** * Tests the getName function of the Holiday object with global translations and no custom translation. + * @throws \Exception */ - public function testHolidayGetNameWithGlobalTranslations() + public function testHolidayGetNameWithGlobalTranslations(): void { /** @var TranslationsInterface|PHPUnit_Framework_MockObject_MockObject $translationsStub */ $translationsStub = $this->getMockBuilder(TranslationsInterface::class)->getMock(); @@ -140,14 +149,15 @@ public function testHolidayGetNameWithGlobalTranslations() $holiday->mergeGlobalTranslations($translationsStub); $this->assertNotNull($holiday->getName()); - $this->assertInternalType('string', $holiday->getName()); + $this->assertIsString($holiday->getName()); $this->assertEquals($translations[$locale], $holiday->getName()); } /** * Tests the getName function of the Holiday object with global translations and a new custom translation. + * @throws \Exception */ - public function testHolidayGetNameWithGlobalAndCustomTranslations() + public function testHolidayGetNameWithGlobalAndCustomTranslations(): void { /** @var TranslationsInterface|PHPUnit_Framework_MockObject_MockObject $translationsStub */ $translationsStub = $this->getMockBuilder(TranslationsInterface::class)->getMock(); @@ -171,14 +181,15 @@ public function testHolidayGetNameWithGlobalAndCustomTranslations() $holiday->mergeGlobalTranslations($translationsStub); $this->assertNotNull($holiday->getName()); - $this->assertInternalType('string', $holiday->getName()); + $this->assertIsString($holiday->getName()); $this->assertEquals($customTranslation, $holiday->getName()); } /** * Tests the getName function of the Holiday object with global translations and an overriding custom translation. + * @throws \Exception */ - public function testHolidayGetNameWithOverridenGlobalTranslations() + public function testHolidayGetNameWithOverridenGlobalTranslations(): void { /** @var TranslationsInterface|PHPUnit_Framework_MockObject_MockObject $translationsStub */ $translationsStub = $this->getMockBuilder(TranslationsInterface::class)->getMock(); @@ -202,7 +213,7 @@ public function testHolidayGetNameWithOverridenGlobalTranslations() $holiday->mergeGlobalTranslations($translationsStub); $this->assertNotNull($holiday->getName()); - $this->assertInternalType('string', $holiday->getName()); + $this->assertIsString($holiday->getName()); $this->assertEquals($customTranslation, $holiday->getName()); } } diff --git a/tests/Base/TranslationsTest.php b/tests/Base/TranslationsTest.php index bdaca8a36..e5b3cc7ca 100644 --- a/tests/Base/TranslationsTest.php +++ b/tests/Base/TranslationsTest.php @@ -2,19 +2,19 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Base; use InvalidArgumentException; use org\bovigo\vfs\vfsStream; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\Translations; /** @@ -22,9 +22,9 @@ * * Contains tests for testing the Translations class */ -class TranslationsTest extends PHPUnit_Framework_TestCase +class TranslationsTest extends TestCase { - private $locales = [ + public const LOCALES = [ 'en_US', 'nl_NL', 'pl_PL', @@ -33,9 +33,9 @@ class TranslationsTest extends PHPUnit_Framework_TestCase /** * Tests adding single translation. */ - public function testAddTranslation() + public function testAddTranslation(): void { - $translations = new Translations($this->locales); + $translations = new Translations(self::LOCALES); $locale = 'en_US'; $shortName = 'newYearsDay'; @@ -51,16 +51,16 @@ public function testAddTranslation() $this->assertEquals([$locale => $translation], $translations->getTranslations($shortName)); $this->assertNotNull($translations->getTranslation($shortName, $locale)); - $this->assertInternalType('string', $translations->getTranslation($shortName, $locale)); + $this->assertIsString($translations->getTranslation($shortName, $locale)); $this->assertEquals($translation, $translations->getTranslation($shortName, $locale)); } /** * Tests adding multiple translations. */ - public function testAddMultipleTranslations() + public function testAddMultipleTranslations(): void { - $translations = new Translations($this->locales); + $translations = new Translations(self::LOCALES); $firstLocale = 'en_US'; $firstShortName = 'newYearsDay'; @@ -73,7 +73,7 @@ public function testAddMultipleTranslations() $this->assertEquals([$firstLocale => $firstTranslation], $translations->getTranslations($firstShortName)); $this->assertNotNull($translations->getTranslation($firstShortName, $firstLocale)); - $this->assertInternalType('string', $translations->getTranslation($firstShortName, $firstLocale)); + $this->assertIsString($translations->getTranslation($firstShortName, $firstLocale)); $this->assertEquals($firstTranslation, $translations->getTranslation($firstShortName, $firstLocale)); $secondLocale = 'nl_NL'; @@ -87,7 +87,7 @@ public function testAddMultipleTranslations() $this->assertEquals([$secondLocale => $secondTranslation], $translations->getTranslations($secondShortName)); $this->assertNotNull($translations->getTranslation($secondShortName, $secondLocale)); - $this->assertInternalType('string', $translations->getTranslation($secondShortName, $secondLocale)); + $this->assertIsString($translations->getTranslation($secondShortName, $secondLocale)); $this->assertEquals($secondTranslation, $translations->getTranslation($secondShortName, $secondLocale)); $thirdLocale = 'en_US'; @@ -104,7 +104,7 @@ public function testAddMultipleTranslations() ); $this->assertNotNull($translations->getTranslation($thirdShortName, $thirdLocale)); - $this->assertInternalType('string', $translations->getTranslation($thirdShortName, $thirdLocale)); + $this->assertIsString($translations->getTranslation($thirdShortName, $thirdLocale)); $this->assertEquals($thirdTranslation, $translations->getTranslation($thirdShortName, $thirdLocale)); } @@ -113,9 +113,9 @@ public function testAddMultipleTranslations() * * @expectedException \Yasumi\Exception\UnknownLocaleException */ - public function testAddTranslationUnknownLocaleException() + public function testAddTranslationUnknownLocaleException(): void { - $translations = new Translations($this->locales); + $translations = new Translations(self::LOCALES); $unknownLocale = 'en_XY'; $shortName = 'newYearsDay'; @@ -127,9 +127,9 @@ public function testAddTranslationUnknownLocaleException() /** * Tests that no translation is returned for an unknown holiday. */ - public function testNoTranslationForUnknownHoliday() + public function testNoTranslationForUnknownHoliday(): void { - $translations = new Translations($this->locales); + $translations = new Translations(self::LOCALES); $locale = 'en_US'; $shortName = 'newYearsDay'; @@ -146,9 +146,9 @@ public function testNoTranslationForUnknownHoliday() /** * Tests that no translation is returned for not translated locale. */ - public function testNoTranslationForNotTranslatedLocale() + public function testNoTranslationForNotTranslatedLocale(): void { - $translations = new Translations($this->locales); + $translations = new Translations(self::LOCALES); $locale = 'en_US'; $shortName = 'newYearsDay'; @@ -164,7 +164,7 @@ public function testNoTranslationForNotTranslatedLocale() /** * Tests loading one translation file from directory. */ - public function testLoadingTranslationsFromDirectory() + public function testLoadingTranslationsFromDirectory(): void { $shortName = 'newYearsDay'; $fileContents = <<<'FILE' @@ -178,7 +178,7 @@ public function testLoadingTranslationsFromDirectory() vfsStream::setup('root', null, ['lang' => [$shortName . '.php' => $fileContents]]); - $translations = new Translations($this->locales); + $translations = new Translations(self::LOCALES); $translations->loadTranslations(vfsStream::url('root/lang')); $locale = 'en_US'; @@ -186,14 +186,14 @@ public function testLoadingTranslationsFromDirectory() $this->assertNotNull($translations->getTranslations($shortName)); $this->assertNotEmpty($translations->getTranslations($shortName)); - $this->assertInternalType('string', $translations->getTranslation($shortName, $locale)); + $this->assertIsString($translations->getTranslation($shortName, $locale)); $this->assertEquals($translation, $translations->getTranslation($shortName, $locale)); } /** * Tests that translation is not loaded from file with invalid extension. */ - public function testNotLoadingTranslationsFromFileWithInvalidExtension() + public function testNotLoadingTranslationsFromFileWithInvalidExtension(): void { $shortName = 'newYearsDay'; $fileContents = <<<'FILE' @@ -207,7 +207,7 @@ public function testNotLoadingTranslationsFromFileWithInvalidExtension() vfsStream::setup('root', null, ['lang' => [$shortName . '.translation' => $fileContents]]); - $translations = new Translations($this->locales); + $translations = new Translations(self::LOCALES); $translations->loadTranslations(vfsStream::url('root/lang')); $this->assertNotNull($translations->getTranslations($shortName)); @@ -219,7 +219,7 @@ public function testNotLoadingTranslationsFromFileWithInvalidExtension() * * @expectedException \Yasumi\Exception\UnknownLocaleException */ - public function testLoadingTranslationsFromDirectoryWithUnknownLocaleException() + public function testLoadingTranslationsFromDirectoryWithUnknownLocaleException(): void { $shortName = 'newYearsDay'; $fileContents = <<<'FILE' @@ -232,7 +232,7 @@ public function testLoadingTranslationsFromDirectoryWithUnknownLocaleException() vfsStream::setup('root', null, ['lang' => [$shortName . '.php' => $fileContents]]); - $translations = new Translations($this->locales); + $translations = new Translations(self::LOCALES); $translations->loadTranslations(vfsStream::url('root/lang')); } @@ -241,18 +241,18 @@ public function testLoadingTranslationsFromDirectoryWithUnknownLocaleException() * * @expectedException InvalidArgumentException */ - public function testLoadingTranslationsFromInexistentDirectory() + public function testLoadingTranslationsFromInexistentDirectory(): void { - vfsStream::setup('root'); + vfsStream::setup(); - $translations = new Translations($this->locales); + $translations = new Translations(self::LOCALES); $translations->loadTranslations(vfsStream::url('root/lang')); } /** * Tests loading more than one translation file from directory. */ - public function testLoadingMultipleTranslationsFromDirectory() + public function testLoadingMultipleTranslationsFromDirectory(): void { $firstShortName = 'newYearsDay'; $firstFileContents = <<<'FILE' @@ -280,7 +280,7 @@ public function testLoadingMultipleTranslationsFromDirectory() ] ]); - $translations = new Translations($this->locales); + $translations = new Translations(self::LOCALES); $translations->loadTranslations(vfsStream::url('root/lang')); @@ -289,7 +289,7 @@ public function testLoadingMultipleTranslationsFromDirectory() $this->assertNotNull($translations->getTranslations($firstShortName)); $this->assertNotEmpty($translations->getTranslations($firstShortName)); - $this->assertInternalType('string', $translations->getTranslation($firstShortName, $locale)); + $this->assertIsString($translations->getTranslation($firstShortName, $locale)); $this->assertEquals($translation, $translations->getTranslation($firstShortName, $locale)); $locale = 'nl_NL'; @@ -297,7 +297,7 @@ public function testLoadingMultipleTranslationsFromDirectory() $this->assertNotNull($translations->getTranslations($secondShortName)); $this->assertNotEmpty($translations->getTranslations($secondShortName)); - $this->assertInternalType('string', $translations->getTranslation($secondShortName, $locale)); + $this->assertIsString($translations->getTranslation($secondShortName, $locale)); $this->assertEquals($translation, $translations->getTranslation($secondShortName, $locale)); } } diff --git a/tests/Base/YasumiExternalProvider.php b/tests/Base/YasumiExternalProvider.php index 48dfd8931..7502e9709 100644 --- a/tests/Base/YasumiExternalProvider.php +++ b/tests/Base/YasumiExternalProvider.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Base; @@ -24,7 +24,7 @@ class YasumiExternalProvider implements ProviderInterface /** * Initialize country holidays. */ - public function initialize() + public function initialize(): void { // We don't actually have to do anything here. } diff --git a/tests/Base/YasumiTest.php b/tests/Base/YasumiTest.php index 336131e37..09ca624d3 100644 --- a/tests/Base/YasumiTest.php +++ b/tests/Base/YasumiTest.php @@ -2,20 +2,19 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Base; use Faker\Factory; use InvalidArgumentException; -use PHPUnit_Framework_TestCase; -use Yasumi\Exception\InvalidDateException; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; use Yasumi\Yasumi; @@ -24,26 +23,27 @@ * * Contains tests for testing the Holiday class */ -class YasumiTest extends PHPUnit_Framework_TestCase +class YasumiTest extends TestCase { use YasumiBase; /** * The lower year limit supported by Yasumi */ - const YEAR_LOWER_BOUND = 1000; + public const YEAR_LOWER_BOUND = 1000; /** * The upper year limit supported by Yasumi */ - const YEAR_UPPER_BOUND = 9999; + public const YEAR_UPPER_BOUND = 9999; /** * Tests that an InvalidArgumentException is thrown in case an invalid year is given. * * @expectedException InvalidArgumentException + * @throws \ReflectionException */ - public function testCreateWithInvalidYear() + public function testCreateWithInvalidYear(): void { Yasumi::create('Japan', 10100); } @@ -52,8 +52,9 @@ public function testCreateWithInvalidYear() * Tests that an InvalidArgumentException is thrown in case an invalid holiday provider is given. * * @expectedException InvalidArgumentException + * @throws \ReflectionException */ - public function testCreateWithInvalidProvider() + public function testCreateWithInvalidProvider(): void { Yasumi::create('Mars'); } @@ -62,8 +63,9 @@ public function testCreateWithInvalidProvider() * Tests that an InvalidArgumentException is thrown in case we try to load a Trait as provider. * * @expectedException InvalidArgumentException + * @throws \ReflectionException */ - public function testCreateWithInvalidProviderBecauseItsATrait() + public function testCreateWithInvalidProviderBecauseItsATrait(): void { Yasumi::create('CommonHolidays'); } @@ -72,16 +74,18 @@ public function testCreateWithInvalidProviderBecauseItsATrait() * Tests that an InvalidArgumentException is thrown in case we try to load the AbstractProvider as provider. * * @expectedException InvalidArgumentException + * @throws \ReflectionException */ - public function testCreateWithAbstractClassProvider() + public function testCreateWithAbstractClassProvider(): void { Yasumi::create('AbstractProvider'); } /** - * Tests that classes that Yasumi allows external classes that extend the ProviderInterface. + * Tests that Yasumi allows external classes that extend the ProviderInterface. + * @throws \ReflectionException */ - public function testCreateWithAbstractExtension() + public function testCreateWithAbstractExtension(): void { $class = YasumiExternalProvider::class; $instance = Yasumi::create( @@ -95,8 +99,9 @@ public function testCreateWithAbstractExtension() * Tests that an Yasumi\Exception\UnknownLocaleException is thrown in case an invalid locale is given. * * @expectedException \Yasumi\Exception\UnknownLocaleException + * @throws \ReflectionException */ - public function testCreateWithInvalidLocale() + public function testCreateWithInvalidLocale(): void { Yasumi::create( 'Japan', @@ -107,8 +112,9 @@ public function testCreateWithInvalidLocale() /** * Tests that the getIterator function returns an ArrayIterator object + * @throws \ReflectionException */ - public function testGetIterator() + public function testGetIterator(): void { $holidays = Yasumi::create( 'Japan', @@ -120,44 +126,49 @@ public function testGetIterator() /** * Tests that the count function returns an integer and a correct count for the test holiday provider + * @throws \ReflectionException */ - public function testCount() + public function testCount(): void { // There are 16 holidays in Japan in the year 2015, with 1 substituted holiday. $holidays = Yasumi::create('Japan', 2015); - $this->assertInternalType('int', $holidays->count()); + $this->assertIsInt($holidays->count()); $this->assertEquals(16, $holidays->count()); $this->assertNotEquals(17, $holidays->count()); } /** * Tests that the getType function returns a string for the test holiday provider + * @throws \ReflectionException */ - public function testGetType() + public function testGetType(): void { $holidays = Yasumi::create('Japan', Factory::create()->numberBetween(1949, self::YEAR_UPPER_BOUND)); $holiday = $holidays->getHoliday('newYearsDay'); - $this->assertInternalType('string', $holiday->getType()); + $this->assertIsString($holiday->getType()); } /** * Tests that the getYear function returns an integer for the test holiday provider + * @throws \ReflectionException */ - public function testGetYear() + public function testGetYear(): void { $year = Factory::create()->numberBetween(self::YEAR_LOWER_BOUND, self::YEAR_UPPER_BOUND); $holidays = Yasumi::create('Netherlands', $year); - $this->assertInternalType('integer', $holidays->getYear()); + $this->assertIsInt($holidays->getYear()); $this->assertEquals($year, $holidays->getYear()); } /** * Tests that the next function returns the next upcoming date (i.e. next year) for the given holiday + * + * @throws \ReflectionException */ - public function testNext() + public function testNext(): void { $country = 'Japan'; $name = 'childrensDay'; @@ -177,8 +188,9 @@ public function testNext() * Tests the next function that an InvalidArgumentException is thrown in case a blank name is given. * * @expectedException InvalidArgumentException + * @throws \ReflectionException */ - public function testNextWithBlankName() + public function testNextWithBlankName(): void { $holidays = Yasumi::create( 'Netherlands', @@ -189,8 +201,10 @@ public function testNextWithBlankName() /** * Tests the previous function returns the previous date (i.e. previous year) for the given holiday + * + * @throws \ReflectionException */ - public function testPrevious() + public function testPrevious(): void { $country = 'Netherlands'; $name = 'liberationDay'; @@ -211,8 +225,9 @@ public function testPrevious() * Tests the previous function that an InvalidArgumentException is thrown in case a blank name is given. * * @expectedException InvalidArgumentException + * @throws \ReflectionException */ - public function testPreviousWithBlankName() + public function testPreviousWithBlankName(): void { $holidays = Yasumi::create( 'Netherlands', @@ -223,27 +238,29 @@ public function testPreviousWithBlankName() /** * Tests that the getHolidayNames function returns an array and a correct count for the test holiday provider + * @throws \ReflectionException */ - public function testGetHolidayNames() + public function testGetHolidayNames(): void { $holidays = Yasumi::create('Japan', 2015); $holidayNames = $holidays->getHolidayNames(); - $this->assertInternalType('array', $holidayNames); + $this->assertIsArray($holidayNames); $this->assertCount(17, $holidayNames); $this->assertContains('newYearsDay', $holidayNames); } /** * Tests that the WhenIs function returns a string representation of the date the given holiday occurs. + * @throws \ReflectionException */ - public function testWhenIs() + public function testWhenIs(): void { $holidays = Yasumi::create('Japan', 2010); $when = $holidays->whenIs('autumnalEquinoxDay'); - $this->assertInternalType('string', $when); + $this->assertIsString($when); $this->assertEquals('2010-09-23', $when); } @@ -251,8 +268,9 @@ public function testWhenIs() * Tests that the WhenIs function throws an InvalidArgumentException when a blank name is given. * * @expectedException InvalidArgumentException + * @throws \ReflectionException */ - public function testWhenIsWithBlankName() + public function testWhenIsWithBlankName(): void { $holidays = Yasumi::create('Japan', 2010); $holidays->whenIs(null); @@ -262,8 +280,9 @@ public function testWhenIsWithBlankName() * Tests that an InvalidArgumentException is thrown in case a blank name is given for the getHoliday function. * * @expectedException InvalidArgumentException + * @throws \ReflectionException */ - public function testGetHolidayWithBlankName() + public function testGetHolidayWithBlankName(): void { $holidays = Yasumi::create('Netherlands', 1999); $holidays->getHoliday(null); @@ -272,13 +291,14 @@ public function testGetHolidayWithBlankName() /** * Tests that the whatWeekDayIs function returns an integer representation of the day of the week the given holiday * is occurring. + * @throws \ReflectionException */ - public function testWhatWeekDayIs() + public function testWhatWeekDayIs(): void { $holidays = Yasumi::create('Netherlands', 2110); $weekDay = $holidays->whatWeekDayIs('stMartinsDay'); - $this->assertInternalType('int', $weekDay); + $this->assertIsInt($weekDay); $this->assertEquals(2, $weekDay); } @@ -286,8 +306,9 @@ public function testWhatWeekDayIs() * Tests that the whatWeekDayIs function throws an InvalidArgumentException when a blank name is given. * * @expectedException InvalidArgumentException + * @throws \ReflectionException */ - public function testWhatWeekDayIsWithBlankName() + public function testWhatWeekDayIsWithBlankName(): void { $holidays = Yasumi::create('Netherlands', 2388); $holidays->whatWeekDayIs(null); @@ -295,40 +316,49 @@ public function testWhatWeekDayIsWithBlankName() /** * Tests that the getProviders function returns an array containing all available holiday providers. + * @throws \ReflectionException */ - public function testGetProviders() + public function testGetProviders(): void { $providers = Yasumi::getProviders(); $this->assertNotEmpty($providers); - $this->assertInternalType('array', $providers); + $this->assertIsArray($providers); $this->assertContains('Netherlands', $providers); + $this->assertEquals('USA', $providers['US']); + $this->assertNotContains('AbstractProvider', $providers); } /** * Tests that the getProviders function (static call) returns the same data when called again. + * + * @throws \ReflectionException */ - public function testGetProvidersStaticCall() + public function testGetProvidersStaticCall(): void { $provider = 'Ireland'; $providers = Yasumi::getProviders(); $initial_providers = $providers; $this->assertNotEmpty($providers); - $this->assertInternalType('array', $providers); + $this->assertIsArray($providers); $this->assertContains($provider, $providers); $providers = Yasumi::getProviders(); $this->assertNotEmpty($providers); - $this->assertInternalType('array', $providers); + $this->assertIsArray($providers); $this->assertContains($provider, $providers); $this->assertEquals($initial_providers, $providers); } /** * Tests that the isHoliday function returns a boolean true for a date that is defined as a holiday. + * @throws \Exception + * @throws \ReflectionException + * @throws \Exception + * @throws \ReflectionException */ - public function testIsHoliday() + public function testIsHoliday(): void { $year = 2110; $provider = 'Spain'; @@ -336,12 +366,12 @@ public function testIsHoliday() // Assertion using a DateTime instance $isHoliday = Yasumi::create($provider, $year)->isHoliday(new \DateTime($date)); - $this->assertInternalType('bool', $isHoliday); + $this->assertIsBool($isHoliday); $this->assertTrue($isHoliday); // Assertion using a DateTimeImmutable instance $isHoliday = Yasumi::create($provider, $year)->isHoliday(new \DateTimeImmutable($date)); - $this->assertInternalType('bool', $isHoliday); + $this->assertIsBool($isHoliday); $this->assertTrue($isHoliday); unset($isHoliday); @@ -349,8 +379,12 @@ public function testIsHoliday() /** * Tests that the isHoliday function returns a boolean false for a date that is not defined as a holiday. + * @throws \Exception + * @throws \ReflectionException + * @throws \Exception + * @throws \ReflectionException */ - public function testIsNotHoliday() + public function testIsNotHoliday(): void { $year = 5220; $provider = 'Japan'; @@ -358,25 +392,25 @@ public function testIsNotHoliday() // Assertion using a DateTime instance $isHoliday = Yasumi::create($provider, $year)->isHoliday(new \DateTime($date)); - $this->assertInternalType('bool', $isHoliday); + $this->assertIsBool($isHoliday); $this->assertFalse($isHoliday); // Assertion using a DateTimeImmutable instance $isHoliday = Yasumi::create($provider, $year)->isHoliday(new \DateTimeImmutable($date)); - $this->assertInternalType('bool', $isHoliday); + $this->assertIsBool($isHoliday); $this->assertFalse($isHoliday); unset($isHoliday); } /** - * Tests that the isHoliday function throws an InvalidDateException when the given argument is not an instance that + * Tests that the isHoliday function throws a TypeError when the given argument is not an instance that * implements the DateTimeInterface (e.g. DateTime or DateTimeImmutable) - * + * @throws \ReflectionException */ - public function testIsHolidayException() + public function testIsHolidayException(): void { - $this->expectException(InvalidDateException::class); + $this->expectException(\TypeError::class); Yasumi::create('Spain', Factory::create()->numberBetween( self::YEAR_LOWER_BOUND, @@ -389,8 +423,12 @@ public function testIsHolidayException() * the weekend. * * @TODO Add additional unit tests for those holiday providers that differ from the global definition + * @throws \Exception + * @throws \ReflectionException + * @throws \Exception + * @throws \ReflectionException */ - public function testIsWorkingDay() + public function testIsWorkingDay(): void { $year = 2020; $provider = 'Netherlands'; @@ -398,12 +436,12 @@ public function testIsWorkingDay() // Assertion using a DateTime instance $isWorkingDay = Yasumi::create($provider, $year)->isWorkingDay(new \DateTime($date)); - $this->assertInternalType('bool', $isWorkingDay); + $this->assertIsBool($isWorkingDay); $this->assertTrue($isWorkingDay); // Assertion using a DateTimeImmutable instance $isWorkingDay = Yasumi::create($provider, $year)->isWorkingDay(new \DateTimeImmutable($date)); - $this->assertInternalType('bool', $isWorkingDay); + $this->assertIsBool($isWorkingDay); $this->assertTrue($isWorkingDay); unset($isWorkingDay); @@ -414,8 +452,12 @@ public function testIsWorkingDay() * the weekend. * * @TODO Add additional unit tests for those holiday providers that differ from the global definition + * @throws \Exception + * @throws \ReflectionException + * @throws \Exception + * @throws \ReflectionException */ - public function testIsNotWorkingDay() + public function testIsNotWorkingDay(): void { $year = 2016; $provider = 'Japan'; @@ -423,26 +465,27 @@ public function testIsNotWorkingDay() // Assertion using a DateTime instance $isNotWorkingDay = Yasumi::create($provider, $year)->isWorkingDay(new \DateTime($date)); - $this->assertInternalType('bool', $isNotWorkingDay); + $this->assertIsBool($isNotWorkingDay); $this->assertFalse($isNotWorkingDay); // Assertion using a DateTimeImmutable instance $isNotWorkingDay = Yasumi::create($provider, $year)->isWorkingDay(new \DateTimeImmutable($date)); - $this->assertInternalType('bool', $isNotWorkingDay); + $this->assertIsBool($isNotWorkingDay); $this->assertFalse($isNotWorkingDay); unset($isNotWorkingDay); } /** - * Tests that the isWorkingDay function throws an InvalidDateException when the given argument is not an instance + * Tests that the isWorkingDay function throws a TypeError when the given argument is not an instance * that implements the DateTimeInterface (e.g. DateTime or DateTimeImmutable) * * @TODO Add additional unit tests for those holiday providers that differ from the global definition + * @throws \ReflectionException */ - public function testIsWorkingDayException() + public function testIsWorkingDayException(): void { - $this->expectException(InvalidDateException::class); + $this->expectException(\TypeError::class); Yasumi::create('SouthAfrica', Factory::create()->numberBetween( self::YEAR_LOWER_BOUND, @@ -455,7 +498,7 @@ public function testIsWorkingDayException() * * @throws \ReflectionException */ - public function testRemoveHoliday() + public function testRemoveHoliday(): void { $provider = Yasumi::create('Ireland', 2018); $holidays = $provider->getHolidays(); diff --git a/tests/Base/YasumiWorkdayTest.php b/tests/Base/YasumiWorkdayTest.php index 82f1c7a87..8b0ce05f6 100644 --- a/tests/Base/YasumiWorkdayTest.php +++ b/tests/Base/YasumiWorkdayTest.php @@ -2,22 +2,22 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\Yasumi; -class YasumiWorkdayTest extends PHPUnit_Framework_TestCase +class YasumiWorkdayTest extends TestCase { - const FORMAT_DATE = 'Y-m-d'; + public const FORMAT_DATE = 'Y-m-d'; /** * Tests that the nextWorkingDay function returns an object that implements the DateTimeInterface (e.g. DateTime) @@ -25,7 +25,7 @@ class YasumiWorkdayTest extends PHPUnit_Framework_TestCase * @throws \Exception * @throws \ReflectionException */ - public function testNextWorkingDay() + public function testNextWorkingDay(): void { // Includes a weekend and a holiday $provider = 'USA'; @@ -54,7 +54,7 @@ public function testNextWorkingDay() * @throws \Exception * @throws \ReflectionException */ - public function testPreviousWorkingDay() + public function testPreviousWorkingDay(): void { // Includes a weekend and a holiday $provider = 'USA'; @@ -84,7 +84,7 @@ public function testPreviousWorkingDay() * @throws \Exception * @throws \ReflectionException */ - public function testYearBoundary() + public function testYearBoundary(): void { /** * Use Case (USA): diff --git a/tests/Belgium/AllSaintsDayTest.php b/tests/Belgium/AllSaintsDayTest.php index 1a4cdad01..b98bc74d1 100644 --- a/tests/Belgium/AllSaintsDayTest.php +++ b/tests/Belgium/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends BelgiumBaseTestCase implements YasumiTestCaseInte /** * TThe name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends BelgiumBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Belgium/ArmisticeDayTest.php b/tests/Belgium/ArmisticeDayTest.php index cd59b51e5..220e25f39 100644 --- a/tests/Belgium/ArmisticeDayTest.php +++ b/tests/Belgium/ArmisticeDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; @@ -24,7 +24,7 @@ class ArmisticeDayTest extends BelgiumBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'armisticeDay'; + public const HOLIDAY = 'armisticeDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ArmisticeDayTest extends BelgiumBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 11, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Belgium/AscensionDayTest.php b/tests/Belgium/AscensionDayTest.php index af630b414..542dec794 100644 --- a/tests/Belgium/AscensionDayTest.php +++ b/tests/Belgium/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; @@ -25,10 +25,12 @@ class AscensionDayTest extends BelgiumBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Belgium/AssumptionOfMaryTest.php b/tests/Belgium/AssumptionOfMaryTest.php index 1b332b6ec..623c685f0 100644 --- a/tests/Belgium/AssumptionOfMaryTest.php +++ b/tests/Belgium/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends BelgiumBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends BelgiumBaseTestCase implements YasumiTestCase * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Belgium/BelgiumBaseTestCase.php b/tests/Belgium/BelgiumBaseTestCase.php index 36fdf9a31..89705572a 100644 --- a/tests/Belgium/BelgiumBaseTestCase.php +++ b/tests/Belgium/BelgiumBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Belgium holiday provider. */ -abstract class BelgiumBaseTestCase extends PHPUnit_Framework_TestCase +abstract class BelgiumBaseTestCase extends TestCase { use YasumiBase; /** * Country (name) to be tested */ - const REGION = 'Belgium'; + public const REGION = 'Belgium'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Brussels'; + public const TIMEZONE = 'Europe/Brussels'; /** * Locale that is considered common for this provider */ - const LOCALE = 'nl_BE'; + public const LOCALE = 'nl_BE'; } diff --git a/tests/Belgium/BelgiumTest.php b/tests/Belgium/BelgiumTest.php index 086f93c16..84aed9382 100644 --- a/tests/Belgium/BelgiumTest.php +++ b/tests/Belgium/BelgiumTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; @@ -26,8 +26,9 @@ class BelgiumTest extends BelgiumBaseTestCase /** * Tests if all official holidays in Belgium are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -47,32 +48,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Belgium are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Belgium are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Belgium are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Belgium are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Belgium/ChristmasTest.php b/tests/Belgium/ChristmasTest.php index 40b006d04..1856d8a1e 100644 --- a/tests/Belgium/ChristmasTest.php +++ b/tests/Belgium/ChristmasTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; @@ -24,7 +24,7 @@ class ChristmasTest extends BelgiumBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ChristmasTest extends BelgiumBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Belgium/EasterMondayTest.php b/tests/Belgium/EasterMondayTest.php index cc3782864..36a1d1587 100644 --- a/tests/Belgium/EasterMondayTest.php +++ b/tests/Belgium/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; @@ -25,10 +25,12 @@ class EasterMondayTest extends BelgiumBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Belgium/EasterTest.php b/tests/Belgium/EasterTest.php index 0b6df4043..ab53a22ab 100644 --- a/tests/Belgium/EasterTest.php +++ b/tests/Belgium/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; @@ -25,10 +25,12 @@ class EasterTest extends BelgiumBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests Easter. + * @throws \Exception + * @throws \ReflectionException */ public function testEaster() { @@ -43,8 +45,9 @@ public function testEaster() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Belgium/InternationalWorkersDayTest.php b/tests/Belgium/InternationalWorkersDayTest.php index b3f12c801..a8b41c4c8 100644 --- a/tests/Belgium/InternationalWorkersDayTest.php +++ b/tests/Belgium/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends BelgiumBaseTestCase implements YasumiT /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends BelgiumBaseTestCase implements YasumiT * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Belgium/NationalDayTest.php b/tests/Belgium/NationalDayTest.php index 1b9e4d06e..a22c73ad7 100644 --- a/tests/Belgium/NationalDayTest.php +++ b/tests/Belgium/NationalDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; @@ -24,7 +24,7 @@ class NationalDayTest extends BelgiumBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'nationalDay'; + public const HOLIDAY = 'nationalDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NationalDayTest extends BelgiumBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(7, 21, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Belgium/NewYearsDayTest.php b/tests/Belgium/NewYearsDayTest.php index 3d9be24a7..af1eeadf4 100644 --- a/tests/Belgium/NewYearsDayTest.php +++ b/tests/Belgium/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; @@ -24,7 +24,7 @@ class NewYearsDayTest extends BelgiumBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends BelgiumBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Belgium/PentecostTest.php b/tests/Belgium/PentecostTest.php index 784ea7adc..aa551f897 100644 --- a/tests/Belgium/PentecostTest.php +++ b/tests/Belgium/PentecostTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; @@ -25,10 +25,12 @@ class PentecostTest extends BelgiumBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * Tests Pentecost. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Belgium/pentecostMondayTest.php b/tests/Belgium/pentecostMondayTest.php index 17f614767..8557851f1 100644 --- a/tests/Belgium/pentecostMondayTest.php +++ b/tests/Belgium/pentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Belgium; @@ -25,10 +25,12 @@ class pentecostMondayTest extends BelgiumBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Bosnia/BosniaBaseTestCase.php b/tests/Bosnia/BosniaBaseTestCase.php new file mode 100644 index 000000000..5e2f5ea21 --- /dev/null +++ b/tests/Bosnia/BosniaBaseTestCase.php @@ -0,0 +1,41 @@ + + */ + +namespace Yasumi\tests\Bosnia; + +use PHPUnit\Framework\TestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the Bosnia holiday provider. + * + * @author Adnan Kičin + */ +abstract class BosniaBaseTestCase extends TestCase +{ + use YasumiBase; + + /** + * Country (name) to be tested + */ + public const REGION = 'Bosnia'; + + /** + * Timezone in which this provider has holidays defined + */ + public const TIMEZONE = 'Europe/Sarajevo'; + + /** + * Locale that is considered common for this provider + */ + public const LOCALE = 'bs_Latn_BA'; +} diff --git a/tests/Bosnia/BosniaTest.php b/tests/Bosnia/BosniaTest.php new file mode 100644 index 000000000..227f8da83 --- /dev/null +++ b/tests/Bosnia/BosniaTest.php @@ -0,0 +1,90 @@ + + */ + +namespace Yasumi\tests\Bosnia; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in Bosnia. + */ +class BosniaTest extends BosniaBaseTestCase +{ + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all official holidays in Bosnia are defined by the provider class + * @throws \ReflectionException + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'dayAfterNewYearsDay', + 'internationalWorkersDay', + 'secondLabourDay', + 'christmasDay', + 'easter', + 'allSaintsDay', + 'statehoodDay', + 'independenceDay', + 'orthodoxChristmasDay' + ], self::REGION, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Tests if all observed holidays in Bosnia are defined by the provider class + * @throws \ReflectionException + */ + public function testObservedHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); + } + + /** + * Tests if all seasonal holidays in Bosnia are defined by the provider class + * @throws \ReflectionException + */ + public function testSeasonalHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); + } + + /** + * Tests if all bank holidays in Bosnia are defined by the provider class + * @throws \ReflectionException + */ + public function testBankHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); + } + + /** + * Tests if all other holidays in Bosnia are defined by the provider class + * @throws \ReflectionException + */ + public function testOtherHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1992); + } +} diff --git a/tests/Bosnia/ChristmasDayTest.php b/tests/Bosnia/ChristmasDayTest.php new file mode 100644 index 000000000..60541e82c --- /dev/null +++ b/tests/Bosnia/ChristmasDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Bosnia; + +use DateTime; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Christmas Day in Bosnia. + */ +class ChristmasDayTest extends BosniaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested + */ + public const HOLIDAY = 'christmasDay'; + + /** + * Tests the holiday defined in this test. + * + * @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 + * + * @throws \ReflectionException + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(12, 25, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Božić'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Bosnia/DayAfterNewYearsDay.php b/tests/Bosnia/DayAfterNewYearsDay.php new file mode 100644 index 000000000..a440db3ad --- /dev/null +++ b/tests/Bosnia/DayAfterNewYearsDay.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Bosnia; + +use DateTime; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Day after New Years Day in Bosnia. + */ +class DayAfterNewYearsDay extends BosniaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested + */ + public const HOLIDAY = 'dayAfterNewYearsDay'; + + /** + * Tests the holiday defined in this test. + * + * @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 + * + * @throws \ReflectionException + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(1, 2, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Nova godina - drugi dan'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Bosnia/EasterTest.php b/tests/Bosnia/EasterTest.php new file mode 100644 index 000000000..cc3be96e9 --- /dev/null +++ b/tests/Bosnia/EasterTest.php @@ -0,0 +1,68 @@ + + */ + +namespace Yasumi\tests\Bosnia; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class containing tests for Easter in Bosnia. + */ +class EasterTest extends BosniaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested + */ + public const HOLIDAY = 'easter'; + + /** + * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException + */ + public function testHoliday() + { + $year = 1677; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("$year-4-15", new DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Uskrs'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Bosnia/IndependenceDayTest.php b/tests/Bosnia/IndependenceDayTest.php new file mode 100644 index 000000000..984f87331 --- /dev/null +++ b/tests/Bosnia/IndependenceDayTest.php @@ -0,0 +1,91 @@ + + */ + +namespace Yasumi\tests\Bosnia; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class containing tests for Independence Day in Bosnia. + */ +class IndependenceDayTest extends BosniaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'independenceDay'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 1992; + + /** + * Tests Independence Day on or after 1992. + * @throws \Exception + * @throws \ReflectionException + */ + public function testIndependenceDayOnAfter1992() + { + $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("$year-3-1", new DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests Independence Day before 1992. + * @throws \ReflectionException + */ + public function testIndependenceDayBefore1992() + { + $this->assertNotHoliday( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + ); + } + + /** + * Tests translated name of Independence Day. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Dan Nezavisnosti'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Bosnia/InternationalWorkersDayTest.php b/tests/Bosnia/InternationalWorkersDayTest.php new file mode 100644 index 000000000..4607feede --- /dev/null +++ b/tests/Bosnia/InternationalWorkersDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Bosnia; + +use DateTime; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class containing tests for International Workers' Day (i.e. Labour Day) in Bosnia. + */ +class InternationalWorkersDayTest extends BosniaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested + */ + public const HOLIDAY = 'internationalWorkersDay'; + + /** + * Tests the holiday defined in this test. + * + * @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 + * + * @throws \ReflectionException + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Praznik rada'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(5, 1, self::TIMEZONE); + } +} diff --git a/tests/Bosnia/NewYearsDayTest.php b/tests/Bosnia/NewYearsDayTest.php new file mode 100644 index 000000000..220aa03d2 --- /dev/null +++ b/tests/Bosnia/NewYearsDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Bosnia; + +use DateTime; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing New Years Day in Bosnia. + */ +class NewYearsDayTest extends BosniaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested + */ + public const HOLIDAY = 'newYearsDay'; + + /** + * Tests the holiday defined in this test. + * + * @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 + * + * @throws \ReflectionException + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(1, 1, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Nova godina'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Bosnia/OrthodoxChristmasDay.php b/tests/Bosnia/OrthodoxChristmasDay.php new file mode 100644 index 000000000..8c5814ba7 --- /dev/null +++ b/tests/Bosnia/OrthodoxChristmasDay.php @@ -0,0 +1,73 @@ + + */ + +namespace Yasumi\tests\Bosnia; + +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class containing tests for Orthodox Christmas Day in Bosnia. + */ +class OrthodoxChristmasDay extends BosniaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'orthodoxChristmasDay'; + + + /** + * @return array + * @throws \Exception + */ + public function holidayDataProvider(): array + { + return $this->generateRandomDates(1, 7, self::TIMEZONE); + } + + /** + * @dataProvider holidayDataProvider + * + * @param int $year + * @param \DateTime $expected + * + * @throws \ReflectionException + */ + public function testHoliday($year, \DateTime $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * {@inheritdoc} + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Pravoslavni Božić'] + ); + } + + /** + * {@inheritdoc} + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Bosnia/SecondLabourDay.php b/tests/Bosnia/SecondLabourDay.php new file mode 100644 index 000000000..03b0e6451 --- /dev/null +++ b/tests/Bosnia/SecondLabourDay.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Bosnia; + +use DateTime; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class containing tests for the Second International Workers' Day (i.e. Labour Day) in Bosnia. + */ +class SecondLabourDay extends BosniaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested + */ + public const HOLIDAY = 'secondLabourDay'; + + /** + * Tests the holiday defined in this test. + * + * @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 + * + * @throws \ReflectionException + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Praznik rada - drugi dan'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(5, 2, self::TIMEZONE); + } +} diff --git a/tests/Bosnia/StatehoodDayTest.php b/tests/Bosnia/StatehoodDayTest.php new file mode 100644 index 000000000..ae31d77ee --- /dev/null +++ b/tests/Bosnia/StatehoodDayTest.php @@ -0,0 +1,91 @@ + + */ + +namespace Yasumi\tests\Bosnia; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class containing tests for Statehood Day in Bosnia. + */ +class StatehoodDayTest extends BosniaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'statehoodDay'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 1943; + + /** + * Tests Statehood Day on or after 1943. + * @throws \Exception + * @throws \ReflectionException + */ + public function testStatehoodDayOnAfter1943() + { + $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("$year-11-25", new DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests Statehood Day before 1943. + * @throws \ReflectionException + */ + public function testStatehoodDayBefore1943() + { + $this->assertNotHoliday( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + ); + } + + /** + * Tests translated name of Statehood Day. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Dan državnosti'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Brazil/AllSoulsDayTest.php b/tests/Brazil/AllSoulsDayTest.php index 62b0abef7..f7e56c412 100644 --- a/tests/Brazil/AllSoulsDayTest.php +++ b/tests/Brazil/AllSoulsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -25,15 +25,17 @@ class AllSoulsDayTest extends BrazilBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'allSoulsDay'; + public const HOLIDAY = 'allSoulsDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1300; + public const ESTABLISHMENT_YEAR = 1300; /** * Tests Dia dos Finados on or after 1300. + * @throws \Exception + * @throws \ReflectionException */ public function testDiaDosFinadosAfter1300() { @@ -48,6 +50,7 @@ public function testDiaDosFinadosAfter1300() /** * Tests Dia dos Finados on or before 1300. + * @throws \ReflectionException */ public function testDiaDosFinadosBefore1300() { @@ -57,8 +60,9 @@ public function testDiaDosFinadosBefore1300() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Dia de Finados']); @@ -66,8 +70,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); diff --git a/tests/Brazil/AshWednesdayTest.php b/tests/Brazil/AshWednesdayTest.php index 617b93121..09c28dc61 100644 --- a/tests/Brazil/AshWednesdayTest.php +++ b/tests/Brazil/AshWednesdayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -25,10 +25,12 @@ class AshWednesdayTest extends BrazilBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'ashWednesday'; + public const HOLIDAY = 'ashWednesday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of Ash Wednesday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Brazil/BrazilBaseTestCase.php b/tests/Brazil/BrazilBaseTestCase.php index 160ec85a5..ce86a11ba 100644 --- a/tests/Brazil/BrazilBaseTestCase.php +++ b/tests/Brazil/BrazilBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Class BrazilBaseTestCase. */ -abstract class BrazilBaseTestCase extends PHPUnit_Framework_TestCase +abstract class BrazilBaseTestCase extends TestCase { use YasumiBase; /** * Country (name) to be tested */ - const REGION = 'Brazil'; + public const REGION = 'Brazil'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'America/Fortaleza'; + public const TIMEZONE = 'America/Fortaleza'; /** * Locale that is considered common for this provider */ - const LOCALE = 'pt_BR'; + public const LOCALE = 'pt_BR'; } diff --git a/tests/Brazil/BrazilTest.php b/tests/Brazil/BrazilTest.php index 59a1148c4..9fdccc47d 100644 --- a/tests/Brazil/BrazilTest.php +++ b/tests/Brazil/BrazilTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -26,8 +26,9 @@ class BrazilTest extends BrazilBaseTestCase /** * Tests if all official holidays in Brazil are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -44,8 +45,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Brazil are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'carnavalMonday', @@ -58,24 +60,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Brazil are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Brazil are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Brazil are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Brazil/CarnavalMondayTest.php b/tests/Brazil/CarnavalMondayTest.php index 730abd13f..b207fc4c3 100644 --- a/tests/Brazil/CarnavalMondayTest.php +++ b/tests/Brazil/CarnavalMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -27,15 +27,18 @@ class CarnavalMondayTest extends BrazilBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'carnavalMonday'; + public const HOLIDAY = 'carnavalMonday'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1700; + public const ESTABLISHMENT_YEAR = 1700; /** * Tests Carnaval Monday on or after 1700. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCarnavalMondayAfter1700() { @@ -50,6 +53,7 @@ public function testCarnavalMondayAfter1700() /** * Tests Carnaval Monday on or before 1700. + * @throws \ReflectionException */ public function testCarnavalMondayBefore1700() { @@ -59,8 +63,9 @@ public function testCarnavalMondayBefore1700() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Segunda-feira de Carnaval']); @@ -68,8 +73,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OBSERVANCE); diff --git a/tests/Brazil/CarnavalTuesdayTest.php b/tests/Brazil/CarnavalTuesdayTest.php index 3da8b1c0a..84e6b8281 100644 --- a/tests/Brazil/CarnavalTuesdayTest.php +++ b/tests/Brazil/CarnavalTuesdayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -27,15 +27,18 @@ class CarnavalTuesdayTest extends BrazilBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'carnavalTuesday'; + public const HOLIDAY = 'carnavalTuesday'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1700; + public const ESTABLISHMENT_YEAR = 1700; /** * Tests Carnaval Tuesday on or after 1700. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCarnavalTuesdayAfter1700() { @@ -50,6 +53,7 @@ public function testCarnavalTuesdayAfter1700() /** * Tests Carnaval Tuesday on or before 1700. + * @throws \ReflectionException */ public function testCarnavalTuesdayBefore1700() { @@ -59,8 +63,9 @@ public function testCarnavalTuesdayBefore1700() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Terça-feira de Carnaval']); @@ -68,8 +73,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OBSERVANCE); diff --git a/tests/Brazil/ChristmasDayTest.php b/tests/Brazil/ChristmasDayTest.php index 8ed0b5045..c67825709 100644 --- a/tests/Brazil/ChristmasDayTest.php +++ b/tests/Brazil/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -25,10 +25,12 @@ class ChristmasDayTest extends BrazilBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. + * @throws \Exception + * @throws \ReflectionException */ public function testChristmasDay() { @@ -43,8 +45,9 @@ public function testChristmasDay() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Brazil/CorpusChristiTest.php b/tests/Brazil/CorpusChristiTest.php index 48c1ed7be..fc600e826 100644 --- a/tests/Brazil/CorpusChristiTest.php +++ b/tests/Brazil/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -27,10 +27,13 @@ class CorpusChristiTest extends BrazilBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Brazil/EasterTest.php b/tests/Brazil/EasterTest.php index 961f710fe..a29ceb028 100644 --- a/tests/Brazil/EasterTest.php +++ b/tests/Brazil/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -26,10 +26,12 @@ class EasterTest extends BrazilBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests Easter. + * @throws \Exception + * @throws \ReflectionException */ public function testEaster() { @@ -39,8 +41,9 @@ public function testEaster() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -52,8 +55,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Brazil/GoodFridayTest.php b/tests/Brazil/GoodFridayTest.php index fb1ca5f18..7b224dd89 100644 --- a/tests/Brazil/GoodFridayTest.php +++ b/tests/Brazil/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -27,10 +27,13 @@ class GoodFridayTest extends BrazilBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests Good Friday. + * + * @throws \Exception + * @throws \ReflectionException */ public function testGoodFriday() { @@ -45,8 +48,9 @@ public function testGoodFriday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Brazil/IndependenceDayTest.php b/tests/Brazil/IndependenceDayTest.php index 750958d90..e58f9cfbd 100644 --- a/tests/Brazil/IndependenceDayTest.php +++ b/tests/Brazil/IndependenceDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -25,15 +25,17 @@ class IndependenceDayTest extends BrazilBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'independenceDay'; + public const HOLIDAY = 'independenceDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1822; + public const ESTABLISHMENT_YEAR = 1822; /** * Tests Dia da independência do Brasil on or after 1822. + * @throws \Exception + * @throws \ReflectionException */ public function testDiaDaIndependenciaDoBrasilAfter1822() { @@ -48,6 +50,7 @@ public function testDiaDaIndependenciaDoBrasilAfter1822() /** * Tests Dia da independência do Brasil on or before 1822. + * @throws \ReflectionException */ public function testDiaDaIndependenciaDoBrasilBefore1822() { @@ -57,8 +60,9 @@ public function testDiaDaIndependenciaDoBrasilBefore1822() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName( @@ -71,8 +75,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); diff --git a/tests/Brazil/InternationalWorkersDayTest.php b/tests/Brazil/InternationalWorkersDayTest.php index 7935185b9..8f1d3aea6 100644 --- a/tests/Brazil/InternationalWorkersDayTest.php +++ b/tests/Brazil/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -25,10 +25,12 @@ class InternationalWorkersDayTest extends BrazilBaseTestCase implements YasumiTe /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests International Workers' Day. + * @throws \Exception + * @throws \ReflectionException */ public function testInternationalWorkersDay() { @@ -43,8 +45,9 @@ public function testInternationalWorkersDay() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Brazil/NewYearsDayTest.php b/tests/Brazil/NewYearsDayTest.php index c6fba5585..d02cdd9e0 100644 --- a/tests/Brazil/NewYearsDayTest.php +++ b/tests/Brazil/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -25,10 +25,12 @@ class NewYearsDayTest extends BrazilBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. + * @throws \Exception + * @throws \ReflectionException */ public function testNewYearsDay() { @@ -43,8 +45,9 @@ public function testNewYearsDay() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Brazil/OurLadyOfAparecidaDayTest.php b/tests/Brazil/OurLadyOfAparecidaDayTest.php index 429db757e..b07dbd2e9 100644 --- a/tests/Brazil/OurLadyOfAparecidaDayTest.php +++ b/tests/Brazil/OurLadyOfAparecidaDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -25,15 +25,17 @@ class OurLadyOfAparecidaDayTest extends BrazilBaseTestCase implements YasumiTest /** * The name of the holiday */ - const HOLIDAY = 'ourLadyOfAparecidaDay'; + public const HOLIDAY = 'ourLadyOfAparecidaDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1980; + public const ESTABLISHMENT_YEAR = 1980; /** * Tests Nossa Senhora Aparecida on or after 1980. + * @throws \Exception + * @throws \ReflectionException */ public function testNossaSenhoraAparecidaAfter1980() { @@ -48,6 +50,7 @@ public function testNossaSenhoraAparecidaAfter1980() /** * Tests Nossa Senhora Aparecida on or before 1980. + * @throws \ReflectionException */ public function testNossaSenhoraAparecidaBefore1980() { @@ -57,8 +60,9 @@ public function testNossaSenhoraAparecidaBefore1980() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName( @@ -71,8 +75,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); diff --git a/tests/Brazil/ProclamationOfRepublicDayTest.php b/tests/Brazil/ProclamationOfRepublicDayTest.php index e874aa8cc..0ec657fb4 100644 --- a/tests/Brazil/ProclamationOfRepublicDayTest.php +++ b/tests/Brazil/ProclamationOfRepublicDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -25,15 +25,17 @@ class ProclamationOfRepublicDayTest extends BrazilBaseTestCase implements Yasumi /** * The name of the holiday */ - const HOLIDAY = 'proclamationOfRepublicDay'; + public const HOLIDAY = 'proclamationOfRepublicDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1889; + public const ESTABLISHMENT_YEAR = 1889; /** * Tests Proclamação da República on or after 1889. + * @throws \Exception + * @throws \ReflectionException */ public function testProclamacaoDaRepublicaAfter1889() { @@ -48,6 +50,7 @@ public function testProclamacaoDaRepublicaAfter1889() /** * Tests Proclamação da República on or before 1889. + * @throws \ReflectionException */ public function testProclamacaoDaRepublicaBefore1889() { @@ -57,8 +60,9 @@ public function testProclamacaoDaRepublicaBefore1889() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName( @@ -71,8 +75,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); diff --git a/tests/Brazil/TiradentesDayTest.php b/tests/Brazil/TiradentesDayTest.php index 92237359d..33bdfc3e3 100644 --- a/tests/Brazil/TiradentesDayTest.php +++ b/tests/Brazil/TiradentesDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Brazil; @@ -25,15 +25,17 @@ class TiradentesDayTest extends BrazilBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'tiradentesDay'; + public const HOLIDAY = 'tiradentesDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1792; + public const ESTABLISHMENT_YEAR = 1792; /** * Tests Dia de Tiradentes on or after 1792. + * @throws \Exception + * @throws \ReflectionException */ public function testDiaDeTiradentesAfter1792() { @@ -48,6 +50,7 @@ public function testDiaDeTiradentesAfter1792() /** * Tests Dia de Tiradentes on or before 1792. + * @throws \ReflectionException */ public function testDiaDeTiradentesBefore1792() { @@ -57,8 +60,9 @@ public function testDiaDeTiradentesBefore1792() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Dia de Tiradentes']); @@ -66,8 +70,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); diff --git a/tests/Croatia/AllSaintsDayTest.php b/tests/Croatia/AllSaintsDayTest.php index f589799c8..eec55bb4f 100644 --- a/tests/Croatia/AllSaintsDayTest.php +++ b/tests/Croatia/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends CroatiaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends CroatiaBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Croatia/AntifascistStruggleDayTest.php b/tests/Croatia/AntifascistStruggleDayTest.php index e6c443db1..cfc706271 100644 --- a/tests/Croatia/AntifascistStruggleDayTest.php +++ b/tests/Croatia/AntifascistStruggleDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -25,15 +25,17 @@ class AntifascistStruggleDayTest extends CroatiaBaseTestCase implements YasumiTe /** * The name of the holiday */ - const HOLIDAY = 'antifascistStruggleDay'; + public const HOLIDAY = 'antifascistStruggleDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1941; + public const ESTABLISHMENT_YEAR = 1941; /** * Tests Day of Antifascist Struggle on or after 1941. + * @throws \Exception + * @throws \ReflectionException */ public function testAntifascistStruggleDayOnAfter1941() { @@ -48,6 +50,7 @@ public function testAntifascistStruggleDayOnAfter1941() /** * Tests Day of Antifascist Struggle before 1941. + * @throws \ReflectionException */ public function testAntifascistStruggleDayBefore1941() { @@ -60,8 +63,9 @@ public function testAntifascistStruggleDayBefore1941() /** * Tests translated name of Day of Antifascist Struggle. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Croatia/AssumptionOfMaryTest.php b/tests/Croatia/AssumptionOfMaryTest.php index d867daab6..e368677a6 100644 --- a/tests/Croatia/AssumptionOfMaryTest.php +++ b/tests/Croatia/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends CroatiaBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends CroatiaBaseTestCase implements YasumiTestCase * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Croatia/ChristmasDayTest.php b/tests/Croatia/ChristmasDayTest.php index 8413c3e47..56c5d31c9 100644 --- a/tests/Croatia/ChristmasDayTest.php +++ b/tests/Croatia/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -24,7 +24,7 @@ class ChristmasDayTest extends CroatiaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ChristmasDayTest extends CroatiaBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Croatia/CorpusChristiTest.php b/tests/Croatia/CorpusChristiTest.php index c02403c16..6602c763c 100644 --- a/tests/Croatia/CorpusChristiTest.php +++ b/tests/Croatia/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -27,10 +27,13 @@ class CorpusChristiTest extends CroatiaBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Croatia/CroatiaBaseTestCase.php b/tests/Croatia/CroatiaBaseTestCase.php index d0b41e60b..e92b2ce37 100644 --- a/tests/Croatia/CroatiaBaseTestCase.php +++ b/tests/Croatia/CroatiaBaseTestCase.php @@ -2,17 +2,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** @@ -20,22 +20,22 @@ * * @author Karlo Mikus */ -abstract class CroatiaBaseTestCase extends PHPUnit_Framework_TestCase +abstract class CroatiaBaseTestCase extends TestCase { use YasumiBase; /** * Country (name) to be tested */ - const REGION = 'Croatia'; + public const REGION = 'Croatia'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zagreb'; + public const TIMEZONE = 'Europe/Zagreb'; /** * Locale that is considered common for this provider */ - const LOCALE = 'hr_HR'; + public const LOCALE = 'hr_HR'; } diff --git a/tests/Croatia/EasterMondayTest.php b/tests/Croatia/EasterMondayTest.php index a741cf947..74075bd2b 100644 --- a/tests/Croatia/EasterMondayTest.php +++ b/tests/Croatia/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -25,10 +25,12 @@ class EasterMondayTest extends CroatiaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Croatia/EasterTest.php b/tests/Croatia/EasterTest.php index dea377baa..6f0c23abb 100644 --- a/tests/Croatia/EasterTest.php +++ b/tests/Croatia/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -25,10 +25,12 @@ class EasterTest extends CroatiaBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Croatia/EpiphanyTest.php b/tests/Croatia/EpiphanyTest.php index d54d7d40a..3daddb0d4 100644 --- a/tests/Croatia/EpiphanyTest.php +++ b/tests/Croatia/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -24,7 +24,7 @@ class EpiphanyTest extends CroatiaBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday to be tested */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class EpiphanyTest extends CroatiaBaseTestCase implements YasumiTestCaseInterfac * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Croatia/HomelandThanksgivingDayTest.php b/tests/Croatia/HomelandThanksgivingDayTest.php index 0fc326006..4035147ea 100644 --- a/tests/Croatia/HomelandThanksgivingDayTest.php +++ b/tests/Croatia/HomelandThanksgivingDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -25,15 +25,17 @@ class HomelandThanksgivingDayTest extends CroatiaBaseTestCase implements YasumiT /** * The name of the holiday */ - const HOLIDAY = 'homelandThanksgiving'; + public const HOLIDAY = 'homelandThanksgiving'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1995; + public const ESTABLISHMENT_YEAR = 1995; /** * Tests Homeland Thanksgiving Day on or after 1995. + * @throws \Exception + * @throws \ReflectionException */ public function testHomelandThanksgivingDayOnAfter1995() { @@ -48,6 +50,7 @@ public function testHomelandThanksgivingDayOnAfter1995() /** * Tests Homeland Thanksgiving Day before 1995. + * @throws \ReflectionException */ public function testHomelandThanksgivingDayBefore1995() { @@ -60,8 +63,9 @@ public function testHomelandThanksgivingDayBefore1995() /** * Tests translated name of Homeland Thanksgiving Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Croatia/IndependenceDayTest.php b/tests/Croatia/IndependenceDayTest.php index 5419a8a42..42959b6e2 100644 --- a/tests/Croatia/IndependenceDayTest.php +++ b/tests/Croatia/IndependenceDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -25,15 +25,17 @@ class IndependenceDayTest extends CroatiaBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'independenceDay'; + public const HOLIDAY = 'independenceDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1991; + public const ESTABLISHMENT_YEAR = 1991; /** * Tests Independence Day on or after 1991. + * @throws \Exception + * @throws \ReflectionException */ public function testIndependenceDayOnAfter1991() { @@ -48,6 +50,7 @@ public function testIndependenceDayOnAfter1991() /** * Tests Independence Day before 1991. + * @throws \ReflectionException */ public function testIndependenceDayBefore1991() { @@ -60,8 +63,9 @@ public function testIndependenceDayBefore1991() /** * Tests translated name of Independence Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Croatia/InternationalWorkersDayTest.php b/tests/Croatia/InternationalWorkersDayTest.php index 874474627..805e8306e 100644 --- a/tests/Croatia/InternationalWorkersDayTest.php +++ b/tests/Croatia/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends CroatiaBaseTestCase implements YasumiT /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends CroatiaBaseTestCase implements YasumiT * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -41,8 +43,9 @@ public function testHoliday($year, $expected) /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } diff --git a/tests/Croatia/NewYearsDayTest.php b/tests/Croatia/NewYearsDayTest.php index d6000ad66..87953bbbc 100644 --- a/tests/Croatia/NewYearsDayTest.php +++ b/tests/Croatia/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -24,7 +24,7 @@ class NewYearsDayTest extends CroatiaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends CroatiaBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Croatia/StStephensDayTest.php b/tests/Croatia/StStephensDayTest.php index 4b6fac68e..8ce175c9f 100644 --- a/tests/Croatia/StStephensDayTest.php +++ b/tests/Croatia/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -24,7 +24,7 @@ class StStephensDayTest extends CroatiaBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the day of St. Stephen's Day. @@ -33,6 +33,8 @@ class StStephensDayTest extends CroatiaBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which St. Stephen's Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function teststStephensDay($year, $expected) { @@ -43,16 +45,18 @@ public function teststStephensDay($year, $expected) * Returns a list of random test dates used for assertion of St. Stephen's Day. * * @return array list of test dates for St. Stephen's Day + * @throws \Exception */ - public function stStephensDayDataProvider() + public function stStephensDayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests translated name of St. Stephen's Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Croatia/StatehoodDayTest.php b/tests/Croatia/StatehoodDayTest.php index ad01d76e6..ccd5ecf43 100644 --- a/tests/Croatia/StatehoodDayTest.php +++ b/tests/Croatia/StatehoodDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Croatia; @@ -25,15 +25,17 @@ class StatehoodDayTest extends CroatiaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'statehoodDay'; + public const HOLIDAY = 'statehoodDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1991; + public const ESTABLISHMENT_YEAR = 1991; /** * Tests Statehood Day on or after 1991. + * @throws \Exception + * @throws \ReflectionException */ public function testStatehoodDayOnAfter1991() { @@ -48,6 +50,7 @@ public function testStatehoodDayOnAfter1991() /** * Tests Statehood Day before 1991. + * @throws \ReflectionException */ public function testStatehoodDayBefore1991() { @@ -60,8 +63,9 @@ public function testStatehoodDayBefore1991() /** * Tests translated name of Statehood Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/CzechRepublic/ChristmasDayTest.php b/tests/CzechRepublic/ChristmasDayTest.php index 35243d735..2357c4beb 100644 --- a/tests/CzechRepublic/ChristmasDayTest.php +++ b/tests/CzechRepublic/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -28,7 +28,7 @@ class ChristmasDayTest extends CzechRepublicBaseTestCase implements YasumiTestCa /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -37,6 +37,8 @@ class ChristmasDayTest extends CzechRepublicBaseTestCase implements YasumiTestCa * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -47,16 +49,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -68,8 +72,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/CzechRepublic/ChristmasEveTest.php b/tests/CzechRepublic/ChristmasEveTest.php index aaec124b5..01dbad67c 100644 --- a/tests/CzechRepublic/ChristmasEveTest.php +++ b/tests/CzechRepublic/ChristmasEveTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -28,7 +28,7 @@ class ChristmasEveTest extends CzechRepublicBaseTestCase implements YasumiTestCa /** * The name of the holiday */ - const HOLIDAY = 'christmasEve'; + public const HOLIDAY = 'christmasEve'; /** * Tests Christmas Eve. @@ -37,6 +37,8 @@ class ChristmasEveTest extends CzechRepublicBaseTestCase implements YasumiTestCa * * @param int $year the year for which Christmas Eve needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -47,16 +49,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 24, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -68,8 +72,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/CzechRepublic/CzechRepublicBaseTestCase.php b/tests/CzechRepublic/CzechRepublicBaseTestCase.php index 18ae5b7b9..dbc3956ca 100644 --- a/tests/CzechRepublic/CzechRepublicBaseTestCase.php +++ b/tests/CzechRepublic/CzechRepublicBaseTestCase.php @@ -2,17 +2,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** @@ -22,22 +22,22 @@ * @package Yasumi\tests\CzechRepublic * @author Dennis Fridrich */ -abstract class CzechRepublicBaseTestCase extends PHPUnit_Framework_TestCase +abstract class CzechRepublicBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'CzechRepublic'; + public const REGION = 'CzechRepublic'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Prague'; + public const TIMEZONE = 'Europe/Prague'; /** * Locale that is considered common for this provider */ - const LOCALE = 'cs_CZ'; + public const LOCALE = 'cs_CZ'; } diff --git a/tests/CzechRepublic/CzechRepublicTest.php b/tests/CzechRepublic/CzechRepublicTest.php index 75aa4cb15..fa0b37ad1 100644 --- a/tests/CzechRepublic/CzechRepublicTest.php +++ b/tests/CzechRepublic/CzechRepublicTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -30,8 +30,9 @@ class CzechRepublicTest extends CzechRepublicBaseTestCase /** * Tests if all official holidays in Finland are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -51,32 +52,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in the Czech Republic are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays(['christmasEve',], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in the Czech Republic are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in the Czech Republic are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in the Czech Republic are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/CzechRepublic/CzechStateHoodDayTest.php b/tests/CzechRepublic/CzechStateHoodDayTest.php index 3424984ee..9fe192d5f 100644 --- a/tests/CzechRepublic/CzechStateHoodDayTest.php +++ b/tests/CzechRepublic/CzechStateHoodDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -28,7 +28,7 @@ class CzechStateHoodDayTest extends CzechRepublicBaseTestCase implements YasumiT /** * The name of the holiday */ - const HOLIDAY = 'czechStateHoodDay'; + public const HOLIDAY = 'czechStateHoodDay'; /** * Tests the holiday defined in this test. @@ -37,6 +37,8 @@ class CzechStateHoodDayTest extends CzechRepublicBaseTestCase implements YasumiT * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -47,16 +49,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(9, 28, self::TIMEZONE); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -68,8 +72,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/CzechRepublic/EasterMondayTest.php b/tests/CzechRepublic/EasterMondayTest.php index 386c50d77..453c27395 100644 --- a/tests/CzechRepublic/EasterMondayTest.php +++ b/tests/CzechRepublic/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -29,10 +29,12 @@ class EasterMondayTest extends CzechRepublicBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -47,8 +49,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -60,8 +63,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/CzechRepublic/GoodFridayTest.php b/tests/CzechRepublic/GoodFridayTest.php index cf38deba9..457c2b682 100644 --- a/tests/CzechRepublic/GoodFridayTest.php +++ b/tests/CzechRepublic/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -29,10 +29,12 @@ class GoodFridayTest extends CzechRepublicBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests Good Friday. + * @throws \Exception + * @throws \ReflectionException */ public function testGoodFriday() { @@ -47,8 +49,9 @@ public function testGoodFriday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -60,8 +63,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/CzechRepublic/IndependentCzechoslovakStateDayTest.php b/tests/CzechRepublic/IndependentCzechoslovakStateDayTest.php index 127824b07..0b08365e6 100644 --- a/tests/CzechRepublic/IndependentCzechoslovakStateDayTest.php +++ b/tests/CzechRepublic/IndependentCzechoslovakStateDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -24,7 +24,7 @@ class IndependentCzechoslovakStateDayTest extends CzechRepublicBaseTestCase impl /** * The name of the holiday */ - const HOLIDAY = 'independentCzechoslovakStateDay'; + public const HOLIDAY = 'independentCzechoslovakStateDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class IndependentCzechoslovakStateDayTest extends CzechRepublicBaseTestCase impl * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(10, 28, self::TIMEZONE); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/CzechRepublic/InternationalWorkersDayTest.php b/tests/CzechRepublic/InternationalWorkersDayTest.php index e4a4927f3..94f6c8977 100644 --- a/tests/CzechRepublic/InternationalWorkersDayTest.php +++ b/tests/CzechRepublic/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -28,7 +28,7 @@ class InternationalWorkersDayTest extends CzechRepublicBaseTestCase implements Y /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests International Workers' Day. @@ -37,6 +37,8 @@ class InternationalWorkersDayTest extends CzechRepublicBaseTestCase implements Y * * @param int $year the year for which International Workers' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -45,8 +47,9 @@ public function testHoliday($year, $expected) /** * Tests translated name of International Workers' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +61,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -68,8 +72,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } diff --git a/tests/CzechRepublic/JanHusDayTest.php b/tests/CzechRepublic/JanHusDayTest.php index 057e7f994..4e05f22d5 100644 --- a/tests/CzechRepublic/JanHusDayTest.php +++ b/tests/CzechRepublic/JanHusDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -24,7 +24,7 @@ class JanHusDayTest extends CzechRepublicBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'janHusDay'; + public const HOLIDAY = 'janHusDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class JanHusDayTest extends CzechRepublicBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(7, 6, self::TIMEZONE); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/CzechRepublic/NewYearsDayTest.php b/tests/CzechRepublic/NewYearsDayTest.php index e1d3a050a..4b77c8cac 100644 --- a/tests/CzechRepublic/NewYearsDayTest.php +++ b/tests/CzechRepublic/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -28,7 +28,7 @@ class NewYearsDayTest extends CzechRepublicBaseTestCase implements YasumiTestCas /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -37,6 +37,8 @@ class NewYearsDayTest extends CzechRepublicBaseTestCase implements YasumiTestCas * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -47,16 +49,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -68,8 +72,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/CzechRepublic/SaintsCyrilAndMethodiusDayTest.php b/tests/CzechRepublic/SaintsCyrilAndMethodiusDayTest.php index 5e6da8eba..6bf231375 100644 --- a/tests/CzechRepublic/SaintsCyrilAndMethodiusDayTest.php +++ b/tests/CzechRepublic/SaintsCyrilAndMethodiusDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -28,7 +28,7 @@ class SaintsCyrilAndMethodiusDayTest extends CzechRepublicBaseTestCase implement /** * The name of the holiday */ - const HOLIDAY = 'saintsCyrilAndMethodiusDay'; + public const HOLIDAY = 'saintsCyrilAndMethodiusDay'; /** * Tests the holiday defined in this test. @@ -37,6 +37,8 @@ class SaintsCyrilAndMethodiusDayTest extends CzechRepublicBaseTestCase implement * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -47,16 +49,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(7, 5, self::TIMEZONE); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -68,8 +72,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/CzechRepublic/SecondChristmasDayTest.php b/tests/CzechRepublic/SecondChristmasDayTest.php index 2c865d50d..3b1315370 100644 --- a/tests/CzechRepublic/SecondChristmasDayTest.php +++ b/tests/CzechRepublic/SecondChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -28,7 +28,7 @@ class SecondChristmasDayTest extends CzechRepublicBaseTestCase implements Yasumi /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * Tests the holiday defined in this test. @@ -37,6 +37,8 @@ class SecondChristmasDayTest extends CzechRepublicBaseTestCase implements Yasumi * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -47,16 +49,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -68,8 +72,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/CzechRepublic/StruggleForFreedomAndDemocracyDayTest.php b/tests/CzechRepublic/StruggleForFreedomAndDemocracyDayTest.php index f1d861874..f9943485d 100644 --- a/tests/CzechRepublic/StruggleForFreedomAndDemocracyDayTest.php +++ b/tests/CzechRepublic/StruggleForFreedomAndDemocracyDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -24,7 +24,7 @@ class StruggleForFreedomAndDemocracyDayTest extends CzechRepublicBaseTestCase im /** * The name of the holiday */ - const HOLIDAY = 'struggleForFreedomAndDemocracyDay'; + public const HOLIDAY = 'struggleForFreedomAndDemocracyDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StruggleForFreedomAndDemocracyDayTest extends CzechRepublicBaseTestCase im * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 17, self::TIMEZONE); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/CzechRepublic/VictoryInEuropeDayTest.php b/tests/CzechRepublic/VictoryInEuropeDayTest.php index 6a5d09bc5..b271f0d00 100644 --- a/tests/CzechRepublic/VictoryInEuropeDayTest.php +++ b/tests/CzechRepublic/VictoryInEuropeDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\CzechRepublic; @@ -28,7 +28,7 @@ class VictoryInEuropeDayTest extends CzechRepublicBaseTestCase implements Yasumi /** * The name of the holiday to be tested */ - const HOLIDAY = 'victoryInEuropeDay'; + public const HOLIDAY = 'victoryInEuropeDay'; /** * Tests the holiday defined in this test. @@ -37,6 +37,8 @@ class VictoryInEuropeDayTest extends CzechRepublicBaseTestCase implements Yasumi * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -47,16 +49,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(5, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -68,8 +72,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Denmark/AscensionDayTest.php b/tests/Denmark/AscensionDayTest.php index a54fa972b..b4503897f 100644 --- a/tests/Denmark/AscensionDayTest.php +++ b/tests/Denmark/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Denmark; @@ -25,10 +25,12 @@ class AscensionDayTest extends DenmarkBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,21 +45,23 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, $this->generateRandomYear(), - [self::LOCALE => 'Kristi Himmelfartsdag'] + [self::LOCALE => 'Kristi himmelfartsdag'] ); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Denmark/ChristmasDayTest.php b/tests/Denmark/ChristmasDayTest.php index 1f1456652..b48474b0c 100644 --- a/tests/Denmark/ChristmasDayTest.php +++ b/tests/Denmark/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Denmark; @@ -24,7 +24,7 @@ class ChristmasDayTest extends DenmarkBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ChristmasDayTest extends DenmarkBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,29 +45,32 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, $this->generateRandomYear(), - [self::LOCALE => '1. Juledag'] + [self::LOCALE => 'Juledag'] ); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Denmark/ChristmasEveTest.php b/tests/Denmark/ChristmasEveTest.php new file mode 100644 index 000000000..a2aa4b559 --- /dev/null +++ b/tests/Denmark/ChristmasEveTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Denmark; + +use DateTime; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Christmas Eve in Denmark. + */ +class ChristmasEveTest extends DenmarkBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested + */ + public const HOLIDAY = 'christmasEve'; + + /** + * Tests the holiday defined in this test. + * + * @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 + * + * @throws \ReflectionException + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(12, 24, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Juleaften'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + } +} diff --git a/tests/Denmark/ConstitutionDayTest.php b/tests/Denmark/ConstitutionDayTest.php new file mode 100644 index 000000000..8cbff6a51 --- /dev/null +++ b/tests/Denmark/ConstitutionDayTest.php @@ -0,0 +1,91 @@ + + */ + +namespace Yasumi\tests\Denmark; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing the Constitution Day of Denmark. + */ +class ConstitutionDayTest extends DenmarkBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested + */ + public const HOLIDAY = 'constitutionDay'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 1849; + + /** + * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException + */ + public function testHolidayOnAfterEstablishment() + { + $year = 2077; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("$year-6-5", new DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException + */ + public function testHolidayBeforeEstablishment() + { + $this->assertNotHoliday( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + ); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Grundlovsdag'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + Holiday::TYPE_OBSERVANCE + ); + } +} diff --git a/tests/Denmark/DenmarkBaseTestCase.php b/tests/Denmark/DenmarkBaseTestCase.php index 12c99ba37..ee4959fd7 100644 --- a/tests/Denmark/DenmarkBaseTestCase.php +++ b/tests/Denmark/DenmarkBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Denmark; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Denmark holiday provider. */ -abstract class DenmarkBaseTestCase extends PHPUnit_Framework_TestCase +abstract class DenmarkBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Denmark'; + public const REGION = 'Denmark'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Copenhagen'; + public const TIMEZONE = 'Europe/Copenhagen'; /** * Locale that is considered common for this provider */ - const LOCALE = 'da_DK'; + public const LOCALE = 'da_DK'; } diff --git a/tests/Denmark/DenmarkTest.php b/tests/Denmark/DenmarkTest.php index ce0f08c50..190488484 100644 --- a/tests/Denmark/DenmarkTest.php +++ b/tests/Denmark/DenmarkTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Denmark; @@ -26,8 +26,9 @@ class DenmarkTest extends DenmarkBaseTestCase /** * Tests if all official holidays in Denmark are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,32 +47,42 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Denmark are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); + $this->assertDefinedHolidays([ + 'internationalWorkersDay', + 'constitutionDay', + 'christmasEve', + 'newYearsEve', + ], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Denmark are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); + $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 + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Denmark are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } @@ -81,6 +92,6 @@ public function testOtherHolidays() */ protected function setUp() { - $this->year = $this->generateRandomYear(1686); + $this->year = $this->generateRandomYear(1849); } } diff --git a/tests/Denmark/EasterMondayTest.php b/tests/Denmark/EasterMondayTest.php index d91565509..5a6e067a8 100644 --- a/tests/Denmark/EasterMondayTest.php +++ b/tests/Denmark/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Denmark; @@ -25,10 +25,12 @@ class EasterMondayTest extends DenmarkBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,21 +45,23 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, $this->generateRandomYear(), - [self::LOCALE => '2. Påskedag'] + [self::LOCALE => '2. påskedag'] ); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Denmark/EasterTest.php b/tests/Denmark/EasterTest.php index d3fb14827..6f286f4ce 100644 --- a/tests/Denmark/EasterTest.php +++ b/tests/Denmark/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Denmark; @@ -25,10 +25,12 @@ class EasterTest extends DenmarkBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Denmark/GoodFridayTest.php b/tests/Denmark/GoodFridayTest.php index 831d2db7a..6aadb77ff 100644 --- a/tests/Denmark/GoodFridayTest.php +++ b/tests/Denmark/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Denmark; @@ -25,10 +25,12 @@ class GoodFridayTest extends DenmarkBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Denmark/GreatPrayerDayTest.php b/tests/Denmark/GreatPrayerDayTest.php index c700bb56d..a142c5bf7 100644 --- a/tests/Denmark/GreatPrayerDayTest.php +++ b/tests/Denmark/GreatPrayerDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Denmark; @@ -25,15 +25,17 @@ class GreatPrayerDayTest extends DenmarkBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'greatPrayerDay'; + public const HOLIDAY = 'greatPrayerDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1686; + public const ESTABLISHMENT_YEAR = 1686; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,21 +63,23 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), - [self::LOCALE => 'Store Bededag'] + [self::LOCALE => 'Store bededag'] ); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Denmark/InternationalWorkersDayTest.php b/tests/Denmark/InternationalWorkersDayTest.php new file mode 100644 index 000000000..236a3bb5e --- /dev/null +++ b/tests/Denmark/InternationalWorkersDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Denmark; + +use DateTime; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class containing tests for International Workers' Day (i.e. Labour Day) in Denmark. + */ +class InternationalWorkersDayTest extends DenmarkBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'internationalWorkersDay'; + + /** + * Tests International Workers' Day. + * + * @dataProvider InternationalWorkersDayDataProvider + * + * @param int $year the year for which International Workers' Day needs to be tested + * @param DateTime $expected the expected date + * + * @throws \ReflectionException + */ + public function testInternationalWorkersDay($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of International Workers' Day. + * + * @return array list of test dates for International Workers' Day + * @throws \Exception + */ + public function InternationalWorkersDayDataProvider(): array + { + return $this->generateRandomDates(5, 1, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Første maj'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + } +} diff --git a/tests/Denmark/MaundyThursdayTest.php b/tests/Denmark/MaundyThursdayTest.php index 9def13880..cea50ed98 100644 --- a/tests/Denmark/MaundyThursdayTest.php +++ b/tests/Denmark/MaundyThursdayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Denmark; @@ -25,10 +25,12 @@ class MaundyThursdayTest extends DenmarkBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'maundyThursday'; + public const HOLIDAY = 'maundyThursday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Denmark/NewYearsDayTest.php b/tests/Denmark/NewYearsDayTest.php index 92b5b4588..f05eee8de 100644 --- a/tests/Denmark/NewYearsDayTest.php +++ b/tests/Denmark/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Denmark; @@ -24,7 +24,7 @@ class NewYearsDayTest extends DenmarkBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends DenmarkBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Denmark/NewYearsEveTest.php b/tests/Denmark/NewYearsEveTest.php new file mode 100644 index 000000000..17def1099 --- /dev/null +++ b/tests/Denmark/NewYearsEveTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Denmark; + +use DateTime; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing New Years Eve in Denmark. + */ +class NewYearsEveTest extends DenmarkBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested + */ + public const HOLIDAY = 'newYearsEve'; + + /** + * Tests the holiday defined in this test. + * + * @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 + * + * @throws \ReflectionException + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(12, 31, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Nytårsaften'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + } +} diff --git a/tests/Denmark/PentecostMondayTest.php b/tests/Denmark/PentecostMondayTest.php index 55376e049..39a8ac9c3 100644 --- a/tests/Denmark/PentecostMondayTest.php +++ b/tests/Denmark/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Denmark; @@ -25,10 +25,12 @@ class PentecostMondayTest extends DenmarkBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,21 +45,23 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, $this->generateRandomYear(), - [self::LOCALE => '2. Pinsedag'] + [self::LOCALE => '2. pinsedag'] ); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Denmark/PentecostTest.php b/tests/Denmark/PentecostTest.php index 9fd2a4f36..f0b4ccaa4 100644 --- a/tests/Denmark/PentecostTest.php +++ b/tests/Denmark/PentecostTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Denmark; @@ -25,10 +25,12 @@ class PentecostTest extends DenmarkBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Denmark/SecondChristmasDayTest.php b/tests/Denmark/SecondChristmasDayTest.php index 8046ac742..591cdebc0 100644 --- a/tests/Denmark/SecondChristmasDayTest.php +++ b/tests/Denmark/SecondChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Denmark; @@ -24,7 +24,7 @@ class SecondChristmasDayTest extends DenmarkBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class SecondChristmasDayTest extends DenmarkBaseTestCase implements YasumiTestCa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Denmark/SummerTimeTest.php b/tests/Denmark/SummerTimeTest.php new file mode 100644 index 000000000..d706f5281 --- /dev/null +++ b/tests/Denmark/SummerTimeTest.php @@ -0,0 +1,78 @@ + + */ + +namespace Yasumi\tests\Denmark; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing summer time in Denmark. + */ +class SummerTimeTest extends DenmarkBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'summerTime'; + + /** + * Tests the holiday defined in this test. + * + * @throws \Exception + * @throws \ReflectionException + */ + public function testSummerTime() + { + $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(1949, 1979)); + + $year = $this->generateRandomYear(1980, 2036); + $expectedDate = new DateTime("last sunday of march $year", new DateTimeZone(self::TIMEZONE)); + + // Since 1980 Summertime in Denmark starts on the last day of March. In 1980 itself however, it started on April, 6th. + if ($year === 1980) { + $expectedDate = new DateTime('1980-04-06', new DateTimeZone(self::TIMEZONE)); + } + + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + $expectedDate + ); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(1980, 2037), + [self::LOCALE => 'Sommertid starter'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1980, 2037), Holiday::TYPE_SEASON); + } +} diff --git a/tests/Denmark/WinterTimeTest.php b/tests/Denmark/WinterTimeTest.php new file mode 100644 index 000000000..8d0f9d16e --- /dev/null +++ b/tests/Denmark/WinterTimeTest.php @@ -0,0 +1,79 @@ + + */ + +namespace Yasumi\tests\Denmark; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing winter time in Denmark. + */ +class WinterTimeTest extends DenmarkBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'winterTime'; + + /** + * Tests the holiday defined in this test. + * + * @throws \Exception + * @throws \ReflectionException + */ + public function testWinterTime() + { + $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(1949, 1979)); + + $year = $this->generateRandomYear(1980, 1995); + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("last sunday of september $year", new DateTimeZone(self::TIMEZONE)) + ); + + $year = $this->generateRandomYear(1996, 2036); + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("last sunday of october $year", new DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(1980, 2037), + [self::LOCALE => 'Sommertid slutter'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1980, 2037), Holiday::TYPE_SEASON); + } +} diff --git a/tests/Estonia/ChristmasDayTest.php b/tests/Estonia/ChristmasDayTest.php index e9c8515c9..cbe91f0d7 100644 --- a/tests/Estonia/ChristmasDayTest.php +++ b/tests/Estonia/ChristmasDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; @@ -26,12 +26,13 @@ class ChristmasDayTest extends EstoniaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Estonia/ChristmasEveDayTest.php b/tests/Estonia/ChristmasEveDayTest.php index 163ff2794..19f7fc7a7 100644 --- a/tests/Estonia/ChristmasEveDayTest.php +++ b/tests/Estonia/ChristmasEveDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; @@ -26,12 +26,13 @@ class ChristmasEveDayTest extends EstoniaBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasEve'; + public const HOLIDAY = 'christmasEve'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(12, 24, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Estonia/EasterDayTest.php b/tests/Estonia/EasterDayTest.php index b15bf6ddf..39e0d0edb 100644 --- a/tests/Estonia/EasterDayTest.php +++ b/tests/Estonia/EasterDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; @@ -26,12 +26,13 @@ class EasterDayTest extends EstoniaBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomEasterDates(self::TIMEZONE); } @@ -43,6 +44,9 @@ public function holidayDataProvider() * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -56,8 +60,9 @@ public function testHoliday($year, $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -69,8 +74,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Estonia/EstoniaBaseTestCase.php b/tests/Estonia/EstoniaBaseTestCase.php index 6ed265032..454a57d66 100644 --- a/tests/Estonia/EstoniaBaseTestCase.php +++ b/tests/Estonia/EstoniaBaseTestCase.php @@ -3,16 +3,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** @@ -20,22 +21,22 @@ * * @author Gedas Lukošius */ -abstract class EstoniaBaseTestCase extends \PHPUnit_Framework_TestCase +abstract class EstoniaBaseTestCase extends TestCase { use YasumiBase; /** * Name of the country to be tested */ - const REGION = 'Estonia'; + public const REGION = 'Estonia'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Tallinn'; + public const TIMEZONE = 'Europe/Tallinn'; /** * Locale that is considered common for this provider */ - const LOCALE = 'et_EE'; + public const LOCALE = 'et_EE'; } diff --git a/tests/Estonia/EstoniaTest.php b/tests/Estonia/EstoniaTest.php index e83889561..522f720e7 100644 --- a/tests/Estonia/EstoniaTest.php +++ b/tests/Estonia/EstoniaTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; @@ -25,8 +25,9 @@ class EstoniaTest extends EstoniaBaseTestCase { /** * Tests if all official holidays in Estonia are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $holidays = [ 'christmasDay', @@ -59,32 +60,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Estonia are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Estonia are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Estonia are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_BANK); } /** * Tests if all other holidays in Estonia are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Estonia/GoodFridayDayTest.php b/tests/Estonia/GoodFridayDayTest.php index 1d0045d48..09724dd04 100644 --- a/tests/Estonia/GoodFridayDayTest.php +++ b/tests/Estonia/GoodFridayDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; @@ -26,14 +26,14 @@ class GoodFridayDayTest extends EstoniaBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * @return array * * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomGoodFridayDates(self::TIMEZONE); } @@ -45,6 +45,9 @@ public function holidayDataProvider() * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -58,8 +61,9 @@ public function testHoliday($year, $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -71,8 +75,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Estonia/IndependenceDayTest.php b/tests/Estonia/IndependenceDayTest.php index 37293afc8..88cc5f89d 100644 --- a/tests/Estonia/IndependenceDayTest.php +++ b/tests/Estonia/IndependenceDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; @@ -27,10 +27,11 @@ class IndependenceDayTest extends EstoniaBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'independenceDay'; + public const HOLIDAY = 'independenceDay'; /** * Test if holiday is not defined before + * @throws \ReflectionException */ public function testHolidayBefore() { @@ -43,6 +44,8 @@ public function testHolidayBefore() /** * Test if holiday is defined after + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayAfter() { @@ -58,8 +61,10 @@ public function testHolidayAfter() /** * {@inheritdoc} + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -77,8 +82,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Estonia/InternationalWorkersDayTest.php b/tests/Estonia/InternationalWorkersDayTest.php index 4394a548b..7ac8c7f34 100644 --- a/tests/Estonia/InternationalWorkersDayTest.php +++ b/tests/Estonia/InternationalWorkersDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; @@ -26,12 +26,13 @@ class InternationalWorkersDayTest extends EstoniaBaseTestCase implements YasumiT /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Estonia/NewYearsDayTest.php b/tests/Estonia/NewYearsDayTest.php index 64f034622..cbbf69e95 100644 --- a/tests/Estonia/NewYearsDayTest.php +++ b/tests/Estonia/NewYearsDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; @@ -26,12 +26,13 @@ class NewYearsDayTest extends EstoniaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Estonia/PentecostTest.php b/tests/Estonia/PentecostTest.php index 4a7643f70..52221390b 100644 --- a/tests/Estonia/PentecostTest.php +++ b/tests/Estonia/PentecostTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; @@ -26,14 +26,14 @@ class PentecostTest extends EstoniaBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * @return array * * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomPentecostDates(self::TIMEZONE); } @@ -45,6 +45,9 @@ public function holidayDataProvider() * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -58,8 +61,9 @@ public function testHoliday($year, $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -71,8 +75,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Estonia/RestorationOfIndependenceDayTest.php b/tests/Estonia/RestorationOfIndependenceDayTest.php index 2b1096156..45105876c 100644 --- a/tests/Estonia/RestorationOfIndependenceDayTest.php +++ b/tests/Estonia/RestorationOfIndependenceDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; @@ -27,10 +27,11 @@ class RestorationOfIndependenceDayTest extends EstoniaBaseTestCase implements Ya /** * The name of the holiday to be tested */ - const HOLIDAY = 'restorationOfIndependenceDay'; + public const HOLIDAY = 'restorationOfIndependenceDay'; /** * Test if holiday is not defined before + * @throws \ReflectionException */ public function testHolidayBefore() { @@ -43,6 +44,8 @@ public function testHolidayBefore() /** * Test if holiday is defined after + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayAfter() { @@ -58,8 +61,10 @@ public function testHolidayAfter() /** * {@inheritdoc} + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -77,8 +82,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Estonia/SecondChristmasDayTest.php b/tests/Estonia/SecondChristmasDayTest.php index 9f3aa95e2..694568422 100644 --- a/tests/Estonia/SecondChristmasDayTest.php +++ b/tests/Estonia/SecondChristmasDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; @@ -26,12 +26,13 @@ class SecondChristmasDayTest extends EstoniaBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Estonia/StJohnsDayTest.php b/tests/Estonia/StJohnsDayTest.php index 53cd5519a..2a3bf590e 100644 --- a/tests/Estonia/StJohnsDayTest.php +++ b/tests/Estonia/StJohnsDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; @@ -26,12 +26,13 @@ class StJohnsDayTest extends EstoniaBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'stJohnsDay'; + public const HOLIDAY = 'stJohnsDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(6, 24, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Estonia/VictoryDayTest.php b/tests/Estonia/VictoryDayTest.php index ff06853ff..4fcaa36c0 100644 --- a/tests/Estonia/VictoryDayTest.php +++ b/tests/Estonia/VictoryDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Estonia; @@ -27,10 +27,11 @@ class VictoryDayTest extends EstoniaBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'victoryDay'; + public const HOLIDAY = 'victoryDay'; /** * Test if holiday is not defined before + * @throws \ReflectionException */ public function testHolidayBefore() { @@ -43,6 +44,8 @@ public function testHolidayBefore() /** * Test if holiday is defined after + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayAfter() { @@ -58,8 +61,10 @@ public function testHolidayAfter() /** * {@inheritdoc} + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -77,8 +82,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Finland/AllSaintsDayTest.php b/tests/Finland/AllSaintsDayTest.php index 04206dcc5..de92950aa 100644 --- a/tests/Finland/AllSaintsDayTest.php +++ b/tests/Finland/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -26,7 +26,7 @@ class AllSaintsDayTest extends FinlandBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests the holiday defined in this test. @@ -35,6 +35,8 @@ class AllSaintsDayTest extends FinlandBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -45,8 +47,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -69,8 +72,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -82,8 +86,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Finland/AscensionDayTest.php b/tests/Finland/AscensionDayTest.php index 316a2c387..5d848273f 100644 --- a/tests/Finland/AscensionDayTest.php +++ b/tests/Finland/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -25,10 +25,12 @@ class AscensionDayTest extends FinlandBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Finland/ChristmasDayTest.php b/tests/Finland/ChristmasDayTest.php index 5f7ed30a0..c3b1dfa14 100644 --- a/tests/Finland/ChristmasDayTest.php +++ b/tests/Finland/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -24,7 +24,7 @@ class ChristmasDayTest extends FinlandBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ChristmasDayTest extends FinlandBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Finland/EasterMondayTest.php b/tests/Finland/EasterMondayTest.php index 0b0fb03df..91970d0ce 100644 --- a/tests/Finland/EasterMondayTest.php +++ b/tests/Finland/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -25,10 +25,12 @@ class EasterMondayTest extends FinlandBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Finland/EasterTest.php b/tests/Finland/EasterTest.php index 66c3be094..25d5f4ed4 100644 --- a/tests/Finland/EasterTest.php +++ b/tests/Finland/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -25,10 +25,12 @@ class EasterTest extends FinlandBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Finland/EpiphanyTest.php b/tests/Finland/EpiphanyTest.php index 26234b0bf..ad70e7aeb 100644 --- a/tests/Finland/EpiphanyTest.php +++ b/tests/Finland/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -24,7 +24,7 @@ class EpiphanyTest extends FinlandBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday to be tested */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class EpiphanyTest extends FinlandBaseTestCase implements YasumiTestCaseInterfac * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Finland/FinlandBaseTestCase.php b/tests/Finland/FinlandBaseTestCase.php index cb0f51baf..92670eb79 100644 --- a/tests/Finland/FinlandBaseTestCase.php +++ b/tests/Finland/FinlandBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Finland holiday provider. */ -abstract class FinlandBaseTestCase extends PHPUnit_Framework_TestCase +abstract class FinlandBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Finland'; + public const REGION = 'Finland'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Helsinki'; + public const TIMEZONE = 'Europe/Helsinki'; /** * Locale that is considered common for this provider */ - const LOCALE = 'fi_FI'; + public const LOCALE = 'fi_FI'; } diff --git a/tests/Finland/FinlandTest.php b/tests/Finland/FinlandTest.php index 0950704a4..1cddb0c80 100644 --- a/tests/Finland/FinlandTest.php +++ b/tests/Finland/FinlandTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -26,8 +26,9 @@ class FinlandTest extends FinlandBaseTestCase /** * Tests if all official holidays in Finland are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -48,32 +49,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Finland are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Finland are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Finland are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Finland are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Finland/GoodFridayTest.php b/tests/Finland/GoodFridayTest.php index aa9775b34..c5e22985a 100644 --- a/tests/Finland/GoodFridayTest.php +++ b/tests/Finland/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -25,10 +25,12 @@ class GoodFridayTest extends FinlandBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Finland/IndependenceDayTest.php b/tests/Finland/IndependenceDayTest.php index 1c44079d4..eaae9484e 100644 --- a/tests/Finland/IndependenceDayTest.php +++ b/tests/Finland/IndependenceDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -25,15 +25,17 @@ class IndependenceDayTest extends FinlandBaseTestCase implements YasumiTestCaseI /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1917; + public const ESTABLISHMENT_YEAR = 1917; /** * The name of the holiday */ - const HOLIDAY = 'independenceDay'; + public const HOLIDAY = 'independenceDay'; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Finland/InternationalWorkersDayTest.php b/tests/Finland/InternationalWorkersDayTest.php index 26706035d..22eeb73c9 100644 --- a/tests/Finland/InternationalWorkersDayTest.php +++ b/tests/Finland/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends FinlandBaseTestCase implements YasumiT /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends FinlandBaseTestCase implements YasumiT * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -41,8 +43,9 @@ public function testHoliday($year, $expected) /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } diff --git a/tests/Finland/NewYearsDayTest.php b/tests/Finland/NewYearsDayTest.php index 20fa75095..12344bd53 100644 --- a/tests/Finland/NewYearsDayTest.php +++ b/tests/Finland/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -24,7 +24,7 @@ class NewYearsDayTest extends FinlandBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends FinlandBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Finland/PentecostTest.php b/tests/Finland/PentecostTest.php index 048754289..b153a888f 100644 --- a/tests/Finland/PentecostTest.php +++ b/tests/Finland/PentecostTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -25,10 +25,12 @@ class PentecostTest extends FinlandBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Finland/SecondChristmasDayTest.php b/tests/Finland/SecondChristmasDayTest.php index e257b3692..0d846a188 100644 --- a/tests/Finland/SecondChristmasDayTest.php +++ b/tests/Finland/SecondChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -24,7 +24,7 @@ class SecondChristmasDayTest extends FinlandBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class SecondChristmasDayTest extends FinlandBaseTestCase implements YasumiTestCa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Finland/stJohnsDayTest.php b/tests/Finland/stJohnsDayTest.php index 3fa10e3ae..9b5fa9ec6 100644 --- a/tests/Finland/stJohnsDayTest.php +++ b/tests/Finland/stJohnsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Finland; @@ -30,15 +30,17 @@ class stJohnsDayTest extends FinlandBaseTestCase implements YasumiTestCaseInterf /** * The year in which the holiday was adjusted */ - const ADJUSTMENT_YEAR = 1955; + public const ADJUSTMENT_YEAR = 1955; /** * The name of the holiday to be tested */ - const HOLIDAY = 'stJohnsDay'; + public const HOLIDAY = 'stJohnsDay'; /** * Tests the holiday before it was adjusted. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayBeforeAdjustment() { @@ -53,6 +55,7 @@ public function testHolidayBeforeAdjustment() /** * Tests the holiday before it was adjusted. + * @throws \ReflectionException */ public function testHolidayAfterAdjustment() { @@ -62,7 +65,7 @@ public function testHolidayAfterAdjustment() $holiday = $holidays->getHoliday(self::HOLIDAY); // Some basic assertions - $this->assertInstanceOf('Yasumi\Provider\\' . str_replace('/', '\\', self::REGION), $holidays); + $this->assertInstanceOf('Yasumi\Provider\\' . \str_replace('/', '\\', self::REGION), $holidays); $this->assertInstanceOf(Holiday::class, $holiday); $this->assertNotNull($holiday); @@ -76,8 +79,9 @@ public function testHolidayAfterAdjustment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -89,8 +93,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/France/AllSaintsDayTest.php b/tests/France/AllSaintsDayTest.php index 01f71b020..f7baff4bf 100644 --- a/tests/France/AllSaintsDayTest.php +++ b/tests/France/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends FranceBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends FranceBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAllSaintsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testAllSaintsDay($year, $expected) /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } diff --git a/tests/France/ArmisticeDayTest.php b/tests/France/ArmisticeDayTest.php index 9c7528e6d..e6cc7c4b2 100644 --- a/tests/France/ArmisticeDayTest.php +++ b/tests/France/ArmisticeDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France; @@ -25,15 +25,17 @@ class ArmisticeDayTest extends FranceBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'armisticeDay'; + public const HOLIDAY = 'armisticeDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1919; + public const ESTABLISHMENT_YEAR = 1919; /** * Tests Armistice Day on or after 1919. + * @throws \Exception + * @throws \ReflectionException */ public function testArmisticeDayOnAfter1919() { @@ -48,6 +50,7 @@ public function testArmisticeDayOnAfter1919() /** * Tests Armistice Day before 1919. + * @throws \ReflectionException */ public function testArmisticeDayBefore1919() { @@ -60,8 +63,9 @@ public function testArmisticeDayBefore1919() /** * Tests translated name of Armistice Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/France/AscensionDayTest.php b/tests/France/AscensionDayTest.php index 74cec0762..9b232f7ed 100644 --- a/tests/France/AscensionDayTest.php +++ b/tests/France/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France; @@ -25,10 +25,12 @@ class AscensionDayTest extends FranceBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/France/AssumptionOfMaryTest.php b/tests/France/AssumptionOfMaryTest.php index 9a5743c70..a0910dd37 100644 --- a/tests/France/AssumptionOfMaryTest.php +++ b/tests/France/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends FranceBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the day of the Assumption of Mary. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends FranceBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAssumptionOfMary($year, $expected) { @@ -41,8 +43,9 @@ public function testAssumptionOfMary($year, $expected) /** * Tests translated name of the day of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the day of the Assumption of Mary. * * @return array list of test dates for the day of the Assumption of Mary + * @throws \Exception */ - public function AssumptionOfMaryDataProvider() + public function AssumptionOfMaryDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } diff --git a/tests/France/BasRhin/BasRhinBaseTestCase.php b/tests/France/BasRhin/BasRhinBaseTestCase.php index 91dd14ea2..0a5d29c39 100644 --- a/tests/France/BasRhin/BasRhinBaseTestCase.php +++ b/tests/France/BasRhin/BasRhinBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France\BasRhin; @@ -25,15 +25,15 @@ abstract class BasRhinBaseTestCase extends FranceBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'France/BasRhin'; + public const REGION = 'France/BasRhin'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Paris'; + public const TIMEZONE = 'Europe/Paris'; /** * Locale that is considered common for this provider */ - const LOCALE = 'fr_FR'; + public const LOCALE = 'fr_FR'; } diff --git a/tests/France/BasRhin/BasRhinTest.php b/tests/France/BasRhin/BasRhinTest.php index debf3112e..4009a0a3a 100644 --- a/tests/France/BasRhin/BasRhinTest.php +++ b/tests/France/BasRhin/BasRhinTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France\BasRhin; @@ -26,8 +26,9 @@ class BasRhinTest extends BasRhinBaseTestCase /** * Tests if all official holidays in Bas-Rhin are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -48,32 +49,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Bas-Rhin (France) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Bas-Rhin (France) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Bas-Rhin (France) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Bas-Rhin (France) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/France/BasRhin/GoodFridayTest.php b/tests/France/BasRhin/GoodFridayTest.php index 54750123c..4d7a688f9 100644 --- a/tests/France/BasRhin/GoodFridayTest.php +++ b/tests/France/BasRhin/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France\BasRhin; @@ -25,10 +25,12 @@ class GoodFridayTest extends BasRhinBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/France/BasRhin/stStephensDayTest.php b/tests/France/BasRhin/stStephensDayTest.php index 185378886..a0b111358 100644 --- a/tests/France/BasRhin/stStephensDayTest.php +++ b/tests/France/BasRhin/stStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France\BasRhin; @@ -24,7 +24,7 @@ class stStephensDayTest extends BasRhinBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class stStephensDayTest extends BasRhinBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/France/BastilleDayTest.php b/tests/France/BastilleDayTest.php index 96c791958..ecb32bd2d 100644 --- a/tests/France/BastilleDayTest.php +++ b/tests/France/BastilleDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France; @@ -25,15 +25,17 @@ class BastilleDayTest extends FranceBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'bastilleDay'; + public const HOLIDAY = 'bastilleDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1790; + public const ESTABLISHMENT_YEAR = 1790; /** * Tests Bastille Day on or after 1790. + * @throws \Exception + * @throws \ReflectionException */ public function testBastilleDayOnAfter1790() { @@ -48,6 +50,7 @@ public function testBastilleDayOnAfter1790() /** * Tests Bastille Day before 1790. + * @throws \ReflectionException */ public function testBastilleDayBefore1790() { @@ -60,8 +63,9 @@ public function testBastilleDayBefore1790() /** * Tests translated name of Bastille Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/France/ChristmasDayTest.php b/tests/France/ChristmasDayTest.php index 15ce75a6c..a8caa9701 100644 --- a/tests/France/ChristmasDayTest.php +++ b/tests/France/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France; @@ -24,7 +24,7 @@ class ChristmasDayTest extends FranceBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends FranceBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/France/EasterMondayTest.php b/tests/France/EasterMondayTest.php index 1b20c775c..6171d0e9a 100644 --- a/tests/France/EasterMondayTest.php +++ b/tests/France/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France; @@ -25,10 +25,12 @@ class EasterMondayTest extends FranceBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/France/FranceBaseTestCase.php b/tests/France/FranceBaseTestCase.php index 4d8da261e..7388c319f 100644 --- a/tests/France/FranceBaseTestCase.php +++ b/tests/France/FranceBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the France holiday provider. */ -abstract class FranceBaseTestCase extends PHPUnit_Framework_TestCase +abstract class FranceBaseTestCase extends TestCase { use YasumiBase; /** * Country (name) to be tested */ - const REGION = 'France'; + public const REGION = 'France'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Paris'; + public const TIMEZONE = 'Europe/Paris'; /** * Locale that is considered common for this provider */ - const LOCALE = 'fr_FR'; + public const LOCALE = 'fr_FR'; } diff --git a/tests/France/FranceTest.php b/tests/France/FranceTest.php index 7fa6bff2b..d30e0e9bd 100644 --- a/tests/France/FranceTest.php +++ b/tests/France/FranceTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France; @@ -26,8 +26,9 @@ class FranceTest extends FranceBaseTestCase /** * Tests if all official holidays in France are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,32 +47,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in France are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in France are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in France are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in France are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/France/HautRhin/GoodFridayTest.php b/tests/France/HautRhin/GoodFridayTest.php index ed5073719..8b04e7b63 100644 --- a/tests/France/HautRhin/GoodFridayTest.php +++ b/tests/France/HautRhin/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France\HautRhin; @@ -25,10 +25,12 @@ class GoodFridayTest extends HautRhinBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/France/HautRhin/HautRhinBaseTestCase.php b/tests/France/HautRhin/HautRhinBaseTestCase.php index 47f839050..cc4a51c32 100644 --- a/tests/France/HautRhin/HautRhinBaseTestCase.php +++ b/tests/France/HautRhin/HautRhinBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France\HautRhin; @@ -25,15 +25,15 @@ abstract class HautRhinBaseTestCase extends FranceBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'France/HautRhin'; + public const REGION = 'France/HautRhin'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Paris'; + public const TIMEZONE = 'Europe/Paris'; /** * Locale that is considered common for this provider */ - const LOCALE = 'fr_FR'; + public const LOCALE = 'fr_FR'; } diff --git a/tests/France/HautRhin/HautRhinTest.php b/tests/France/HautRhin/HautRhinTest.php index 357a7fc21..4c0da79e4 100644 --- a/tests/France/HautRhin/HautRhinTest.php +++ b/tests/France/HautRhin/HautRhinTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France\HautRhin; @@ -26,8 +26,9 @@ class HautRhinTest extends HautRhinBaseTestCase /** * Tests if all official holidays in Haut-Rhin are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -48,32 +49,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Haut-Rhin (France) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Haut-Rhin (France) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Haut-Rhin (France) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Haut-Rhin (France) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/France/HautRhin/stStephensDayTest.php b/tests/France/HautRhin/stStephensDayTest.php index cb72647ba..efaee6358 100644 --- a/tests/France/HautRhin/stStephensDayTest.php +++ b/tests/France/HautRhin/stStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France\HautRhin; @@ -24,7 +24,7 @@ class stStephensDayTest extends HautRhinBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class stStephensDayTest extends HautRhinBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/France/InternationalWorkersDayTest.php b/tests/France/InternationalWorkersDayTest.php index 59fdff013..34383f2f4 100644 --- a/tests/France/InternationalWorkersDayTest.php +++ b/tests/France/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends FranceBaseTestCase implements YasumiTe /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests International Workers' Day. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends FranceBaseTestCase implements YasumiTe * * @param int $year the year for which International Workers' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testInternationalWorkersDay($year, $expected) { @@ -41,8 +43,9 @@ public function testInternationalWorkersDay($year, $expected) /** * Tests translated name of International Workers' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of International Workers' Day. * * @return array list of test dates for International Workers' Day + * @throws \Exception */ - public function InternationalWorkersDayDataProvider() + public function InternationalWorkersDayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } diff --git a/tests/France/Moselle/GoodFridayTest.php b/tests/France/Moselle/GoodFridayTest.php index cf1aa7ad8..f9ed7a834 100644 --- a/tests/France/Moselle/GoodFridayTest.php +++ b/tests/France/Moselle/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France\Moselle; @@ -25,10 +25,12 @@ class GoodFridayTest extends MoselleBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/France/Moselle/MoselleBaseTestCase.php b/tests/France/Moselle/MoselleBaseTestCase.php index 7e38b796d..83c731a03 100644 --- a/tests/France/Moselle/MoselleBaseTestCase.php +++ b/tests/France/Moselle/MoselleBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France\Moselle; @@ -25,15 +25,15 @@ abstract class MoselleBaseTestCase extends FranceBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'France/Moselle'; + public const REGION = 'France/Moselle'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Paris'; + public const TIMEZONE = 'Europe/Paris'; /** * Locale that is considered common for this provider */ - const LOCALE = 'fr_FR'; + public const LOCALE = 'fr_FR'; } diff --git a/tests/France/Moselle/MoselleTest.php b/tests/France/Moselle/MoselleTest.php index 885ffdd6e..d4b5660df 100644 --- a/tests/France/Moselle/MoselleTest.php +++ b/tests/France/Moselle/MoselleTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France\Moselle; @@ -26,8 +26,9 @@ class MoselleTest extends MoselleBaseTestCase /** * Tests if all official holidays in Moselle are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -48,32 +49,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Moselle (France) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Moselle (France) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Moselle (France) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Moselle (France) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/France/Moselle/stStephensDayTest.php b/tests/France/Moselle/stStephensDayTest.php index 2fa6a9cd1..52a0528ca 100644 --- a/tests/France/Moselle/stStephensDayTest.php +++ b/tests/France/Moselle/stStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France\Moselle; @@ -24,7 +24,7 @@ class stStephensDayTest extends MoselleBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class stStephensDayTest extends MoselleBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/France/NewYearsDayTest.php b/tests/France/NewYearsDayTest.php index ad7705809..bb12ca651 100644 --- a/tests/France/NewYearsDayTest.php +++ b/tests/France/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France; @@ -24,7 +24,7 @@ class NewYearsDayTest extends FranceBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends FranceBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/France/PentecostMondayTest.php b/tests/France/PentecostMondayTest.php index 1adcd76c2..26432f5b7 100644 --- a/tests/France/PentecostMondayTest.php +++ b/tests/France/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France; @@ -25,10 +25,12 @@ class PentecostMondayTest extends FranceBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/France/VictoryInEuropeDayTest.php b/tests/France/VictoryInEuropeDayTest.php index 56f8a94e6..a4ab98d11 100644 --- a/tests/France/VictoryInEuropeDayTest.php +++ b/tests/France/VictoryInEuropeDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\France; @@ -25,15 +25,17 @@ class VictoryInEuropeDayTest extends FranceBaseTestCase implements YasumiTestCas /** * The name of the holiday */ - const HOLIDAY = 'victoryInEuropeDay'; + public const HOLIDAY = 'victoryInEuropeDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1945; + public const ESTABLISHMENT_YEAR = 1945; /** * Tests Victory In Europe Day on or after 1945. + * @throws \Exception + * @throws \ReflectionException */ public function testVictoryInEuropeDayOnAfter1945() { @@ -48,6 +50,7 @@ public function testVictoryInEuropeDayOnAfter1945() /** * Tests Victory In Europe Day before 1945. + * @throws \ReflectionException */ public function testVictoryInEuropeDayBefore1945() { @@ -60,8 +63,9 @@ public function testVictoryInEuropeDayBefore1945() /** * Tests translated name of Victory in Europe Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Germany/AscensionDayTest.php b/tests/Germany/AscensionDayTest.php index 479df503b..532166856 100644 --- a/tests/Germany/AscensionDayTest.php +++ b/tests/Germany/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany; @@ -25,10 +25,12 @@ class AscensionDayTest extends GermanyBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Germany/BadenWurttemberg/AllSaintsDayTest.php b/tests/Germany/BadenWurttemberg/AllSaintsDayTest.php index 85bc14ea7..dc214a17f 100644 --- a/tests/Germany/BadenWurttemberg/AllSaintsDayTest.php +++ b/tests/Germany/BadenWurttemberg/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\BadenWurttemberg; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends BadenWurttembergBaseTestCase implements YasumiTes /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends BadenWurttembergBaseTestCase implements YasumiTes * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/BadenWurttemberg/BadenWurttembergBaseTestCase.php b/tests/Germany/BadenWurttemberg/BadenWurttembergBaseTestCase.php index c740549cd..1ecef8e05 100644 --- a/tests/Germany/BadenWurttemberg/BadenWurttembergBaseTestCase.php +++ b/tests/Germany/BadenWurttemberg/BadenWurttembergBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\BadenWurttemberg; @@ -25,10 +25,10 @@ abstract class BadenWurttembergBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/BadenWurttemberg'; + public const REGION = 'Germany/BadenWurttemberg'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/BadenWurttemberg/BadenWurttembergTest.php b/tests/Germany/BadenWurttemberg/BadenWurttembergTest.php index b4a50fbf9..7c7f45e6c 100644 --- a/tests/Germany/BadenWurttemberg/BadenWurttembergTest.php +++ b/tests/Germany/BadenWurttemberg/BadenWurttembergTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\BadenWurttemberg; @@ -26,17 +26,16 @@ class BadenWurttembergTest extends BadenWurttembergBaseTestCase /** * Tests if all official holidays in Baden-Württemberg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'germanUnityDay', 'christmasDay', @@ -46,32 +45,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Baden-Württemberg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Baden-Württemberg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Baden-Württemberg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Baden-Württemberg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays( ['epiphany', 'corpusChristi', 'allSaintsDay'], diff --git a/tests/Germany/BadenWurttemberg/CorpusChristiTest.php b/tests/Germany/BadenWurttemberg/CorpusChristiTest.php index 92c5f200e..72e4ba234 100644 --- a/tests/Germany/BadenWurttemberg/CorpusChristiTest.php +++ b/tests/Germany/BadenWurttemberg/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\BadenWurttemberg; @@ -27,10 +27,13 @@ class CorpusChristiTest extends BadenWurttembergBaseTestCase implements YasumiTe /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/BadenWurttemberg/EpiphanyTest.php b/tests/Germany/BadenWurttemberg/EpiphanyTest.php index a64ad03ae..8e762ba62 100644 --- a/tests/Germany/BadenWurttemberg/EpiphanyTest.php +++ b/tests/Germany/BadenWurttemberg/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\BadenWurttemberg; @@ -24,7 +24,7 @@ class EpiphanyTest extends BadenWurttembergBaseTestCase implements YasumiTestCas /** * The name of the holiday to be tested */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class EpiphanyTest extends BadenWurttembergBaseTestCase implements YasumiTestCas * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/BadenWurttemberg/GermanUnityDayTest.php b/tests/Germany/BadenWurttemberg/GermanUnityDayTest.php index 822bcc546..7d6871cdd 100644 --- a/tests/Germany/BadenWurttemberg/GermanUnityDayTest.php +++ b/tests/Germany/BadenWurttemberg/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\BadenWurttemberg; diff --git a/tests/Germany/BadenWurttemberg/ReformationDay2017Test.php b/tests/Germany/BadenWurttemberg/ReformationDay2017Test.php index 8f0e2a156..f940065e9 100644 --- a/tests/Germany/BadenWurttemberg/ReformationDay2017Test.php +++ b/tests/Germany/BadenWurttemberg/ReformationDay2017Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\BadenWurttemberg; diff --git a/tests/Germany/Bavaria/AllSaintsDayTest.php b/tests/Germany/Bavaria/AllSaintsDayTest.php index c58b14fbf..d85bec9c7 100644 --- a/tests/Germany/Bavaria/AllSaintsDayTest.php +++ b/tests/Germany/Bavaria/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Bavaria; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends BavariaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends BavariaBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/Bavaria/BavariaBaseTestCase.php b/tests/Germany/Bavaria/BavariaBaseTestCase.php index 653eda7ef..6be212e4c 100644 --- a/tests/Germany/Bavaria/BavariaBaseTestCase.php +++ b/tests/Germany/Bavaria/BavariaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Bavaria; @@ -25,10 +25,10 @@ abstract class BavariaBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/Bavaria'; + public const REGION = 'Germany/Bavaria'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/Bavaria/BavariaTest.php b/tests/Germany/Bavaria/BavariaTest.php index 1c942fdf4..bc5c530bc 100644 --- a/tests/Germany/Bavaria/BavariaTest.php +++ b/tests/Germany/Bavaria/BavariaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Bavaria; @@ -26,17 +26,16 @@ class BavariaTest extends BavariaBaseTestCase /** * Tests if all official holidays in Bavaria (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'germanUnityDay', 'christmasDay', @@ -46,32 +45,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Bavaria (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Bavaria (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Bavaria (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Bavaria (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays( ['epiphany', 'corpusChristi', 'allSaintsDay'], diff --git a/tests/Germany/Bavaria/CorpusChristiTest.php b/tests/Germany/Bavaria/CorpusChristiTest.php index 58667bc43..656c9cc7e 100644 --- a/tests/Germany/Bavaria/CorpusChristiTest.php +++ b/tests/Germany/Bavaria/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Bavaria; @@ -27,10 +27,13 @@ class CorpusChristiTest extends BavariaBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/Bavaria/EpiphanyTest.php b/tests/Germany/Bavaria/EpiphanyTest.php index d8f6fa18c..da1a37750 100644 --- a/tests/Germany/Bavaria/EpiphanyTest.php +++ b/tests/Germany/Bavaria/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Bavaria; @@ -24,7 +24,7 @@ class EpiphanyTest extends BavariaBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday to be tested */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** @@ -34,6 +34,8 @@ class EpiphanyTest extends BavariaBaseTestCase implements YasumiTestCaseInterfac * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -44,16 +46,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -65,8 +69,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/Bavaria/GermanUnityDayTest.php b/tests/Germany/Bavaria/GermanUnityDayTest.php index 3443bef00..7c1f7b9df 100644 --- a/tests/Germany/Bavaria/GermanUnityDayTest.php +++ b/tests/Germany/Bavaria/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Bavaria; diff --git a/tests/Germany/Bavaria/ReformationDay2017Test.php b/tests/Germany/Bavaria/ReformationDay2017Test.php index 90b959a60..8071a4934 100644 --- a/tests/Germany/Bavaria/ReformationDay2017Test.php +++ b/tests/Germany/Bavaria/ReformationDay2017Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Bavaria; diff --git a/tests/Germany/Berlin/BerlinBaseTestCase.php b/tests/Germany/Berlin/BerlinBaseTestCase.php index ab8372d82..74c71edbd 100644 --- a/tests/Germany/Berlin/BerlinBaseTestCase.php +++ b/tests/Germany/Berlin/BerlinBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Berlin; @@ -25,10 +25,10 @@ abstract class BerlinBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/Berlin'; + public const REGION = 'Germany/Berlin'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/Berlin/BerlinTest.php b/tests/Germany/Berlin/BerlinTest.php index 5e8b886dc..1b8c24d91 100644 --- a/tests/Germany/Berlin/BerlinTest.php +++ b/tests/Germany/Berlin/BerlinTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Berlin; @@ -26,17 +26,16 @@ class BerlinTest extends BerlinBaseTestCase /** * Tests if all official holidays in Berlin (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'germanUnityDay', 'christmasDay', @@ -46,32 +45,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Berlin (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Berlin (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Berlin (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Berlin (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Germany/Berlin/GermanUnityDayTest.php b/tests/Germany/Berlin/GermanUnityDayTest.php index 713c0822d..9e80f50d3 100644 --- a/tests/Germany/Berlin/GermanUnityDayTest.php +++ b/tests/Germany/Berlin/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Berlin; diff --git a/tests/Germany/Berlin/ReformationDay2017Test.php b/tests/Germany/Berlin/ReformationDay2017Test.php index 973b85aa3..b178bd47a 100644 --- a/tests/Germany/Berlin/ReformationDay2017Test.php +++ b/tests/Germany/Berlin/ReformationDay2017Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Berlin; diff --git a/tests/Germany/Brandenburg/BrandenburgBaseTestCase.php b/tests/Germany/Brandenburg/BrandenburgBaseTestCase.php index 9f3437a34..d45926843 100644 --- a/tests/Germany/Brandenburg/BrandenburgBaseTestCase.php +++ b/tests/Germany/Brandenburg/BrandenburgBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Brandenburg; @@ -25,10 +25,10 @@ abstract class BrandenburgBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/Brandenburg'; + public const REGION = 'Germany/Brandenburg'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/Brandenburg/BrandenburgTest.php b/tests/Germany/Brandenburg/BrandenburgTest.php index a6fd677a2..06ec34f28 100644 --- a/tests/Germany/Brandenburg/BrandenburgTest.php +++ b/tests/Germany/Brandenburg/BrandenburgTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Brandenburg; @@ -26,8 +26,9 @@ class BrandenburgTest extends BrandenburgBaseTestCase /** * Tests if all official holidays in Brandenburg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $holidays = [ 'newYearsDay', @@ -55,32 +56,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Brandenburg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Brandenburg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Brandenburg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Brandenburg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Germany/Brandenburg/GermanUnityDayTest.php b/tests/Germany/Brandenburg/GermanUnityDayTest.php index 44bdf4a25..3dbec6fa4 100644 --- a/tests/Germany/Brandenburg/GermanUnityDayTest.php +++ b/tests/Germany/Brandenburg/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Brandenburg; diff --git a/tests/Germany/Brandenburg/ReformationDayTest.php b/tests/Germany/Brandenburg/ReformationDayTest.php index 7b3c7220b..f7a2c5f5e 100644 --- a/tests/Germany/Brandenburg/ReformationDayTest.php +++ b/tests/Germany/Brandenburg/ReformationDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Brandenburg; @@ -25,12 +25,12 @@ class ReformationDayTest extends BrandenburgBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'reformationDay'; + public const HOLIDAY = 'reformationDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1517; + public const ESTABLISHMENT_YEAR = 1517; /** * Tests the holiday defined in this test. @@ -39,6 +39,8 @@ class ReformationDayTest extends BrandenburgBaseTestCase implements YasumiTestCa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -49,8 +51,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -64,6 +67,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -76,8 +80,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -89,8 +94,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Germany/Bremen/BremenBaseTestCase.php b/tests/Germany/Bremen/BremenBaseTestCase.php index 2f2d0d7e3..fac3179fa 100644 --- a/tests/Germany/Bremen/BremenBaseTestCase.php +++ b/tests/Germany/Bremen/BremenBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Bremen; @@ -25,10 +25,10 @@ abstract class BremenBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/Bremen'; + public const REGION = 'Germany/Bremen'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/Bremen/BremenTest.php b/tests/Germany/Bremen/BremenTest.php index eee6fce72..a0a135033 100644 --- a/tests/Germany/Bremen/BremenTest.php +++ b/tests/Germany/Bremen/BremenTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Bremen; @@ -26,17 +26,16 @@ class BremenTest extends BremenBaseTestCase /** * Tests if all official holidays in Bremen (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'germanUnityDay', 'christmasDay', @@ -46,32 +45,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Bremen (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Bremen (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Bremen (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Bremen (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Germany/Bremen/GermanUnityDayTest.php b/tests/Germany/Bremen/GermanUnityDayTest.php index dbcbd8fa8..48826be70 100644 --- a/tests/Germany/Bremen/GermanUnityDayTest.php +++ b/tests/Germany/Bremen/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Bremen; diff --git a/tests/Germany/Bremen/ReformationDay2017Test.php b/tests/Germany/Bremen/ReformationDay2017Test.php index f73b8673b..c1c13bfc0 100644 --- a/tests/Germany/Bremen/ReformationDay2017Test.php +++ b/tests/Germany/Bremen/ReformationDay2017Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Bremen; diff --git a/tests/Germany/Bremen/ReformationDayTest.php b/tests/Germany/Bremen/ReformationDayTest.php new file mode 100644 index 000000000..0e1ab75c2 --- /dev/null +++ b/tests/Germany/Bremen/ReformationDayTest.php @@ -0,0 +1,108 @@ + + */ + +namespace Yasumi\tests\Germany\Bremen; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Reformation Day in Bremen (Germany). + */ +class ReformationDayTest extends BremenBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested + */ + public const HOLIDAY = 'reformationDay'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 2018; + + /** + * Tests the holiday defined in this test. + * + * @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 + * + * @throws \ReflectionException + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + $data = []; + + for ($y = 0; $y < self::TEST_ITERATIONS; $y++) { + $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $data[] = [$year, new DateTime("$year-10-31", new DateTimeZone(self::TIMEZONE))]; + } + + return $data; + } + + /** + * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException + */ + public function testHolidayBeforeEstablishment() + { + $this->assertNotHoliday( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + ); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Reformationstag'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Germany/ChristmasTest.php b/tests/Germany/ChristmasTest.php index 764b49a1c..fe9b6f773 100644 --- a/tests/Germany/ChristmasTest.php +++ b/tests/Germany/ChristmasTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany; @@ -24,7 +24,7 @@ class ChristmasTest extends GermanyBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasTest extends GermanyBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Germany/EasterMondayTest.php b/tests/Germany/EasterMondayTest.php index 446794e74..56eefe6fc 100644 --- a/tests/Germany/EasterMondayTest.php +++ b/tests/Germany/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany; @@ -25,10 +25,12 @@ class EasterMondayTest extends GermanyBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Germany/GermanUnityDayTest.php b/tests/Germany/GermanUnityDayTest.php index b2d7df656..70f3350ae 100644 --- a/tests/Germany/GermanUnityDayTest.php +++ b/tests/Germany/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany; @@ -25,15 +25,17 @@ class GermanUnityDayTest extends GermanyBaseTestCase implements YasumiTestCaseIn /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1990; + public const ESTABLISHMENT_YEAR = 1990; /** * The name of the holiday */ - const HOLIDAY = 'germanUnityDay'; + public const HOLIDAY = 'germanUnityDay'; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Germany/GermanyBaseTestCase.php b/tests/Germany/GermanyBaseTestCase.php index 1f43e743d..f4ca1c67d 100644 --- a/tests/Germany/GermanyBaseTestCase.php +++ b/tests/Germany/GermanyBaseTestCase.php @@ -2,43 +2,43 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Germany holiday provider. */ -abstract class GermanyBaseTestCase extends PHPUnit_Framework_TestCase +abstract class GermanyBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany'; + public const REGION = 'Germany'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_DE'; + public const LOCALE = 'de_DE'; /** * Number of iterations to be used for the various unit tests of this provider */ - const TEST_ITERATIONS = 50; + public const TEST_ITERATIONS = 50; } diff --git a/tests/Germany/GermanyTest.php b/tests/Germany/GermanyTest.php index 04aa79210..3eff63ad5 100644 --- a/tests/Germany/GermanyTest.php +++ b/tests/Germany/GermanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany; @@ -26,8 +26,9 @@ class GermanyTest extends GermanyBaseTestCase /** * Tests if all official holidays in Finland are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'ascensionDay', @@ -44,32 +45,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Germany are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Germany are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Germany are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Germany are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Germany/GoodFridayTest.php b/tests/Germany/GoodFridayTest.php index 1448a18e3..13ddfaf2d 100644 --- a/tests/Germany/GoodFridayTest.php +++ b/tests/Germany/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany; @@ -25,10 +25,12 @@ class GoodFridayTest extends GermanyBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests Good Friday. + * @throws \Exception + * @throws \ReflectionException */ public function testGoodFriday() { @@ -43,8 +45,9 @@ public function testGoodFriday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Germany/Hamburg/DayOfReformationTest.php b/tests/Germany/Hamburg/DayOfReformationTest.php new file mode 100644 index 000000000..4fa53ac0f --- /dev/null +++ b/tests/Germany/Hamburg/DayOfReformationTest.php @@ -0,0 +1,108 @@ + + */ + +namespace Yasumi\tests\Germany\Hamburg; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Reformation Day in Hamburg (Germany). + */ +class DayOfReformationTest extends HamburgBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested + */ + public const HOLIDAY = 'dayOfReformation'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 2018; + + /** + * Tests the holiday defined in this test. + * + * @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 + * + * @throws \ReflectionException + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + $data = []; + + for ($y = 0; $y < self::TEST_ITERATIONS; $y++) { + $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $data[] = [$year, new DateTime("$year-10-31", new DateTimeZone(self::TIMEZONE))]; + } + + return $data; + } + + /** + * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException + */ + public function testHolidayBeforeEstablishment() + { + $this->assertNotHoliday( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + ); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Tag der Reformation'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Germany/Hamburg/GermanUnityDay.php b/tests/Germany/Hamburg/GermanUnityDay.php index 44e080cd5..35b039d00 100644 --- a/tests/Germany/Hamburg/GermanUnityDay.php +++ b/tests/Germany/Hamburg/GermanUnityDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Hamburg; diff --git a/tests/Germany/Hamburg/HamburgBaseTestCase.php b/tests/Germany/Hamburg/HamburgBaseTestCase.php index 68d10a6ec..9277a38aa 100644 --- a/tests/Germany/Hamburg/HamburgBaseTestCase.php +++ b/tests/Germany/Hamburg/HamburgBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Hamburg; @@ -25,10 +25,10 @@ abstract class HamburgBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/Hamburg'; + public const REGION = 'Germany/Hamburg'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/Hamburg/HamburgTest.php b/tests/Germany/Hamburg/HamburgTest.php index 3accdaf9e..776f967c1 100644 --- a/tests/Germany/Hamburg/HamburgTest.php +++ b/tests/Germany/Hamburg/HamburgTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Hamburg; @@ -26,17 +26,16 @@ class HamburgTest extends HamburgBaseTestCase /** * Tests if all official holidays in Hamburg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'germanUnityDay', 'christmasDay', @@ -46,32 +45,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Hamburg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Hamburg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Hamburg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Hamburg (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Germany/Hamburg/ReformationDay2017Test.php b/tests/Germany/Hamburg/ReformationDay2017Test.php index 0109ad4ac..c1df5becc 100644 --- a/tests/Germany/Hamburg/ReformationDay2017Test.php +++ b/tests/Germany/Hamburg/ReformationDay2017Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Hamburg; diff --git a/tests/Germany/Hesse/CorpusChristiTest.php b/tests/Germany/Hesse/CorpusChristiTest.php index bad0981ad..bce107e49 100644 --- a/tests/Germany/Hesse/CorpusChristiTest.php +++ b/tests/Germany/Hesse/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Hesse; @@ -27,10 +27,13 @@ class CorpusChristiTest extends HesseBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/Hesse/GermanUnityDayTest.php b/tests/Germany/Hesse/GermanUnityDayTest.php index c7187324f..367dc9374 100644 --- a/tests/Germany/Hesse/GermanUnityDayTest.php +++ b/tests/Germany/Hesse/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Hesse; diff --git a/tests/Germany/Hesse/HesseBaseTestCase.php b/tests/Germany/Hesse/HesseBaseTestCase.php index 51908b074..370fc7195 100644 --- a/tests/Germany/Hesse/HesseBaseTestCase.php +++ b/tests/Germany/Hesse/HesseBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Hesse; @@ -25,10 +25,10 @@ abstract class HesseBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/Hesse'; + public const REGION = 'Germany/Hesse'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/Hesse/HesseTest.php b/tests/Germany/Hesse/HesseTest.php index c344a98b5..fa7ae8ec9 100644 --- a/tests/Germany/Hesse/HesseTest.php +++ b/tests/Germany/Hesse/HesseTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Hesse; @@ -26,17 +26,16 @@ class HesseTest extends HesseBaseTestCase /** * Tests if all official holidays in Hesse (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'germanUnityDay', 'christmasDay', @@ -46,32 +45,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Hesse (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Hesse (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Hesse (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Hesse (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['corpusChristi'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Germany/Hesse/ReformationDay2017Test.php b/tests/Germany/Hesse/ReformationDay2017Test.php index 0a5d0a37f..2c56cd7d2 100644 --- a/tests/Germany/Hesse/ReformationDay2017Test.php +++ b/tests/Germany/Hesse/ReformationDay2017Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Hesse; diff --git a/tests/Germany/InternationalWorkersDayTest.php b/tests/Germany/InternationalWorkersDayTest.php index 4bc69df80..e5e6af22b 100644 --- a/tests/Germany/InternationalWorkersDayTest.php +++ b/tests/Germany/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends GermanyBaseTestCase implements YasumiT /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests International Workers' Day. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends GermanyBaseTestCase implements YasumiT * * @param int $year the year for which International Workers' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -41,8 +43,9 @@ public function testHoliday($year, $expected) /** * Tests translated name of International Workers' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } diff --git a/tests/Germany/LowerSaxony/GermanUnityDayTest.php b/tests/Germany/LowerSaxony/GermanUnityDayTest.php index 5c1afd7a5..41e28b4bd 100644 --- a/tests/Germany/LowerSaxony/GermanUnityDayTest.php +++ b/tests/Germany/LowerSaxony/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\LowerSaxony; diff --git a/tests/Germany/LowerSaxony/LowerSaxonyBaseTestCase.php b/tests/Germany/LowerSaxony/LowerSaxonyBaseTestCase.php index 1de1fde1f..52914be26 100644 --- a/tests/Germany/LowerSaxony/LowerSaxonyBaseTestCase.php +++ b/tests/Germany/LowerSaxony/LowerSaxonyBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\LowerSaxony; @@ -25,10 +25,10 @@ abstract class LowerSaxonyBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/LowerSaxony'; + public const REGION = 'Germany/LowerSaxony'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/LowerSaxony/LowerSaxonyTest.php b/tests/Germany/LowerSaxony/LowerSaxonyTest.php index 1010e377c..a3bc6a710 100644 --- a/tests/Germany/LowerSaxony/LowerSaxonyTest.php +++ b/tests/Germany/LowerSaxony/LowerSaxonyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\LowerSaxony; @@ -26,17 +26,16 @@ class LowerSaxonyTest extends LowerSaxonyBaseTestCase /** * Tests if all official holidays in Lower Saxony (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'germanUnityDay', 'christmasDay', @@ -46,32 +45,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Lower Saxony (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Lower Saxony (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Lower Saxony (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Lower Saxony (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Germany/LowerSaxony/ReformationDay2017Test.php b/tests/Germany/LowerSaxony/ReformationDay2017Test.php index 4535c8668..143e4f3fb 100644 --- a/tests/Germany/LowerSaxony/ReformationDay2017Test.php +++ b/tests/Germany/LowerSaxony/ReformationDay2017Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\LowerSaxony; diff --git a/tests/Germany/LowerSaxony/ReformationDayTest.php b/tests/Germany/LowerSaxony/ReformationDayTest.php new file mode 100644 index 000000000..bdac6f83d --- /dev/null +++ b/tests/Germany/LowerSaxony/ReformationDayTest.php @@ -0,0 +1,108 @@ + + */ + +namespace Yasumi\tests\Germany\LowerSaxony; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Reformation Day in Lower Saxony (Germany). + */ +class ReformationDayTest extends LowerSaxonyBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested + */ + public const HOLIDAY = 'reformationDay'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 2018; + + /** + * Tests the holiday defined in this test. + * + * @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 + * + * @throws \ReflectionException + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + $data = []; + + for ($y = 0; $y < self::TEST_ITERATIONS; $y++) { + $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $data[] = [$year, new DateTime("$year-10-31", new DateTimeZone(self::TIMEZONE))]; + } + + return $data; + } + + /** + * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException + */ + public function testHolidayBeforeEstablishment() + { + $this->assertNotHoliday( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + ); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Reformationstag'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Germany/MecklenburgWesternPomerania/GermanUnityDayTest.php b/tests/Germany/MecklenburgWesternPomerania/GermanUnityDayTest.php index 5cb09cb60..95d0c5c1c 100644 --- a/tests/Germany/MecklenburgWesternPomerania/GermanUnityDayTest.php +++ b/tests/Germany/MecklenburgWesternPomerania/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\MecklenburgWesternPomerania; diff --git a/tests/Germany/MecklenburgWesternPomerania/MecklenburgWesternPomeraniaBaseTestCase.php b/tests/Germany/MecklenburgWesternPomerania/MecklenburgWesternPomeraniaBaseTestCase.php index f9eee7f04..fd3f42a59 100644 --- a/tests/Germany/MecklenburgWesternPomerania/MecklenburgWesternPomeraniaBaseTestCase.php +++ b/tests/Germany/MecklenburgWesternPomerania/MecklenburgWesternPomeraniaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\MecklenburgWesternPomerania; @@ -25,10 +25,10 @@ abstract class MecklenburgWesternPomeraniaBaseTestCase extends GermanyBaseTestCa /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/MecklenburgWesternPomerania'; + public const REGION = 'Germany/MecklenburgWesternPomerania'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/MecklenburgWesternPomerania/MecklenburgWesternPomeraniaTest.php b/tests/Germany/MecklenburgWesternPomerania/MecklenburgWesternPomeraniaTest.php index 49c4bd424..cd529dae6 100644 --- a/tests/Germany/MecklenburgWesternPomerania/MecklenburgWesternPomeraniaTest.php +++ b/tests/Germany/MecklenburgWesternPomerania/MecklenburgWesternPomeraniaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\MecklenburgWesternPomerania; @@ -26,17 +26,16 @@ class MecklenburgWesternPomeraniaTest extends MecklenburgWesternPomeraniaBaseTes /** * Tests if all official holidays in Mecklenburg-Western Pomerania (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $holidays = [ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'christmasDay', 'secondChristmasDay' @@ -55,32 +54,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Mecklenburg-Western Pomerania (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Mecklenburg-Western Pomerania (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Mecklenburg-Western Pomerania (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Mecklenburg-Western Pomerania (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Germany/MecklenburgWesternPomerania/ReformationDayTest.php b/tests/Germany/MecklenburgWesternPomerania/ReformationDayTest.php index 7517bb4b1..5c81764c6 100644 --- a/tests/Germany/MecklenburgWesternPomerania/ReformationDayTest.php +++ b/tests/Germany/MecklenburgWesternPomerania/ReformationDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\MecklenburgWesternPomerania; @@ -25,19 +25,20 @@ class ReformationDayTest extends MecklenburgWesternPomeraniaBaseTestCase impleme /** * The name of the holiday to be tested */ - const HOLIDAY = 'reformationDay'; + public const HOLIDAY = 'reformationDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1517; + public const ESTABLISHMENT_YEAR = 1517; /** * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -51,6 +52,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -63,8 +65,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -76,8 +79,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Germany/NewYearsDayTest.php b/tests/Germany/NewYearsDayTest.php index 8054430ba..5a0c6a8d6 100644 --- a/tests/Germany/NewYearsDayTest.php +++ b/tests/Germany/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany; @@ -24,7 +24,7 @@ class NewYearsDayTest extends GermanyBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends GermanyBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Germany/NorthRhineWestphalia/AllSaintsDayTest.php b/tests/Germany/NorthRhineWestphalia/AllSaintsDayTest.php index e887eac70..067e7074f 100644 --- a/tests/Germany/NorthRhineWestphalia/AllSaintsDayTest.php +++ b/tests/Germany/NorthRhineWestphalia/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\NorthRhineWestphalia; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends NorthRhineWestphaliaBaseTestCase implements Yasum /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends NorthRhineWestphaliaBaseTestCase implements Yasum * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/NorthRhineWestphalia/CorpusChristiTest.php b/tests/Germany/NorthRhineWestphalia/CorpusChristiTest.php index 7c34bbac4..c1e4f7748 100644 --- a/tests/Germany/NorthRhineWestphalia/CorpusChristiTest.php +++ b/tests/Germany/NorthRhineWestphalia/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\NorthRhineWestphalia; @@ -27,10 +27,13 @@ class CorpusChristiTest extends NorthRhineWestphaliaBaseTestCase implements Yasu /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/NorthRhineWestphalia/GermanUnityDayTest.php b/tests/Germany/NorthRhineWestphalia/GermanUnityDayTest.php index 4aab1357d..f8caa2ebf 100644 --- a/tests/Germany/NorthRhineWestphalia/GermanUnityDayTest.php +++ b/tests/Germany/NorthRhineWestphalia/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\NorthRhineWestphalia; diff --git a/tests/Germany/NorthRhineWestphalia/NorthRhineWestphaliaBaseTestCase.php b/tests/Germany/NorthRhineWestphalia/NorthRhineWestphaliaBaseTestCase.php index deaaa4de0..03442f811 100644 --- a/tests/Germany/NorthRhineWestphalia/NorthRhineWestphaliaBaseTestCase.php +++ b/tests/Germany/NorthRhineWestphalia/NorthRhineWestphaliaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\NorthRhineWestphalia; @@ -25,10 +25,10 @@ abstract class NorthRhineWestphaliaBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/NorthRhineWestphalia'; + public const REGION = 'Germany/NorthRhineWestphalia'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/NorthRhineWestphalia/NorthRhineWestphaliaTest.php b/tests/Germany/NorthRhineWestphalia/NorthRhineWestphaliaTest.php index 0b8a59a6c..89c94f508 100644 --- a/tests/Germany/NorthRhineWestphalia/NorthRhineWestphaliaTest.php +++ b/tests/Germany/NorthRhineWestphalia/NorthRhineWestphaliaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\NorthRhineWestphalia; @@ -26,17 +26,16 @@ class NorthRhineWestphaliaTest extends NorthRhineWestphaliaBaseTestCase /** * Tests if all official holidays in North Rhine-Westphalia (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'germanUnityDay', 'christmasDay', @@ -46,32 +45,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in North Rhine-Westphalia (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in North Rhine-Westphalia (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in North Rhine-Westphalia (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in North Rhine-Westphalia (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['corpusChristi', 'allSaintsDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Germany/NorthRhineWestphalia/ReformationDay2017Test.php b/tests/Germany/NorthRhineWestphalia/ReformationDay2017Test.php index e27952427..4c9fffdc5 100644 --- a/tests/Germany/NorthRhineWestphalia/ReformationDay2017Test.php +++ b/tests/Germany/NorthRhineWestphalia/ReformationDay2017Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\NorthRhineWestphalia; diff --git a/tests/Germany/PentecostMondayTest.php b/tests/Germany/PentecostMondayTest.php index f881f919b..419c9b446 100644 --- a/tests/Germany/PentecostMondayTest.php +++ b/tests/Germany/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany; @@ -25,10 +25,12 @@ class PentecostMondayTest extends GermanyBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Germany/ReformationDay2017Test.php b/tests/Germany/ReformationDay2017Test.php index d03aa5492..60ced0dba 100644 --- a/tests/Germany/ReformationDay2017Test.php +++ b/tests/Germany/ReformationDay2017Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany; @@ -25,15 +25,17 @@ class ReformationDay2017Test extends GermanyBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'reformationDay'; + public const HOLIDAY = 'reformationDay'; /** * The year in which the holiday was established */ - const ESTABLISHMENT_YEAR = 2017; + public const ESTABLISHMENT_YEAR = 2017; /** * Test the holiday defined in this test upon establishment + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnEstablishment() { @@ -47,6 +49,7 @@ public function testHolidayOnEstablishment() /** * Test the holiday defined in this test before establishment + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -59,6 +62,7 @@ public function testHolidayBeforeEstablishment() /** * Test the holiday defined in this test after completion + * @throws \ReflectionException */ public function testHolidayAfterCompletion() { @@ -67,8 +71,9 @@ public function testHolidayAfterCompletion() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -80,8 +85,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Germany/RhinelandPalatinate/AllSaintsDayTest.php b/tests/Germany/RhinelandPalatinate/AllSaintsDayTest.php index 6e3ea3d56..f00ce5b30 100644 --- a/tests/Germany/RhinelandPalatinate/AllSaintsDayTest.php +++ b/tests/Germany/RhinelandPalatinate/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\RhinelandPalatinate; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends RhinelandPalatinateBaseTestCase implements Yasumi /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends RhinelandPalatinateBaseTestCase implements Yasumi * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/RhinelandPalatinate/CorpusChristiTest.php b/tests/Germany/RhinelandPalatinate/CorpusChristiTest.php index 1ba2b3b1a..449794c87 100644 --- a/tests/Germany/RhinelandPalatinate/CorpusChristiTest.php +++ b/tests/Germany/RhinelandPalatinate/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\RhinelandPalatinate; @@ -27,10 +27,13 @@ class CorpusChristiTest extends RhinelandPalatinateBaseTestCase implements Yasum /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/RhinelandPalatinate/GermanUnityDayTest.php b/tests/Germany/RhinelandPalatinate/GermanUnityDayTest.php index cad001a61..d45c8c9dd 100644 --- a/tests/Germany/RhinelandPalatinate/GermanUnityDayTest.php +++ b/tests/Germany/RhinelandPalatinate/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\RhinelandPalatinate; diff --git a/tests/Germany/RhinelandPalatinate/ReformationDay2017Test.php b/tests/Germany/RhinelandPalatinate/ReformationDay2017Test.php index b8fcb99df..620352673 100644 --- a/tests/Germany/RhinelandPalatinate/ReformationDay2017Test.php +++ b/tests/Germany/RhinelandPalatinate/ReformationDay2017Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\RhinelandPalatinate; diff --git a/tests/Germany/RhinelandPalatinate/RhinelandPalatinateBaseTestCase.php b/tests/Germany/RhinelandPalatinate/RhinelandPalatinateBaseTestCase.php index f9f4e71f3..9aa231be0 100644 --- a/tests/Germany/RhinelandPalatinate/RhinelandPalatinateBaseTestCase.php +++ b/tests/Germany/RhinelandPalatinate/RhinelandPalatinateBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\RhinelandPalatinate; @@ -25,10 +25,10 @@ abstract class RhinelandPalatinateBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/RhinelandPalatinate'; + public const REGION = 'Germany/RhinelandPalatinate'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/RhinelandPalatinate/RhinelandPalatinateTest.php b/tests/Germany/RhinelandPalatinate/RhinelandPalatinateTest.php index ccd760ac5..db9ec4544 100644 --- a/tests/Germany/RhinelandPalatinate/RhinelandPalatinateTest.php +++ b/tests/Germany/RhinelandPalatinate/RhinelandPalatinateTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\RhinelandPalatinate; @@ -26,17 +26,16 @@ class RhinelandPalatinateTest extends RhinelandPalatinateBaseTestCase /** * Tests if all official holidays in Rhineland Palatinate (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'germanUnityDay', 'christmasDay', @@ -46,32 +45,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Rhineland Palatinate (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Rhineland Palatinate (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Rhineland Palatinate (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Rhineland Palatinate (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['corpusChristi', 'allSaintsDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Germany/Saarland/AllSaintsDayTest.php b/tests/Germany/Saarland/AllSaintsDayTest.php index 38860d38d..dbf289179 100644 --- a/tests/Germany/Saarland/AllSaintsDayTest.php +++ b/tests/Germany/Saarland/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Saarland; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends SaarlandBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends SaarlandBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/Saarland/AssumptionOfMaryTest.php b/tests/Germany/Saarland/AssumptionOfMaryTest.php index 817bb3975..33d8ca259 100644 --- a/tests/Germany/Saarland/AssumptionOfMaryTest.php +++ b/tests/Germany/Saarland/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Saarland; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends SaarlandBaseTestCase implements YasumiTestCas /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends SaarlandBaseTestCase implements YasumiTestCas * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } /** * Tests translated name of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/Saarland/CorpusChristiTest.php b/tests/Germany/Saarland/CorpusChristiTest.php index dcfdcd107..bdde9c41f 100644 --- a/tests/Germany/Saarland/CorpusChristiTest.php +++ b/tests/Germany/Saarland/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Saarland; @@ -27,10 +27,13 @@ class CorpusChristiTest extends SaarlandBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/Saarland/GermanUnityDayTest.php b/tests/Germany/Saarland/GermanUnityDayTest.php index 60f61ba9c..ab2d184e0 100644 --- a/tests/Germany/Saarland/GermanUnityDayTest.php +++ b/tests/Germany/Saarland/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Saarland; diff --git a/tests/Germany/Saarland/ReformationDay2017Test.php b/tests/Germany/Saarland/ReformationDay2017Test.php index 0d54e180e..f3ad74089 100644 --- a/tests/Germany/Saarland/ReformationDay2017Test.php +++ b/tests/Germany/Saarland/ReformationDay2017Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Saarland; diff --git a/tests/Germany/Saarland/SaarlandBaseTestCase.php b/tests/Germany/Saarland/SaarlandBaseTestCase.php index 95dd3991c..c3e62361f 100644 --- a/tests/Germany/Saarland/SaarlandBaseTestCase.php +++ b/tests/Germany/Saarland/SaarlandBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Saarland; @@ -25,10 +25,10 @@ abstract class SaarlandBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/Saarland'; + public const REGION = 'Germany/Saarland'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/Saarland/SaarlandTest.php b/tests/Germany/Saarland/SaarlandTest.php index fd5de7d58..8cc7a81d7 100644 --- a/tests/Germany/Saarland/SaarlandTest.php +++ b/tests/Germany/Saarland/SaarlandTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Saarland; @@ -26,17 +26,16 @@ class SaarlandTest extends SaarlandBaseTestCase /** * Tests if all official holidays in Saarland (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'germanUnityDay', 'christmasDay', @@ -46,32 +45,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Saarland (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Saarland (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Saarland (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Saarland (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([ 'corpusChristi', diff --git a/tests/Germany/Saxony/GermanUnityDayTest.php b/tests/Germany/Saxony/GermanUnityDayTest.php index c3155aa1e..9ba811cc5 100644 --- a/tests/Germany/Saxony/GermanUnityDayTest.php +++ b/tests/Germany/Saxony/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Saxony; diff --git a/tests/Germany/Saxony/ReformationDayTest.php b/tests/Germany/Saxony/ReformationDayTest.php index b1e451cf1..571dcde52 100644 --- a/tests/Germany/Saxony/ReformationDayTest.php +++ b/tests/Germany/Saxony/ReformationDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Saxony; @@ -25,12 +25,12 @@ class ReformationDayTest extends SaxonyBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'reformationDay'; + public const HOLIDAY = 'reformationDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1517; + public const ESTABLISHMENT_YEAR = 1517; /** * Tests the holiday defined in this test. @@ -39,6 +39,8 @@ class ReformationDayTest extends SaxonyBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -49,8 +51,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -64,6 +67,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -76,8 +80,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -89,8 +94,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Germany/Saxony/RepentanceAndPrayerDayTest.php b/tests/Germany/Saxony/RepentanceAndPrayerDayTest.php index 52edc2959..cf33667d4 100644 --- a/tests/Germany/Saxony/RepentanceAndPrayerDayTest.php +++ b/tests/Germany/Saxony/RepentanceAndPrayerDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Saxony; @@ -30,15 +30,17 @@ class RepentanceAndPrayerDayTest extends SaxonyBaseTestCase implements YasumiTes /** * The name of the holiday to be tested */ - const HOLIDAY = 'repentanceAndPrayerDay'; + public const HOLIDAY = 'repentanceAndPrayerDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1995; + public const ESTABLISHMENT_YEAR = 1995; /** * Tests the holiday defined in this test on or after establishment. + * @throws \ReflectionException + * @throws \Exception */ public function testHolidayOnAfterEstablishment() { @@ -56,6 +58,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -68,8 +71,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -81,8 +85,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Germany/Saxony/SaxonyBaseTestCase.php b/tests/Germany/Saxony/SaxonyBaseTestCase.php index 06b2ef37b..7bf7266bd 100644 --- a/tests/Germany/Saxony/SaxonyBaseTestCase.php +++ b/tests/Germany/Saxony/SaxonyBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Saxony; @@ -25,10 +25,10 @@ abstract class SaxonyBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/Saxony'; + public const REGION = 'Germany/Saxony'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/Saxony/SaxonyTest.php b/tests/Germany/Saxony/SaxonyTest.php index 6e3095fe9..bdea0fe4d 100644 --- a/tests/Germany/Saxony/SaxonyTest.php +++ b/tests/Germany/Saxony/SaxonyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Saxony; @@ -26,17 +26,16 @@ class SaxonyTest extends SaxonyBaseTestCase /** * Tests if all official holidays in Saxony (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $holidays = [ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'christmasDay', 'secondChristmasDay' @@ -59,32 +58,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Saxony (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Saxony (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Saxony (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Saxony (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Germany/SaxonyAnhalt/EpiphanyTest.php b/tests/Germany/SaxonyAnhalt/EpiphanyTest.php index 6e4247028..84c004665 100644 --- a/tests/Germany/SaxonyAnhalt/EpiphanyTest.php +++ b/tests/Germany/SaxonyAnhalt/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\SaxonyAnhalt; @@ -24,7 +24,7 @@ class EpiphanyTest extends SaxonyAnhaltBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** @@ -34,6 +34,8 @@ class EpiphanyTest extends SaxonyAnhaltBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -44,16 +46,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -65,8 +69,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Germany/SaxonyAnhalt/GermanUnityDayTest.php b/tests/Germany/SaxonyAnhalt/GermanUnityDayTest.php index 112b5e896..c3eac7ac3 100644 --- a/tests/Germany/SaxonyAnhalt/GermanUnityDayTest.php +++ b/tests/Germany/SaxonyAnhalt/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\SaxonyAnhalt; diff --git a/tests/Germany/SaxonyAnhalt/ReformationDayTest.php b/tests/Germany/SaxonyAnhalt/ReformationDayTest.php index 9ebe99e69..142dd2cff 100644 --- a/tests/Germany/SaxonyAnhalt/ReformationDayTest.php +++ b/tests/Germany/SaxonyAnhalt/ReformationDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\SaxonyAnhalt; @@ -25,12 +25,12 @@ class ReformationDayTest extends SaxonyAnhaltBaseTestCase implements YasumiTestC /** * The name of the holiday to be tested */ - const HOLIDAY = 'reformationDay'; + public const HOLIDAY = 'reformationDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1517; + public const ESTABLISHMENT_YEAR = 1517; /** * Tests the holiday defined in this test. @@ -39,6 +39,8 @@ class ReformationDayTest extends SaxonyAnhaltBaseTestCase implements YasumiTestC * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -49,8 +51,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -64,6 +67,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -76,8 +80,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -89,8 +94,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Germany/SaxonyAnhalt/SaxonyAnhaltBaseTestCase.php b/tests/Germany/SaxonyAnhalt/SaxonyAnhaltBaseTestCase.php index 4ec054975..ccf42d107 100644 --- a/tests/Germany/SaxonyAnhalt/SaxonyAnhaltBaseTestCase.php +++ b/tests/Germany/SaxonyAnhalt/SaxonyAnhaltBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\SaxonyAnhalt; @@ -25,10 +25,10 @@ abstract class SaxonyAnhaltBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/SaxonyAnhalt'; + public const REGION = 'Germany/SaxonyAnhalt'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/SaxonyAnhalt/SaxonyAnhaltTest.php b/tests/Germany/SaxonyAnhalt/SaxonyAnhaltTest.php index 31b13194a..889c52ca1 100644 --- a/tests/Germany/SaxonyAnhalt/SaxonyAnhaltTest.php +++ b/tests/Germany/SaxonyAnhalt/SaxonyAnhaltTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\SaxonyAnhalt; @@ -26,17 +26,16 @@ class SaxonyAnhaltTest extends SaxonyAnhaltBaseTestCase /** * Tests if all official holidays in Saxony-Anhalt (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $holidays = [ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'christmasDay', 'secondChristmasDay' @@ -55,32 +54,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Saxony-Anhalt (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Saxony-Anhalt (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Saxony-Anhalt (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Saxony-Anhalt (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['epiphany'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Germany/SchleswigHolstein/GermanUnityDayTest.php b/tests/Germany/SchleswigHolstein/GermanUnityDayTest.php index 7823fde26..656b55fb0 100644 --- a/tests/Germany/SchleswigHolstein/GermanUnityDayTest.php +++ b/tests/Germany/SchleswigHolstein/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\SchleswigHolstein; diff --git a/tests/Germany/SchleswigHolstein/ReformationDay2017Test.php b/tests/Germany/SchleswigHolstein/ReformationDay2017Test.php index 5813aa459..77238cd9a 100644 --- a/tests/Germany/SchleswigHolstein/ReformationDay2017Test.php +++ b/tests/Germany/SchleswigHolstein/ReformationDay2017Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\SchleswigHolstein; diff --git a/tests/Germany/SchleswigHolstein/ReformationDayTest.php b/tests/Germany/SchleswigHolstein/ReformationDayTest.php new file mode 100644 index 000000000..8f91536c4 --- /dev/null +++ b/tests/Germany/SchleswigHolstein/ReformationDayTest.php @@ -0,0 +1,108 @@ + + */ + +namespace Yasumi\tests\Germany\SchleswigHolstein; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Reformation Day in Schleswig-Holstein (Germany). + */ +class ReformationDayTest extends SchleswigHolsteinBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested + */ + public const HOLIDAY = 'reformationDay'; + + /** + * The year in which the holiday was first established + */ + public const ESTABLISHMENT_YEAR = 2018; + + /** + * Tests the holiday defined in this test. + * + * @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 + * + * @throws \ReflectionException + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test + * + * @return array list of test dates for the holiday defined in this test + * @throws \Exception + */ + public function HolidayDataProvider(): array + { + $data = []; + + for ($y = 0; $y < self::TEST_ITERATIONS; $y++) { + $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $data[] = [$year, new DateTime("$year-10-31", new DateTimeZone(self::TIMEZONE))]; + } + + return $data; + } + + /** + * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException + */ + public function testHolidayBeforeEstablishment() + { + $this->assertNotHoliday( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + ); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Reformationstag'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws \ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Germany/SchleswigHolstein/SchleswigHolsteinBaseTestCase.php b/tests/Germany/SchleswigHolstein/SchleswigHolsteinBaseTestCase.php index f0baf68ec..bd7e3c751 100644 --- a/tests/Germany/SchleswigHolstein/SchleswigHolsteinBaseTestCase.php +++ b/tests/Germany/SchleswigHolstein/SchleswigHolsteinBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\SchleswigHolstein; @@ -25,10 +25,10 @@ abstract class SchleswigHolsteinBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/SchleswigHolstein'; + public const REGION = 'Germany/SchleswigHolstein'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/SchleswigHolstein/SchleswigHolsteinTest.php b/tests/Germany/SchleswigHolstein/SchleswigHolsteinTest.php index 8c3d59f0c..459192c8a 100644 --- a/tests/Germany/SchleswigHolstein/SchleswigHolsteinTest.php +++ b/tests/Germany/SchleswigHolstein/SchleswigHolsteinTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\SchleswigHolstein; @@ -26,17 +26,16 @@ class SchleswigHolsteinTest extends SchleswigHolsteinBaseTestCase /** * Tests if all official holidays in Schleswig-Holstein (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'germanUnityDay', 'christmasDay', @@ -46,32 +45,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Schleswig-Holstein (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Schleswig-Holstein (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Schleswig-Holstein (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Schleswig-Holstein (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Germany/SecondChristmasDayTest.php b/tests/Germany/SecondChristmasDayTest.php index 2e76049fb..552f1168e 100644 --- a/tests/Germany/SecondChristmasDayTest.php +++ b/tests/Germany/SecondChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany; @@ -24,7 +24,7 @@ class SecondChristmasDayTest extends GermanyBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class SecondChristmasDayTest extends GermanyBaseTestCase implements YasumiTestCa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Germany/Thuringia/GermanUnityDayTest.php b/tests/Germany/Thuringia/GermanUnityDayTest.php index 936e91975..b1531926c 100644 --- a/tests/Germany/Thuringia/GermanUnityDayTest.php +++ b/tests/Germany/Thuringia/GermanUnityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Thuringia; diff --git a/tests/Germany/Thuringia/ReformationDayTest.php b/tests/Germany/Thuringia/ReformationDayTest.php index 73312381e..6e639c948 100644 --- a/tests/Germany/Thuringia/ReformationDayTest.php +++ b/tests/Germany/Thuringia/ReformationDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Thuringia; @@ -25,12 +25,12 @@ class ReformationDayTest extends ThuringiaBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'reformationDay'; + public const HOLIDAY = 'reformationDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1517; + public const ESTABLISHMENT_YEAR = 1517; /** * Tests the holiday defined in this test. @@ -39,6 +39,8 @@ class ReformationDayTest extends ThuringiaBaseTestCase implements YasumiTestCase * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -49,8 +51,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -64,6 +67,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -76,8 +80,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -89,8 +94,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Germany/Thuringia/ThuringiaBaseTestCase.php b/tests/Germany/Thuringia/ThuringiaBaseTestCase.php index 74e02f2a5..a892a877d 100644 --- a/tests/Germany/Thuringia/ThuringiaBaseTestCase.php +++ b/tests/Germany/Thuringia/ThuringiaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Thuringia; @@ -25,10 +25,10 @@ abstract class ThuringiaBaseTestCase extends GermanyBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Germany/Thuringia'; + public const REGION = 'Germany/Thuringia'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Berlin'; + public const TIMEZONE = 'Europe/Berlin'; } diff --git a/tests/Germany/Thuringia/ThuringiaTest.php b/tests/Germany/Thuringia/ThuringiaTest.php index a1e812ccd..81c78832e 100644 --- a/tests/Germany/Thuringia/ThuringiaTest.php +++ b/tests/Germany/Thuringia/ThuringiaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Germany\Thuringia; @@ -26,17 +26,16 @@ class ThuringiaTest extends ThuringiaBaseTestCase /** * Tests if all official holidays in Thuringia (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $holidays = [ 'newYearsDay', 'goodFriday', - 'easter', 'easterMonday', 'internationalWorkersDay', 'ascensionDay', - 'pentecost', 'pentecostMonday', 'christmasDay', 'secondChristmasDay' @@ -55,32 +54,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Thuringia (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Thuringia (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Thuringia (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Thuringia (Germany) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Greece/AnnunciationTest.php b/tests/Greece/AnnunciationTest.php index e0c897a4c..0aa080820 100644 --- a/tests/Greece/AnnunciationTest.php +++ b/tests/Greece/AnnunciationTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -24,7 +24,7 @@ class AnnunciationTest extends GreeceBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'annunciation'; + public const HOLIDAY = 'annunciation'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AnnunciationTest extends GreeceBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(3, 25, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Greece/AscensionDayTest.php b/tests/Greece/AscensionDayTest.php index 2b6d12cec..fa9ec8b0e 100644 --- a/tests/Greece/AscensionDayTest.php +++ b/tests/Greece/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -25,10 +25,12 @@ class AscensionDayTest extends GreeceBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Greece/AssumptionOfMaryTest.php b/tests/Greece/AssumptionOfMaryTest.php index cc5db442d..c9945b051 100644 --- a/tests/Greece/AssumptionOfMaryTest.php +++ b/tests/Greece/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends GreeceBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends GreeceBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } /** * Tests translated name of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Greece/ChristmasDayTest.php b/tests/Greece/ChristmasDayTest.php index 82c88e0d1..29174fb01 100644 --- a/tests/Greece/ChristmasDayTest.php +++ b/tests/Greece/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -24,7 +24,7 @@ class ChristmasDayTest extends GreeceBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ChristmasDayTest extends GreeceBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Greece/CleanMondayTest.php b/tests/Greece/CleanMondayTest.php index 9195c9aeb..d1673df1e 100644 --- a/tests/Greece/CleanMondayTest.php +++ b/tests/Greece/CleanMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -25,10 +25,12 @@ class CleanMondayTest extends GreeceBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'cleanMonday'; + public const HOLIDAY = 'cleanMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Greece/EasterMondayTest.php b/tests/Greece/EasterMondayTest.php index cb4de001b..1122d697b 100644 --- a/tests/Greece/EasterMondayTest.php +++ b/tests/Greece/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -25,10 +25,12 @@ class EasterMondayTest extends GreeceBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Greece/EasterTest.php b/tests/Greece/EasterTest.php index 06e65f69e..07516a7b2 100644 --- a/tests/Greece/EasterTest.php +++ b/tests/Greece/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -25,10 +25,12 @@ class EasterTest extends GreeceBaseTestCase implements YasumiTestCaseInterface /** * The name of the first holiday of Easter */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of Easter. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Greece/EpiphanyTest.php b/tests/Greece/EpiphanyTest.php index 1d83a1775..e8d1f2f5a 100644 --- a/tests/Greece/EpiphanyTest.php +++ b/tests/Greece/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -24,7 +24,7 @@ class EpiphanyTest extends GreeceBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class EpiphanyTest extends GreeceBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests translated name of Epiphany. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Greece/GreeceBaseTestCase.php b/tests/Greece/GreeceBaseTestCase.php index 04de00743..7b77a4807 100644 --- a/tests/Greece/GreeceBaseTestCase.php +++ b/tests/Greece/GreeceBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Greece holiday provider. */ -abstract class GreeceBaseTestCase extends PHPUnit_Framework_TestCase +abstract class GreeceBaseTestCase extends TestCase { use YasumiBase; /** * Country (name) to be tested */ - const REGION = 'Greece'; + public const REGION = 'Greece'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Athens'; + public const TIMEZONE = 'Europe/Athens'; /** * Locale that is considered common for this provider */ - const LOCALE = 'el_GR'; + public const LOCALE = 'el_GR'; } diff --git a/tests/Greece/GreeceTest.php b/tests/Greece/GreeceTest.php index f79c66d09..e38fb0798 100644 --- a/tests/Greece/GreeceTest.php +++ b/tests/Greece/GreeceTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -26,8 +26,9 @@ class GreeceTest extends GreeceBaseTestCase /** * Tests if all official holidays in Greece are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -50,32 +51,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Greece are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Greece are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Greece are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Greece are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays( ['threeHolyHierarchs', 'polytechnio'], diff --git a/tests/Greece/IndepencenceDayTest.php b/tests/Greece/IndepencenceDayTest.php index cac3144fd..71a7dced3 100644 --- a/tests/Greece/IndepencenceDayTest.php +++ b/tests/Greece/IndepencenceDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -25,15 +25,17 @@ class IndepencenceDayTest extends GreeceBaseTestCase implements YasumiTestCaseIn /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1821; + public const ESTABLISHMENT_YEAR = 1821; /** * The name of the holiday */ - const HOLIDAY = 'independenceDay'; + public const HOLIDAY = 'independenceDay'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -48,6 +50,7 @@ public function testHoliday() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Greece/InternationalWorkersDayTest.php b/tests/Greece/InternationalWorkersDayTest.php index d388ce45b..5d68a7dd4 100644 --- a/tests/Greece/InternationalWorkersDayTest.php +++ b/tests/Greece/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends GreeceBaseTestCase implements YasumiTe /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends GreeceBaseTestCase implements YasumiTe * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -41,8 +43,9 @@ public function testHoliday($year, $expected) /** * Tests translated name of International Workers' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } diff --git a/tests/Greece/NewYearsDayTest.php b/tests/Greece/NewYearsDayTest.php index 2d50c39ef..1564aaa8b 100644 --- a/tests/Greece/NewYearsDayTest.php +++ b/tests/Greece/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -24,7 +24,7 @@ class NewYearsDayTest extends GreeceBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends GreeceBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -41,8 +43,9 @@ public function testHoliday($year, $expected) /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Greece/OhiDayTest.php b/tests/Greece/OhiDayTest.php index 34c3fb4a7..a984dd8fb 100644 --- a/tests/Greece/OhiDayTest.php +++ b/tests/Greece/OhiDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -25,15 +25,17 @@ class OhiDayTest extends GreeceBaseTestCase implements YasumiTestCaseInterface /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1940; + public const ESTABLISHMENT_YEAR = 1940; /** * The name of the holiday */ - const HOLIDAY = 'ohiDay'; + public const HOLIDAY = 'ohiDay'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -48,6 +50,7 @@ public function testHoliday() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Greece/PentecostMondayTest.php b/tests/Greece/PentecostMondayTest.php index 51b79d2ca..69156fb78 100644 --- a/tests/Greece/PentecostMondayTest.php +++ b/tests/Greece/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -25,10 +25,12 @@ class PentecostMondayTest extends GreeceBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Greece/PentecostTest.php b/tests/Greece/PentecostTest.php index 459bcd9fe..55211469a 100644 --- a/tests/Greece/PentecostTest.php +++ b/tests/Greece/PentecostTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -25,10 +25,12 @@ class PentecostTest extends GreeceBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Greece/PolytechnioTest.php b/tests/Greece/PolytechnioTest.php index 090009f44..72bded03a 100644 --- a/tests/Greece/PolytechnioTest.php +++ b/tests/Greece/PolytechnioTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -25,15 +25,17 @@ class PolytechnioTest extends GreeceBaseTestCase implements YasumiTestCaseInterf /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1973; + public const ESTABLISHMENT_YEAR = 1973; /** * The name of the holiday */ - const HOLIDAY = 'polytechnio'; + public const HOLIDAY = 'polytechnio'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -48,6 +50,7 @@ public function testHoliday() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Greece/ThreeHolyHierarchsTest.php b/tests/Greece/ThreeHolyHierarchsTest.php index e779d1b86..1948e384b 100644 --- a/tests/Greece/ThreeHolyHierarchsTest.php +++ b/tests/Greece/ThreeHolyHierarchsTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -24,7 +24,7 @@ class ThreeHolyHierarchsTest extends GreeceBaseTestCase implements YasumiTestCas /** * The name of the holiday */ - const HOLIDAY = 'threeHolyHierarchs'; + public const HOLIDAY = 'threeHolyHierarchs'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ThreeHolyHierarchsTest extends GreeceBaseTestCase implements YasumiTestCas * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 30, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Greece/goodFridayTest.php b/tests/Greece/goodFridayTest.php index 4855152c0..598bdf5f2 100644 --- a/tests/Greece/goodFridayTest.php +++ b/tests/Greece/goodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Greece; @@ -25,10 +25,12 @@ class goodFridayTest extends GreeceBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Hungary/AllSaintsDayTest.php b/tests/Hungary/AllSaintsDayTest.php index 48b815cfc..32a4f9323 100644 --- a/tests/Hungary/AllSaintsDayTest.php +++ b/tests/Hungary/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends HungaryBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends HungaryBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Hungary/ChristmasTest.php b/tests/Hungary/ChristmasTest.php index f2511dc89..dc1faca58 100644 --- a/tests/Hungary/ChristmasTest.php +++ b/tests/Hungary/ChristmasTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; @@ -24,7 +24,7 @@ class ChristmasTest extends HungaryBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ChristmasTest extends HungaryBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Hungary/EasterMondayTest.php b/tests/Hungary/EasterMondayTest.php index 02b284673..7f5120a91 100644 --- a/tests/Hungary/EasterMondayTest.php +++ b/tests/Hungary/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; @@ -25,10 +25,12 @@ class EasterMondayTest extends HungaryBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Hungary/EasterTest.php b/tests/Hungary/EasterTest.php index 0a3c13166..6c77ca6c5 100644 --- a/tests/Hungary/EasterTest.php +++ b/tests/Hungary/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; @@ -25,10 +25,12 @@ class EasterTest extends HungaryBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Hungary/HungaryBaseTestCase.php b/tests/Hungary/HungaryBaseTestCase.php index 63c3b92c2..9076a709f 100644 --- a/tests/Hungary/HungaryBaseTestCase.php +++ b/tests/Hungary/HungaryBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Hungary holiday provider. */ -abstract class HungaryBaseTestCase extends PHPUnit_Framework_TestCase +abstract class HungaryBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Hungary'; + public const REGION = 'Hungary'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Budapest'; + public const TIMEZONE = 'Europe/Budapest'; /** * Locale that is considered common for this provider */ - const LOCALE = 'hu_HU'; + public const LOCALE = 'hu_HU'; } diff --git a/tests/Hungary/HungaryTest.php b/tests/Hungary/HungaryTest.php index 47f2c5e40..bebf39a2c 100644 --- a/tests/Hungary/HungaryTest.php +++ b/tests/Hungary/HungaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; @@ -26,8 +26,9 @@ class HungaryTest extends HungaryBaseTestCase /** * Tests if all official holidays in Hungary are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = [ 'newYearsDay', @@ -61,32 +62,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Hungary are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays(['pentecost'], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Hungary are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Hungary are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Hungary are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Hungary/InternationalWorkersDayTest.php b/tests/Hungary/InternationalWorkersDayTest.php index 88324d806..8b582c175 100644 --- a/tests/Hungary/InternationalWorkersDayTest.php +++ b/tests/Hungary/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends HungaryBaseTestCase implements YasumiT /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends HungaryBaseTestCase implements YasumiT * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Hungary/MemorialDay1848Test.php b/tests/Hungary/MemorialDay1848Test.php index 70cb0e371..3a95cb67c 100644 --- a/tests/Hungary/MemorialDay1848Test.php +++ b/tests/Hungary/MemorialDay1848Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; @@ -25,15 +25,17 @@ class MemorialDay1848Test extends HungaryBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'memorialDay1848'; + public const HOLIDAY = 'memorialDay1848'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1927; + public const ESTABLISHMENT_YEAR = 1927; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Hungary/MemorialDay1956Test.php b/tests/Hungary/MemorialDay1956Test.php index 5bff57f21..f49392df7 100644 --- a/tests/Hungary/MemorialDay1956Test.php +++ b/tests/Hungary/MemorialDay1956Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; @@ -25,15 +25,17 @@ class MemorialDay1956Test extends HungaryBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'memorialDay1956'; + public const HOLIDAY = 'memorialDay1956'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1991; + public const ESTABLISHMENT_YEAR = 1991; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Hungary/NewYearsDayTest.php b/tests/Hungary/NewYearsDayTest.php index 846e126e0..91c134c68 100644 --- a/tests/Hungary/NewYearsDayTest.php +++ b/tests/Hungary/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; @@ -24,7 +24,7 @@ class NewYearsDayTest extends HungaryBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends HungaryBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Hungary/PentecostMondayTest.php b/tests/Hungary/PentecostMondayTest.php index 34f1658ef..904f87242 100644 --- a/tests/Hungary/PentecostMondayTest.php +++ b/tests/Hungary/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; @@ -25,10 +25,12 @@ class PentecostMondayTest extends HungaryBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Hungary/PentecostTest.php b/tests/Hungary/PentecostTest.php index 433446003..f1c3a3ca9 100644 --- a/tests/Hungary/PentecostTest.php +++ b/tests/Hungary/PentecostTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; @@ -25,10 +25,12 @@ class PentecostTest extends HungaryBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Hungary/SecondChristmasDayTest.php b/tests/Hungary/SecondChristmasDayTest.php index 74aaf78fa..6700f5c5e 100644 --- a/tests/Hungary/SecondChristmasDayTest.php +++ b/tests/Hungary/SecondChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; @@ -24,7 +24,7 @@ class SecondChristmasDayTest extends HungaryBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class SecondChristmasDayTest extends HungaryBaseTestCase implements YasumiTestCa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Hungary/StateFoundationDayTest.php b/tests/Hungary/StateFoundationDayTest.php index 93fd9573f..5f8ce1ed9 100644 --- a/tests/Hungary/StateFoundationDayTest.php +++ b/tests/Hungary/StateFoundationDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Hungary; @@ -25,15 +25,17 @@ class StateFoundationDayTest extends HungaryBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'stateFoundation'; + public const HOLIDAY = 'stateFoundation'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1891; + public const ESTABLISHMENT_YEAR = 1891; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Ireland/AugustHolidayTest.php b/tests/Ireland/AugustHolidayTest.php index bf9469c1b..8a8d618eb 100644 --- a/tests/Ireland/AugustHolidayTest.php +++ b/tests/Ireland/AugustHolidayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -25,7 +25,7 @@ class AugustHolidayTest extends IrelandBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'augustHoliday'; + public const HOLIDAY = 'augustHoliday'; /** * Tests the holiday defined in this test. @@ -34,6 +34,9 @@ class AugustHolidayTest extends IrelandBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -50,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -67,8 +71,10 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -86,8 +92,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Ireland/ChristmasDayTest.php b/tests/Ireland/ChristmasDayTest.php index aaab08bb4..c9987b790 100644 --- a/tests/Ireland/ChristmasDayTest.php +++ b/tests/Ireland/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -25,7 +25,7 @@ class ChristmasDayTest extends IrelandBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -34,13 +34,16 @@ class ChristmasDayTest extends IrelandBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param \DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { $date = new DateTime($expected, new DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); - if (in_array((int)$date->format('w'), [0, 6], true)) { + if (\in_array((int)$date->format('w'), [0, 6], true)) { $date->modify('next tuesday'); $this->assertHoliday(self::REGION, 'substituteHoliday:' . self::HOLIDAY, $year, $date); } @@ -50,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -66,8 +70,10 @@ public function HolidayDataProvider() /** * Tests translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -85,8 +91,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Ireland/EasterMondayTest.php b/tests/Ireland/EasterMondayTest.php index 7ab031d89..d2703af63 100644 --- a/tests/Ireland/EasterMondayTest.php +++ b/tests/Ireland/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -26,7 +26,7 @@ class EasterMondayTest extends IrelandBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. @@ -35,6 +35,9 @@ class EasterMondayTest extends IrelandBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -50,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -68,8 +72,10 @@ public function HolidayDataProvider() /** * Tests translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -87,8 +93,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Ireland/EasterTest.php b/tests/Ireland/EasterTest.php index 11c73ab33..92b3f0238 100644 --- a/tests/Ireland/EasterTest.php +++ b/tests/Ireland/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -25,7 +25,7 @@ class EasterTest extends IrelandBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests the holiday defined in this test. @@ -34,6 +34,9 @@ class EasterTest extends IrelandBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -66,8 +70,10 @@ public function HolidayDataProvider() /** * Tests translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -85,8 +91,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Ireland/GoodFridayTest.php b/tests/Ireland/GoodFridayTest.php index 614c93785..d50204f24 100644 --- a/tests/Ireland/GoodFridayTest.php +++ b/tests/Ireland/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -26,7 +26,7 @@ class GoodFridayTest extends IrelandBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. @@ -35,6 +35,9 @@ class GoodFridayTest extends IrelandBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -50,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -67,8 +71,10 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -86,8 +92,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Ireland/IrelandBaseTestCase.php b/tests/Ireland/IrelandBaseTestCase.php index f1c05a0a2..6aa00aac8 100644 --- a/tests/Ireland/IrelandBaseTestCase.php +++ b/tests/Ireland/IrelandBaseTestCase.php @@ -2,43 +2,43 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Ireland holiday provider. */ -abstract class IrelandBaseTestCase extends PHPUnit_Framework_TestCase +abstract class IrelandBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Ireland'; + public const REGION = 'Ireland'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Dublin'; + public const TIMEZONE = 'Europe/Dublin'; /** * Locale that is considered common for this provider */ - const LOCALE = 'en_IE'; + public const LOCALE = 'en_IE'; /** * Number of iterations to be used for the various unit test of this provider */ - const TEST_ITERATIONS = 50; + public const TEST_ITERATIONS = 50; } diff --git a/tests/Ireland/IrelandTest.php b/tests/Ireland/IrelandTest.php index 553e46712..d9a1c3d16 100644 --- a/tests/Ireland/IrelandTest.php +++ b/tests/Ireland/IrelandTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -26,8 +26,9 @@ class IrelandTest extends IrelandBaseTestCase /** * Tests if all official holidays in Ireland are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = ['easter', 'easterMonday', 'augustHoliday', 'christmasDay', 'stStephensDay']; if ($this->year >= 1974) { @@ -56,32 +57,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Ireland are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays(['goodFriday', 'pentecost'], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Ireland are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Ireland are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Ireland are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Ireland/JuneHolidayTest.php b/tests/Ireland/JuneHolidayTest.php index 1bcbf12fb..1f78b8236 100644 --- a/tests/Ireland/JuneHolidayTest.php +++ b/tests/Ireland/JuneHolidayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -25,12 +25,12 @@ class JuneHolidayTest extends IrelandBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'juneHoliday'; + public const HOLIDAY = 'juneHoliday'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1974; + public const ESTABLISHMENT_YEAR = 1974; /** * Tests the holiday defined in this test. @@ -39,6 +39,9 @@ class JuneHolidayTest extends IrelandBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -55,8 +58,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -72,6 +76,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -84,8 +89,10 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -103,8 +110,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Ireland/MayDayTest.php b/tests/Ireland/MayDayTest.php index f21da5b5f..219959588 100644 --- a/tests/Ireland/MayDayTest.php +++ b/tests/Ireland/MayDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -25,12 +25,12 @@ class MayDayTest extends IrelandBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'mayDay'; + public const HOLIDAY = 'mayDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1994; + public const ESTABLISHMENT_YEAR = 1994; /** * Tests the holiday defined in this test. @@ -39,6 +39,9 @@ class MayDayTest extends IrelandBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -56,8 +59,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -73,6 +77,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -85,8 +90,10 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -104,8 +111,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Ireland/NewYearsDayTest.php b/tests/Ireland/NewYearsDayTest.php index b1f398fc8..035164d27 100644 --- a/tests/Ireland/NewYearsDayTest.php +++ b/tests/Ireland/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -25,12 +25,12 @@ class NewYearsDayTest extends IrelandBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1974; + public const ESTABLISHMENT_YEAR = 1974; /** * Tests the holiday defined in this test. @@ -40,6 +40,8 @@ class NewYearsDayTest extends IrelandBaseTestCase implements YasumiTestCaseInter * @param int $year the year for which the holiday defined in this test needs to be tested * @param \DateTime $expected the expected date * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -56,8 +58,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -72,6 +75,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -84,8 +88,10 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -103,8 +109,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Ireland/OctoberHolidayTest.php b/tests/Ireland/OctoberHolidayTest.php index 8ff76a31c..83954a53f 100644 --- a/tests/Ireland/OctoberHolidayTest.php +++ b/tests/Ireland/OctoberHolidayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -25,12 +25,12 @@ class OctoberHolidayTest extends IrelandBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'octoberHoliday'; + public const HOLIDAY = 'octoberHoliday'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1977; + public const ESTABLISHMENT_YEAR = 1977; /** * Tests the holiday defined in this test. @@ -39,6 +39,9 @@ class OctoberHolidayTest extends IrelandBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -56,8 +59,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -73,6 +77,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -85,8 +90,10 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -104,8 +111,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Ireland/PentecostTest.php b/tests/Ireland/PentecostTest.php index 071fb10c5..bbcf12e3b 100644 --- a/tests/Ireland/PentecostTest.php +++ b/tests/Ireland/PentecostTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -26,7 +26,7 @@ class PentecostTest extends IrelandBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * Tests the holiday defined in this test. @@ -35,6 +35,9 @@ class PentecostTest extends IrelandBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -50,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -68,8 +72,10 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -87,8 +93,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Ireland/StPatricksDayTest.php b/tests/Ireland/StPatricksDayTest.php index 79097ee6f..fe5a991c3 100644 --- a/tests/Ireland/StPatricksDayTest.php +++ b/tests/Ireland/StPatricksDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -25,12 +25,12 @@ class StPatricksDayTest extends IrelandBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'stPatricksDay'; + public const HOLIDAY = 'stPatricksDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1903; + public const ESTABLISHMENT_YEAR = 1903; /** * Tests the holiday defined in this test. @@ -39,13 +39,16 @@ class StPatricksDayTest extends IrelandBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param \DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { $date = new DateTime($expected, new DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); - if (in_array((int)$date->format('w'), [0, 6], true)) { + if (\in_array((int)$date->format('w'), [0, 6], true)) { $date->modify('next monday'); $this->assertHoliday(self::REGION, 'substituteHoliday:' . self::HOLIDAY, $year, $date); } @@ -55,8 +58,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -71,6 +75,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -83,8 +88,10 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -102,8 +109,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Ireland/StStephensDayTest.php b/tests/Ireland/StStephensDayTest.php index 62a7234bb..83b4ea9dc 100644 --- a/tests/Ireland/StStephensDayTest.php +++ b/tests/Ireland/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -25,7 +25,7 @@ class StStephensDayTest extends IrelandBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -34,13 +34,16 @@ class StStephensDayTest extends IrelandBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param \DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { $date = new DateTime($expected, new DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); - if (in_array((int)$date->format('w'), [0, 6], true)) { + if (\in_array((int)$date->format('w'), [0, 6], true)) { $date->modify('next monday'); $this->assertHoliday(self::REGION, 'substituteHoliday:' . self::HOLIDAY, $year, $date); } @@ -50,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -66,8 +70,10 @@ public function HolidayDataProvider() /** * Tests translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -85,8 +91,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Ireland/pentecostMondayTest.php b/tests/Ireland/pentecostMondayTest.php index b7dd8f99f..6aed88641 100644 --- a/tests/Ireland/pentecostMondayTest.php +++ b/tests/Ireland/pentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ireland; @@ -26,12 +26,12 @@ class pentecostMondayTest extends IrelandBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * The year in which the holiday was abolished */ - const ABOLISHMENT_YEAR = 1973; + public const ABOLISHMENT_YEAR = 1973; /** * Tests the holiday defined in this test. @@ -40,6 +40,9 @@ class pentecostMondayTest extends IrelandBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -55,8 +58,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -72,6 +76,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test after abolishment. + * @throws \ReflectionException */ public function testHolidayDayAfterAbolishment() { @@ -80,8 +85,10 @@ public function testHolidayDayAfterAbolishment() /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -99,8 +106,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Italy/AllSaintsDayTest.php b/tests/Italy/AllSaintsDayTest.php index e2c5bdb7e..fbe88e7a1 100644 --- a/tests/Italy/AllSaintsDayTest.php +++ b/tests/Italy/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends ItalyBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends ItalyBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAssumptionOfMary($year, $expected) { @@ -43,16 +45,18 @@ public function testAssumptionOfMary($year, $expected) * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Italy/AssumptionOfMaryTest.php b/tests/Italy/AssumptionOfMaryTest.php index 28e5e24a2..b53866a49 100644 --- a/tests/Italy/AssumptionOfMaryTest.php +++ b/tests/Italy/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends ItalyBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the day of the Assumption of Mary. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends ItalyBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAssumptionOfMary($year, $expected) { @@ -43,16 +45,18 @@ public function testAssumptionOfMary($year, $expected) * Returns a list of random test dates used for assertion of the day of the Assumption of Mary. * * @return array list of test dates for the day of the Assumption of Mary + * @throws \Exception */ - public function AssumptionOfMaryDataProvider() + public function AssumptionOfMaryDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } /** * Tests translated name of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Italy/ChristmasTest.php b/tests/Italy/ChristmasTest.php index beed4316c..66a3fe35c 100644 --- a/tests/Italy/ChristmasTest.php +++ b/tests/Italy/ChristmasTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; @@ -24,7 +24,7 @@ class ChristmasTest extends ItalyBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasTest extends ItalyBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Italy/EasterMondayTest.php b/tests/Italy/EasterMondayTest.php index ca1a8ab57..43020a674 100644 --- a/tests/Italy/EasterMondayTest.php +++ b/tests/Italy/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; @@ -25,10 +25,12 @@ class EasterMondayTest extends ItalyBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Italy/EasterTest.php b/tests/Italy/EasterTest.php index 85c445211..780d01a4d 100644 --- a/tests/Italy/EasterTest.php +++ b/tests/Italy/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; @@ -25,10 +25,12 @@ class EasterTest extends ItalyBaseTestCase implements YasumiTestCaseInterface /** * The name of the first holiday of Easter */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests Easter. + * @throws \Exception + * @throws \ReflectionException */ public function testEaster() { @@ -43,8 +45,9 @@ public function testEaster() /** * Tests translated name of Easter. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Italy/EpiphanyTest.php b/tests/Italy/EpiphanyTest.php index a440eacac..6b2d4b822 100644 --- a/tests/Italy/EpiphanyTest.php +++ b/tests/Italy/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; @@ -24,7 +24,7 @@ class EpiphanyTest extends ItalyBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** * Tests Epiphany. @@ -33,6 +33,8 @@ class EpiphanyTest extends ItalyBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which Epiphany needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testEpiphany($year, $expected) { @@ -43,16 +45,18 @@ public function testEpiphany($year, $expected) * Returns a list of random test dates used for assertion of Epiphany. * * @return array list of test dates for Epiphany + * @throws \Exception */ - public function EpiphanyDataProvider() + public function EpiphanyDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests translated name of Epiphany. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Italy/ImmaculateConceptionTest.php b/tests/Italy/ImmaculateConceptionTest.php index 14bbdd0f6..802b9f535 100644 --- a/tests/Italy/ImmaculateConceptionTest.php +++ b/tests/Italy/ImmaculateConceptionTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; @@ -24,7 +24,7 @@ class ImmaculateConceptionTest extends ItalyBaseTestCase implements YasumiTestCa /** * The name of the holiday */ - const HOLIDAY = 'immaculateConception'; + public const HOLIDAY = 'immaculateConception'; /** * Tests the day of Immaculate Conception. @@ -33,6 +33,8 @@ class ImmaculateConceptionTest extends ItalyBaseTestCase implements YasumiTestCa * * @param int $year the year for which the day of Immaculate Conception needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testImmaculateConception($year, $expected) { @@ -43,16 +45,18 @@ public function testImmaculateConception($year, $expected) * Returns a list of random test dates used for assertion of the day of Immaculate Conception. * * @return array list of test dates for the day of Immaculate Conception + * @throws \Exception */ - public function ImmaculateConceptionDataProvider() + public function ImmaculateConceptionDataProvider(): array { return $this->generateRandomDates(12, 8, self::TIMEZONE); } /** * Tests translated name of the day of Immaculate Conception. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Italy/InternationalWorkersDayTest.php b/tests/Italy/InternationalWorkersDayTest.php index 6f0377311..00d0eefd2 100644 --- a/tests/Italy/InternationalWorkersDayTest.php +++ b/tests/Italy/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends ItalyBaseTestCase implements YasumiTes /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests International Workers' Day. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends ItalyBaseTestCase implements YasumiTes * * @param int $year the year for which International Workers' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testInternationalWorkersDay($year, $expected) { @@ -43,16 +45,18 @@ public function testInternationalWorkersDay($year, $expected) * Returns a list of random test dates used for assertion of International Workers' Day. * * @return array list of test dates for International Workers' Day + * @throws \Exception */ - public function InternationalWorkersDayDataProvider() + public function InternationalWorkersDayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } /** * Tests translated name of International Workers' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Italy/ItalyBaseTestCase.php b/tests/Italy/ItalyBaseTestCase.php index 78a544164..09c2485bf 100644 --- a/tests/Italy/ItalyBaseTestCase.php +++ b/tests/Italy/ItalyBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Italy holiday provider. */ -abstract class ItalyBaseTestCase extends PHPUnit_Framework_TestCase +abstract class ItalyBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Italy'; + public const REGION = 'Italy'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Rome'; + public const TIMEZONE = 'Europe/Rome'; /** * Locale that is considered common for this provider */ - const LOCALE = 'it_IT'; + public const LOCALE = 'it_IT'; } diff --git a/tests/Italy/ItalyTest.php b/tests/Italy/ItalyTest.php index e593e3d80..9d7d24a94 100644 --- a/tests/Italy/ItalyTest.php +++ b/tests/Italy/ItalyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; @@ -26,8 +26,9 @@ class ItalyTest extends ItalyBaseTestCase /** * Tests if all official holidays in Italy are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -47,32 +48,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Italy are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Italy are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Italy are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Italy are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Italy/LiberationDayTest.php b/tests/Italy/LiberationDayTest.php index 0ab80e37a..e07dd8540 100644 --- a/tests/Italy/LiberationDayTest.php +++ b/tests/Italy/LiberationDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; @@ -32,15 +32,17 @@ class LiberationDayTest extends ItalyBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'liberationDay'; + public const HOLIDAY = 'liberationDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1949; + public const ESTABLISHMENT_YEAR = 1949; /** * Tests Liberation Day on or after 1949. + * @throws \Exception + * @throws \ReflectionException */ public function testLiberationDayOnAfter1949() { @@ -55,6 +57,7 @@ public function testLiberationDayOnAfter1949() /** * Tests Liberation Day before 1949. + * @throws \ReflectionException */ public function testLiberationDayBefore1949() { @@ -67,8 +70,9 @@ public function testLiberationDayBefore1949() /** * Tests translated name of Liberation Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -80,8 +84,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Italy/NewYearsDayTest.php b/tests/Italy/NewYearsDayTest.php index a9bbc4c2a..8f9f3e7cf 100644 --- a/tests/Italy/NewYearsDayTest.php +++ b/tests/Italy/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; @@ -24,7 +24,7 @@ class NewYearsDayTest extends ItalyBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends ItalyBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -43,16 +45,18 @@ public function testNewYearsDay($year, $expected) * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Italy/RepublicDayTest.php b/tests/Italy/RepublicDayTest.php index 6387d13c3..dbacc71fe 100644 --- a/tests/Italy/RepublicDayTest.php +++ b/tests/Italy/RepublicDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; @@ -32,15 +32,17 @@ class RepublicDayTest extends ItalyBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'republicDay'; + public const HOLIDAY = 'republicDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1946; + public const ESTABLISHMENT_YEAR = 1946; /** * Tests Republic Day on or after 1946. + * @throws \Exception + * @throws \ReflectionException */ public function testRepublicDayOnAfter1946() { @@ -55,6 +57,7 @@ public function testRepublicDayOnAfter1946() /** * Tests Republic Day before 1946. + * @throws \ReflectionException */ public function testRepublicDayBefore1946() { @@ -67,8 +70,9 @@ public function testRepublicDayBefore1946() /** * Tests translated name of Republic Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -80,8 +84,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Italy/stStephensDayTest.php b/tests/Italy/stStephensDayTest.php index ef865d851..fbbdfcca0 100644 --- a/tests/Italy/stStephensDayTest.php +++ b/tests/Italy/stStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Italy; @@ -24,7 +24,7 @@ class stStephensDayTest extends ItalyBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the day of St. Stephen's Day. @@ -33,6 +33,8 @@ class stStephensDayTest extends ItalyBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which St. Stephen's Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function teststStephensDay($year, $expected) { @@ -43,16 +45,18 @@ public function teststStephensDay($year, $expected) * Returns a list of random test dates used for assertion of St. Stephen's Day. * * @return array list of test dates for St. Stephen's Day + * @throws \Exception */ - public function stStephensDayDataProvider() + public function stStephensDayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests translated name of St. Stephen's Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Japan/AutumnalEquinoxDayTest.php b/tests/Japan/AutumnalEquinoxDayTest.php index 0e2f798ca..46a76d12d 100644 --- a/tests/Japan/AutumnalEquinoxDayTest.php +++ b/tests/Japan/AutumnalEquinoxDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,12 +25,12 @@ class AutumnalEquinoxDayTest extends JapanBaseTestCase implements YasumiTestCase /** * The name of the holiday */ - const HOLIDAY = 'autumnalEquinoxDay'; + public const HOLIDAY = 'autumnalEquinoxDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1948; + public const ESTABLISHMENT_YEAR = 1948; /** * Tests Vernal Equinox Day after 2150. This national holiday was established in 1948 as a day on which to honor @@ -38,6 +38,7 @@ class AutumnalEquinoxDayTest extends JapanBaseTestCase implements YasumiTestCase * festival called Shūki kōrei-sai (秋季皇霊祭). * * After 2150 no calculations are available yet. + * @throws \ReflectionException */ public function testAutumnalEquinoxDayOnAfter2150() { @@ -56,6 +57,9 @@ public function testAutumnalEquinoxDayOnAfter2150() * @param $year int year of example data to be tested * @param $month int month (number) of example data to be tested * @param $day int day of the month (number) of example data to be tested + * + * @throws \ReflectionException + * @throws \Exception */ public function testAutumnalEquinoxDayBetween1948And2150($year, $month, $day) { @@ -72,7 +76,7 @@ public function testAutumnalEquinoxDayBetween1948And2150($year, $month, $day) * * @return array list of Japanese Autumnal Equinox holidays */ - public function autumnalEquinoxHolidaysProvider() + public function autumnalEquinoxHolidaysProvider(): array { return [ [1951, 9, 24], @@ -87,6 +91,7 @@ public function autumnalEquinoxHolidaysProvider() * Tests Vernal Equinox Day before 1948. This national holiday was established in 1948 as a day on which to honor * one's ancestors and remember the dead. Prior to 1948, the autumnal equinox was an imperial ancestor worship * festival called Shūki kōrei-sai (秋季皇霊祭). + * @throws \ReflectionException */ public function testAutumnalEquinoxDayBefore1948() { @@ -101,6 +106,7 @@ public function testAutumnalEquinoxDayBefore1948() * Tests Vernal Equinox Day between 1851 and 1948. This national holiday was established in 1948 as a day on * which to honor one's ancestors and remember the dead. Prior to 1948, the autumnal equinox was an imperial * ancestor worship festival called Shūki kōrei-sai (秋季皇霊祭). + * @throws \ReflectionException */ public function testAutumnalEquinoxDayBetween1851And1948() { @@ -113,8 +119,9 @@ public function testAutumnalEquinoxDayBetween1851And1948() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -126,8 +133,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/ChildrensDayTest.php b/tests/Japan/ChildrensDayTest.php index 48b9f6f6c..167100122 100644 --- a/tests/Japan/ChildrensDayTest.php +++ b/tests/Japan/ChildrensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,15 +25,17 @@ class ChildrensDayTest extends JapanBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'childrensDay'; + public const HOLIDAY = 'childrensDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1948; + public const ESTABLISHMENT_YEAR = 1948; /** * Tests Children's Day after 1948. Children's Day was established after 1948 + * @throws \Exception + * @throws \ReflectionException */ public function testChildrensDayOnAfter1948() { @@ -48,6 +50,8 @@ public function testChildrensDayOnAfter1948() /** * Tests Children's Day after 1948 substituted next working day (when Children's Day falls on a Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testChildrensDayOnAfter1948SubstitutedNextWorkingDay() { @@ -62,6 +66,7 @@ public function testChildrensDayOnAfter1948SubstitutedNextWorkingDay() /** * Tests Children's Day before 1948. Children's Day was established after 1948 + * @throws \ReflectionException */ public function testChildrensDayBefore1948() { @@ -74,8 +79,9 @@ public function testChildrensDayBefore1948() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -87,8 +93,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/ComingOfAgeDayTest.php b/tests/Japan/ComingOfAgeDayTest.php index 648cfaefd..b528835ba 100644 --- a/tests/Japan/ComingOfAgeDayTest.php +++ b/tests/Japan/ComingOfAgeDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,16 +25,18 @@ class ComingOfAgeDayTest extends JapanBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'comingOfAgeDay'; + public const HOLIDAY = 'comingOfAgeDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1948; + public const ESTABLISHMENT_YEAR = 1948; /** * Tests Coming of Age Day after 2000. Coming of Age Day was established after 1948 on January 15th. After 2000 it * was changed to be the second monday of January. + * @throws \Exception + * @throws \ReflectionException */ public function testComingOfAgeDayOnAfter2000() { @@ -51,6 +53,8 @@ public function testComingOfAgeDayOnAfter2000() /** * Tests Coming of Age Day between 1948 and 2000. Coming of Age Day was established after 1948 on January 15th. * After 2000 it was changed to be the second monday of January. + * @throws \Exception + * @throws \ReflectionException */ public function testComingOfAgeDayBetween1948And2000() { @@ -66,6 +70,7 @@ public function testComingOfAgeDayBetween1948And2000() /** * Tests Coming of Age Day before 1948. Coming of Age Day was established after 1948 on January 15th. After 2000 it * was changed to be the second monday of January. + * @throws \ReflectionException */ public function testConstitutionMemorialDayBefore1948() { @@ -78,8 +83,9 @@ public function testConstitutionMemorialDayBefore1948() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -91,8 +97,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/ConstitutionMemorialDayTest.php b/tests/Japan/ConstitutionMemorialDayTest.php index aab98ed37..c8bc151c2 100644 --- a/tests/Japan/ConstitutionMemorialDayTest.php +++ b/tests/Japan/ConstitutionMemorialDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,15 +25,17 @@ class ConstitutionMemorialDayTest extends JapanBaseTestCase implements YasumiTes /** * The name of the holiday */ - const HOLIDAY = 'constitutionMemorialDay'; + public const HOLIDAY = 'constitutionMemorialDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1948; + public const ESTABLISHMENT_YEAR = 1948; /** * Tests Constitution Memorial Day after 1948. Constitution Memorial Day was established after 1948 + * @throws \Exception + * @throws \ReflectionException */ public function testConstitutionMemorialDayOnAfter1948() { @@ -49,6 +51,8 @@ public function testConstitutionMemorialDayOnAfter1948() /** * Tests Constitution Memorial Day after 1948 substituted next working day (when Constitution Memorial Day falls on * a Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testConstitutionMemorialDayOnAfter1948SubstitutedNextWorkingDay() { @@ -63,6 +67,7 @@ public function testConstitutionMemorialDayOnAfter1948SubstitutedNextWorkingDay( /** * Tests Constitution Memorial Day before 1948. Constitution Memorial Day was established after 1948 + * @throws \ReflectionException */ public function testConstitutionMemorialDayBefore1948() { @@ -75,8 +80,9 @@ public function testConstitutionMemorialDayBefore1948() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -88,8 +94,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/CultureDayTest.php b/tests/Japan/CultureDayTest.php index 912d0d936..3c976a07b 100644 --- a/tests/Japan/CultureDayTest.php +++ b/tests/Japan/CultureDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,15 +25,17 @@ class CultureDayTest extends JapanBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'cultureDay'; + public const HOLIDAY = 'cultureDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1948; + public const ESTABLISHMENT_YEAR = 1948; /** * Tests Culture Day after 1948. Culture Day Day was established after 1948 + * @throws \Exception + * @throws \ReflectionException */ public function testCultureDayOnAfter1948() { @@ -48,6 +50,8 @@ public function testCultureDayOnAfter1948() /** * Tests Culture Day after 1948 substituted next working day (when Culture Day falls on a Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testCultureDayOnAfter1948SubstitutedNextWorkingDay() { @@ -62,6 +66,7 @@ public function testCultureDayOnAfter1948SubstitutedNextWorkingDay() /** * Tests Culture Day before 1948. Culture Day was established after 1948 + * @throws \ReflectionException */ public function testCultureDayBefore1948() { @@ -74,8 +79,9 @@ public function testCultureDayBefore1948() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -87,8 +93,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/EmperorsBirthdayTest.php b/tests/Japan/EmperorsBirthdayTest.php index 49fa9f787..f64220dc9 100644 --- a/tests/Japan/EmperorsBirthdayTest.php +++ b/tests/Japan/EmperorsBirthdayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,17 +25,19 @@ class EmperorsBirthdayTest extends JapanBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'emperorsBirthday'; + public const HOLIDAY = 'emperorsBirthday'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1989; + public const ESTABLISHMENT_YEAR = 1989; /** * Tests the Emperors Birthday after 1989. The Emperors Birthday is on December 23rd and celebrated as such since * 1989. Prior to the death of Emperor Hirohito in 1989, this holiday was celebrated on April 29. See also "Shōwa * Day". + * @throws \Exception + * @throws \ReflectionException */ public function testEmperorsBirthdayOnAfter1989() { @@ -51,6 +53,8 @@ public function testEmperorsBirthdayOnAfter1989() /** * Tests the Emperors Birthday after 1989 substituted next working day (when the Emperors Birthday falls on a * Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testEmperorsBirthdayOnAfter1989SubstitutedNextWorkingDay() { @@ -67,6 +71,7 @@ public function testEmperorsBirthdayOnAfter1989SubstitutedNextWorkingDay() * Tests the Emperors Birthday before 1989. The Emperors Birthday is on December 23rd and celebrated as such since * 1989. Prior to the death of Emperor Hirohito in 1989, this holiday was celebrated on April 29. See also "Shōwa * Day"/"Greenery Day" + * @throws \ReflectionException */ public function testEmperorsBirthdayBefore1989() { @@ -79,8 +84,9 @@ public function testEmperorsBirthdayBefore1989() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -92,8 +98,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/GreeneryDayTest.php b/tests/Japan/GreeneryDayTest.php index 5b115e1cb..d6b2e06b9 100644 --- a/tests/Japan/GreeneryDayTest.php +++ b/tests/Japan/GreeneryDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,16 +25,18 @@ class GreeneryDayTest extends JapanBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday defined in the test */ - const HOLIDAY = 'greeneryDay'; + public const HOLIDAY = 'greeneryDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1989; + public const ESTABLISHMENT_YEAR = 1989; /** * Tests Greenery Day after 2007. Greenery Day was established from 1989 on April 29th. After 2007 * it was changed to be May 4th. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfter2007() { @@ -49,6 +51,8 @@ public function testHolidayOnAfter2007() /** * Tests Greenery Day after 2007 substituted next working day (when Greenery Day falls on a Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfter2007SubstitutedNextWorkingDay() { @@ -64,6 +68,8 @@ public function testHolidayOnAfter2007SubstitutedNextWorkingDay() /** * Tests Greenery Day between 1989 and 2007. Greenery Day was established from 1989 on April 29th. After 2007 * it was changed to be May 4th. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayBetween1989And2007() { @@ -78,6 +84,8 @@ public function testHolidayBetween1989And2007() /** * Tests Greenery Day between 1989 and 2007 substituted next working day (when Greenery Day falls on a Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayBetween1989And2007SubstitutedNextWorkingDay() { @@ -93,6 +101,7 @@ public function testHolidayBetween1989And2007SubstitutedNextWorkingDay() /** * Tests Greenery Day before 1989. Greenery Day was established from 1989 on April 29th. After 2007 * it was changed to be May 4th. + * @throws \ReflectionException */ public function testHolidayBefore1989() { @@ -105,8 +114,9 @@ public function testHolidayBefore1989() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -118,8 +128,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/HealthAndSportsDayTest.php b/tests/Japan/HealthAndSportsDayTest.php index b6a5786b3..f51521afa 100644 --- a/tests/Japan/HealthAndSportsDayTest.php +++ b/tests/Japan/HealthAndSportsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,16 +25,34 @@ class HealthAndSportsDayTest extends JapanBaseTestCase implements YasumiTestCase /** * The name of the holiday */ - const HOLIDAY = 'healthandSportsDay'; + public const HOLIDAY = 'healthandSportsDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1996; + public const ESTABLISHMENT_YEAR = 1996; + + /** + * Tests Health And Sports Day in 2020. Health And Sports Day in 2020 is July 24th for the Olympic Games. + * @throws \Exception + * @throws \ReflectionException + */ + public function testHealthAndSportsDayIn2020() + { + $year = 2020; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("$year-7-24", new DateTimeZone(self::TIMEZONE)) + ); + } /** * Tests Health And Sports Day after 2000. Health And Sports Day was established since 1996 on October 10th. After * 2000 it was changed to be the second monday of October. + * @throws \Exception + * @throws \ReflectionException */ public function testHealthAndSportsDayOnAfter2000() { @@ -50,6 +68,8 @@ public function testHealthAndSportsDayOnAfter2000() /** * Tests Health And Sports Day between 1996 and 2000. Health And Sports Day was established since 1996 on October * 10th. After 2000 it was changed to be the second monday of October. + * @throws \Exception + * @throws \ReflectionException */ public function testHealthAndSportsDayBetween1996And2000() { @@ -65,6 +85,8 @@ public function testHealthAndSportsDayBetween1996And2000() /** * Tests Health And Sports Day between 1996 and 2000 substituted next working day (when Health And Sports Day falls * on a Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testHealthAndSportsDayBetween1996And2000SubstitutedNextWorkingDay() { @@ -80,6 +102,7 @@ public function testHealthAndSportsDayBetween1996And2000SubstitutedNextWorkingDa /** * Tests Health And Sports Day before. Health And Sports Day was established since 1996 on October 10th. After * 2000 it was changed to be the second monday of October. + * @throws \ReflectionException */ public function testHealthAndSportsDayBefore1996() { @@ -92,8 +115,9 @@ public function testHealthAndSportsDayBefore1996() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -105,8 +129,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/JapanBaseTestCase.php b/tests/Japan/JapanBaseTestCase.php index 597b8cd9c..88ccb825a 100644 --- a/tests/Japan/JapanBaseTestCase.php +++ b/tests/Japan/JapanBaseTestCase.php @@ -2,43 +2,43 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Class JapanBaseTestCase. */ -abstract class JapanBaseTestCase extends PHPUnit_Framework_TestCase +abstract class JapanBaseTestCase extends TestCase { use YasumiBase; /** * Country (name) to be tested */ - const REGION = 'Japan'; + public const REGION = 'Japan'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Asia/Tokyo'; + public const TIMEZONE = 'Asia/Tokyo'; /** * Prefix for short name used when holiday is substituted */ - const SUBSTITUTE_PREFIX = 'substituteHoliday:'; + public const SUBSTITUTE_PREFIX = 'substituteHoliday:'; /** * Locale that is considered common for this provider */ - const LOCALE = 'ja_JP'; + public const LOCALE = 'ja_JP'; } diff --git a/tests/Japan/JapanTest.php b/tests/Japan/JapanTest.php index 18c42cdf2..b69b815f0 100644 --- a/tests/Japan/JapanTest.php +++ b/tests/Japan/JapanTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -26,8 +26,9 @@ class JapanTest extends JapanBaseTestCase /** * Tests if all official holidays in Japan are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -52,32 +53,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Japan are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Japan are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Japan are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Japan are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Japan/LabourThanksgivingDayTest.php b/tests/Japan/LabourThanksgivingDayTest.php index a4660e43d..428c239de 100644 --- a/tests/Japan/LabourThanksgivingDayTest.php +++ b/tests/Japan/LabourThanksgivingDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,16 +25,18 @@ class LabourThanksgivingDayTest extends JapanBaseTestCase implements YasumiTestC /** * The name of the holiday */ - const HOLIDAY = 'laborThanksgivingDay'; + public const HOLIDAY = 'laborThanksgivingDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1948; + public const ESTABLISHMENT_YEAR = 1948; /** * Tests Labor Thanksgiving Day after 1948. Labor Thanksgiving Day is held on November 23rd and established since * 1948. + * @throws \Exception + * @throws \ReflectionException */ public function testLabourThanksgivingDayOnAfter1948() { @@ -50,6 +52,8 @@ public function testLabourThanksgivingDayOnAfter1948() /** * Tests Labor Thanksgiving Day after 1948 substituted next working day (when Labor Thanksgiving Day falls on a * Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testLabourThanksgivingDayOnAfter1948SubstitutedNextWorkingDay() { @@ -65,6 +69,7 @@ public function testLabourThanksgivingDayOnAfter1948SubstitutedNextWorkingDay() /** * Tests Labor Thanksgiving Day before 1948. Labor Thanksgiving Day is held on November 23rd and established since * 1948. + * @throws \ReflectionException */ public function testLabourThanksgivingDayBefore1948() { @@ -77,8 +82,9 @@ public function testLabourThanksgivingDayBefore1948() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -90,8 +96,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/MarineDayTest.php b/tests/Japan/MarineDayTest.php index 290c4f648..494c1545c 100644 --- a/tests/Japan/MarineDayTest.php +++ b/tests/Japan/MarineDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,16 +25,34 @@ class MarineDayTest extends JapanBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'marineDay'; + public const HOLIDAY = 'marineDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1996; + public const ESTABLISHMENT_YEAR = 1996; + + /** + * Tests Marine Day in 2020. Marine Day in 2020 is July 23th for the Olympic Games. + * @throws \Exception + * @throws \ReflectionException + */ + public function testMarineDayIn2020() + { + $year = 2020; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("$year-7-23", new DateTimeZone(self::TIMEZONE)) + ); + } /** * Tests Marine Day after 2003. Marine Day was established since 1996 on July 20th. After 2003 it was changed * to be the third monday of July. + * @throws \Exception + * @throws \ReflectionException */ public function testMarineDayOnAfter2003() { @@ -50,6 +68,8 @@ public function testMarineDayOnAfter2003() /** * Tests Marine Day between 1996 and 2003. Marine Day was established since 1996 on July 20th. After 2003 it was * changed to be the third monday of July. + * @throws \Exception + * @throws \ReflectionException */ public function testMarineDayBetween1996And2003() { @@ -64,6 +84,8 @@ public function testMarineDayBetween1996And2003() /** * Tests Marine Day between 1996 and 2003 substituted next working day (when Marine Day falls on a Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testMarineDayBetween1996And2003SubstitutedNextWorkingDay() { @@ -79,6 +101,7 @@ public function testMarineDayBetween1996And2003SubstitutedNextWorkingDay() /** * Tests Marine Day before 1996. Marine Day was established since 1996 on July 20th. After 2003 it was changed * to be the third monday of July. + * @throws \ReflectionException */ public function testMarineDayBefore1996() { @@ -91,8 +114,9 @@ public function testMarineDayBefore1996() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -104,8 +128,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/MountainDayTest.php b/tests/Japan/MountainDayTest.php index 1701ce173..735a34330 100644 --- a/tests/Japan/MountainDayTest.php +++ b/tests/Japan/MountainDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,15 +25,33 @@ class MountainDayTest extends JapanBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'mountainDay'; + public const HOLIDAY = 'mountainDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 2016; + public const ESTABLISHMENT_YEAR = 2016; + + /** + * Tests Mountain Day in 2020. Mountain Day in 2020 is August 10th for the Olympic Games. + * @throws \Exception + * @throws \ReflectionException + */ + public function testMountainDayIn2020() + { + $year = 2020; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("$year-8-10", new DateTimeZone(self::TIMEZONE)) + ); + } /** * Tests Mountain Day after 2016. Mountain Day was established in 2014 and is held from 2016 on August 11th. + * @throws \Exception + * @throws \ReflectionException */ public function testMountainDayOnAfter2016() { @@ -48,6 +66,8 @@ public function testMountainDayOnAfter2016() /** * Tests Mountain Day after 2016 substituted next working day (when Mountain Day falls on a Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testMountainDayOnAfter2016SubstitutedNextWorkingDay() { @@ -62,6 +82,7 @@ public function testMountainDayOnAfter2016SubstitutedNextWorkingDay() /** * Tests Mountain Day before 2016. Mountain Day was established in 2014 and is held from 2016 on August 11th. + * @throws \ReflectionException */ public function testMountainDayBefore2016() { @@ -74,8 +95,9 @@ public function testMountainDayBefore2016() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -87,8 +109,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/NationalFoundationDayTest.php b/tests/Japan/NationalFoundationDayTest.php index c8647a122..829cc6342 100644 --- a/tests/Japan/NationalFoundationDayTest.php +++ b/tests/Japan/NationalFoundationDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,15 +25,17 @@ class NationalFoundationDayTest extends JapanBaseTestCase implements YasumiTestC /** * The name of the holiday */ - const HOLIDAY = 'nationalFoundationDay'; + public const HOLIDAY = 'nationalFoundationDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1966; + public const ESTABLISHMENT_YEAR = 1966; /** * Tests National Foundation Day after 1966. National Foundation day was established after 1966 + * @throws \Exception + * @throws \ReflectionException */ public function testNationalFoundationDayOnAfter1966() { @@ -49,6 +51,8 @@ public function testNationalFoundationDayOnAfter1966() /** * Tests National Foundation Day after 1966. substituted next working day (when National Foundation Day falls on a * Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testNationalFoundationDayOnAfter1966SubstitutedNextWorkingDay() { @@ -63,6 +67,7 @@ public function testNationalFoundationDayOnAfter1966SubstitutedNextWorkingDay() /** * Tests National Foundation Day before 1966. National Foundation day was established after 1966 + * @throws \ReflectionException */ public function testNationalFoundationDayBefore1966() { @@ -75,8 +80,9 @@ public function testNationalFoundationDayBefore1966() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -88,8 +94,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/NewYearsDayTest.php b/tests/Japan/NewYearsDayTest.php index 845117cc5..1b3fb0f97 100644 --- a/tests/Japan/NewYearsDayTest.php +++ b/tests/Japan/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,15 +25,17 @@ class NewYearsDayTest extends JapanBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1948; + public const ESTABLISHMENT_YEAR = 1948; /** * Tests New Years Day after 1948. New Years Day was established after 1948 + * @throws \Exception + * @throws \ReflectionException */ public function testNewYearsDayOnAfter1948() { @@ -48,6 +50,8 @@ public function testNewYearsDayOnAfter1948() /** * Tests New Years Day after 1948 substituted next working day (when New Years Day falls on a Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testNewYearsDayOnAfter1948SubstitutedNextWorkingDay() { @@ -62,6 +66,7 @@ public function testNewYearsDayOnAfter1948SubstitutedNextWorkingDay() /** * Tests New Years Day before 1948. New Years Day was established after 1948 + * @throws \ReflectionException */ public function testNewYearsDayBefore1948() { @@ -74,8 +79,9 @@ public function testNewYearsDayBefore1948() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -87,8 +93,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/PublicBridgeDayTest.php b/tests/Japan/PublicBridgeDayTest.php index d042762b5..bdc963bf5 100644 --- a/tests/Japan/PublicBridgeDayTest.php +++ b/tests/Japan/PublicBridgeDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,7 +25,7 @@ class PublicBridgeDayTest extends JapanBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'bridgeDay'; + public const HOLIDAY = 'bridgeDay'; /** * @var number representing the calendar year to be tested against */ @@ -33,6 +33,8 @@ class PublicBridgeDayTest extends JapanBaseTestCase implements YasumiTestCaseInt /** * Tests public bridge days. + * @throws \Exception + * @throws \ReflectionException */ public function testPublicBridgeDay() { @@ -46,16 +48,18 @@ public function testPublicBridgeDay() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $this->year, [self::LOCALE => '国民の休日']); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->year, Holiday::TYPE_OFFICIAL); } diff --git a/tests/Japan/RespectForTheAgedDayTest.php b/tests/Japan/RespectForTheAgedDayTest.php index 3d09465b0..ba7070e1a 100644 --- a/tests/Japan/RespectForTheAgedDayTest.php +++ b/tests/Japan/RespectForTheAgedDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,16 +25,18 @@ class RespectForTheAgedDayTest extends JapanBaseTestCase implements YasumiTestCa /** * The name of the holiday */ - const HOLIDAY = 'respectfortheAgedDay'; + public const HOLIDAY = 'respectfortheAgedDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1996; + public const ESTABLISHMENT_YEAR = 1996; /** * Tests Respect for the Aged Day after 2003. Respect for the Aged Day was established since 1996 on September * 15th. After 2003 it was changed to be the third monday of September. + * @throws \Exception + * @throws \ReflectionException */ public function testRespectForTheAgedDayOnAfter2003() { @@ -50,6 +52,8 @@ public function testRespectForTheAgedDayOnAfter2003() /** * Tests Respect for the Aged Day between 1996 and 2003. Respect for the Aged Day was established since 1996 on * September 15th. After 2003 it was changed to be the third monday of September. + * @throws \Exception + * @throws \ReflectionException */ public function testRespectForTheAgedDayBetween1996And2003() { @@ -65,6 +69,8 @@ public function testRespectForTheAgedDayBetween1996And2003() /** * Tests Respect for the Aged Day between 1996 and 2003 substituted next working day (when Respect for the Aged Day * falls on a Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testRespectForTheAgedDayBetween1996And2003SubstitutedNextWorkingDay() { @@ -80,6 +86,7 @@ public function testRespectForTheAgedDayBetween1996And2003SubstitutedNextWorking /** * Tests Respect for the Aged Day before 1996. Respect for the Aged Day was established since 1996 on September * 15th. After 2003 it was changed to be the third monday of September. + * @throws \ReflectionException */ public function testRespectForTheAgedDayBefore1996() { @@ -92,8 +99,9 @@ public function testRespectForTheAgedDayBefore1996() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -105,8 +113,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/ShowaDayTest.php b/tests/Japan/ShowaDayTest.php index 82e2f3d58..380391398 100644 --- a/tests/Japan/ShowaDayTest.php +++ b/tests/Japan/ShowaDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,15 +25,17 @@ class ShowaDayTest extends JapanBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday defined in the test */ - const HOLIDAY = 'showaDay'; + public const HOLIDAY = 'showaDay'; /** * The year in which the holiday defined in the test was first established */ - const ESTABLISHMENT_YEAR = 2007; + public const ESTABLISHMENT_YEAR = 2007; /** * Tests the holiday defined in the test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfter2007() { @@ -48,6 +50,8 @@ public function testHolidayOnAfter2007() /** * Tests the holiday defined in the test on or after the establishment and substituted next working day. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishmentSubstitutedNextWorkingDay() { @@ -62,6 +66,7 @@ public function testHolidayOnAfterEstablishmentSubstitutedNextWorkingDay() /** * Tests the holiday defined in the test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -74,8 +79,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -87,8 +93,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Japan/VernalEquinoxDayTest.php b/tests/Japan/VernalEquinoxDayTest.php index 8422ca986..003671230 100644 --- a/tests/Japan/VernalEquinoxDayTest.php +++ b/tests/Japan/VernalEquinoxDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Japan; @@ -25,12 +25,12 @@ class VernalEquinoxDayTest extends JapanBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'vernalEquinoxDay'; + public const HOLIDAY = 'vernalEquinoxDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1948; + public const ESTABLISHMENT_YEAR = 1948; /** * Tests Vernal Equinox Day after 2150. This national holiday was established in 1948 as a day for the admiration @@ -38,6 +38,7 @@ class VernalEquinoxDayTest extends JapanBaseTestCase implements YasumiTestCaseIn * festival called Shunki kōrei-sai (春季皇霊祭). * * After 2150 no calculations are available yet. + * @throws \ReflectionException */ public function testVernalEquinoxDayOnAfter2150() { @@ -56,6 +57,9 @@ public function testVernalEquinoxDayOnAfter2150() * @param $year int year of example data to be tested * @param $month int month (number) of example data to be tested * @param $day int day of the month (number) of example data to be tested + * + * @throws \ReflectionException + * @throws \Exception */ public function testVernalEquinoxDayBetween1948And2150($year, $month, $day) { @@ -73,7 +77,7 @@ public function testVernalEquinoxDayBetween1948And2150($year, $month, $day) * * @return array list of Japanese Vernal Equinox holidays */ - public function vernalEquinoxHolidaysProvider() + public function vernalEquinoxHolidaysProvider(): array { return [ [1948, 3, 22], @@ -88,6 +92,7 @@ public function vernalEquinoxHolidaysProvider() * Tests Vernal Equinox Day before 1948. This national holiday was established in 1948 as a day for the admiration * of nature and the love of living things. Prior to 1948, the vernal equinox was an imperial ancestor worship * festival called Shunki kōrei-sai (春季皇霊祭). + * @throws \ReflectionException */ public function testVernalEquinoxDayBefore1948() { @@ -102,6 +107,7 @@ public function testVernalEquinoxDayBefore1948() * Tests Vernal Equinox Day between 1851 and 1948. This national holiday was established in 1948 as a day for * the admiration of nature and the love of living things. Prior to 1948, the vernal equinox was an imperial * ancestor worship festival called Shunki kōrei-sai (春季皇霊祭). + * @throws \ReflectionException */ public function testVernalEquinoxDayBetween1851And1948() { @@ -114,8 +120,9 @@ public function testVernalEquinoxDayBetween1851And1948() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -127,8 +134,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Latvia/ChristmasDayTest.php b/tests/Latvia/ChristmasDayTest.php index a33facecf..2e1f26e81 100644 --- a/tests/Latvia/ChristmasDayTest.php +++ b/tests/Latvia/ChristmasDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -26,12 +26,13 @@ class ChristmasDayTest extends LatviaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Latvia/ChristmasEveDayTest.php b/tests/Latvia/ChristmasEveDayTest.php index 75c31ab3d..d1e347aff 100644 --- a/tests/Latvia/ChristmasEveDayTest.php +++ b/tests/Latvia/ChristmasEveDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -26,12 +26,13 @@ class ChristmasEveDayTest extends LatviaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasEve'; + public const HOLIDAY = 'christmasEve'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(12, 24, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Latvia/EasterDayTest.php b/tests/Latvia/EasterDayTest.php index aefcaa98f..89b8be74e 100644 --- a/tests/Latvia/EasterDayTest.php +++ b/tests/Latvia/EasterDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -26,12 +26,13 @@ class EasterDayTest extends LatviaBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomEasterDates(self::TIMEZONE); } @@ -43,6 +44,9 @@ public function holidayDataProvider() * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -56,8 +60,9 @@ public function testHoliday($year, $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -69,8 +74,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Latvia/EasterMondayDayTest.php b/tests/Latvia/EasterMondayDayTest.php index 11b58e61d..e09bd490c 100644 --- a/tests/Latvia/EasterMondayDayTest.php +++ b/tests/Latvia/EasterMondayDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -26,12 +26,13 @@ class EasterMondayDayTest extends LatviaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomEasterMondayDates(self::TIMEZONE); } @@ -43,6 +44,9 @@ public function holidayDataProvider() * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -56,8 +60,9 @@ public function testHoliday($year, $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -69,8 +74,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Latvia/GoodFridayDayTest.php b/tests/Latvia/GoodFridayDayTest.php index 81b963283..7540c9ada 100644 --- a/tests/Latvia/GoodFridayDayTest.php +++ b/tests/Latvia/GoodFridayDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -26,12 +26,13 @@ class GoodFridayDayTest extends LatviaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomGoodFridayDates(self::TIMEZONE); } @@ -43,6 +44,9 @@ public function holidayDataProvider() * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -56,8 +60,9 @@ public function testHoliday($year, $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -69,8 +74,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Latvia/InternationalWorkersDayTest.php b/tests/Latvia/InternationalWorkersDayTest.php index 5fa1e3415..c62a67c71 100644 --- a/tests/Latvia/InternationalWorkersDayTest.php +++ b/tests/Latvia/InternationalWorkersDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -26,12 +26,13 @@ class InternationalWorkersDayTest extends LatviaBaseTestCase implements YasumiTe /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Latvia/LatviaBaseTestCase.php b/tests/Latvia/LatviaBaseTestCase.php index 591ba57c2..69b959567 100644 --- a/tests/Latvia/LatviaBaseTestCase.php +++ b/tests/Latvia/LatviaBaseTestCase.php @@ -3,16 +3,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** @@ -20,22 +21,22 @@ * * @author Gedas Lukošius */ -abstract class LatviaBaseTestCase extends \PHPUnit_Framework_TestCase +abstract class LatviaBaseTestCase extends TestCase { use YasumiBase; /** * Name of the country to be tested */ - const REGION = 'Latvia'; + public const REGION = 'Latvia'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Riga'; + public const TIMEZONE = 'Europe/Riga'; /** * Locale that is considered common for this provider */ - const LOCALE = 'lv_LV'; + public const LOCALE = 'lv_LV'; } diff --git a/tests/Latvia/LatviaTest.php b/tests/Latvia/LatviaTest.php index e817bdee9..4988fda1b 100644 --- a/tests/Latvia/LatviaTest.php +++ b/tests/Latvia/LatviaTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -25,8 +25,9 @@ class LatviaTest extends LatviaBaseTestCase { /** * Tests if all official holidays in Latvia are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $holidays = [ 'newYearsDay', @@ -57,32 +58,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Latvia are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Latvia are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Latvia are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_BANK); } /** * Tests if all other holidays in Latvia are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Latvia/MidsummerEveDayTest.php b/tests/Latvia/MidsummerEveDayTest.php index e8d0b3a3f..9f06d01c0 100644 --- a/tests/Latvia/MidsummerEveDayTest.php +++ b/tests/Latvia/MidsummerEveDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -26,12 +26,13 @@ class MidsummerEveDayTest extends LatviaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'midsummerEveDay'; + public const HOLIDAY = 'midsummerEveDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(6, 23, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Latvia/NewYearsDayTest.php b/tests/Latvia/NewYearsDayTest.php index 811f179d5..89c175080 100644 --- a/tests/Latvia/NewYearsDayTest.php +++ b/tests/Latvia/NewYearsDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -26,12 +26,13 @@ class NewYearsDayTest extends LatviaBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Latvia/NewYearsEveDayTest.php b/tests/Latvia/NewYearsEveDayTest.php index 54fd59a29..09f19955c 100644 --- a/tests/Latvia/NewYearsEveDayTest.php +++ b/tests/Latvia/NewYearsEveDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -26,12 +26,13 @@ class NewYearsEveDayTest extends LatviaBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsEve'; + public const HOLIDAY = 'newYearsEve'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(12, 31, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Latvia/ProclamationOfTheRepublicOfLatviaDayTest.php b/tests/Latvia/ProclamationOfTheRepublicOfLatviaDayTest.php index 88bd91fa2..e68cb1a22 100644 --- a/tests/Latvia/ProclamationOfTheRepublicOfLatviaDayTest.php +++ b/tests/Latvia/ProclamationOfTheRepublicOfLatviaDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -27,10 +27,11 @@ class ProclamationOfTheRepublicOfLatviaDayTest extends LatviaBaseTestCase implem /** * The name of the holiday to be tested */ - const HOLIDAY = 'proclamationOfTheRepublicOfLatviaDay'; + public const HOLIDAY = 'proclamationOfTheRepublicOfLatviaDay'; /** * Test if holiday is not defined before proclamation + * @throws \ReflectionException */ public function testNotHoliday() { @@ -43,8 +44,9 @@ public function testNotHoliday() /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDatesWithHolidayMovedToMonday( 11, @@ -62,6 +64,9 @@ public function holidayDataProvider() * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -75,8 +80,9 @@ public function testHoliday($year, $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -91,8 +97,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Latvia/RestorationOfIndependenceDayTest.php b/tests/Latvia/RestorationOfIndependenceDayTest.php index 80e9986d6..f9ee55aea 100644 --- a/tests/Latvia/RestorationOfIndependenceDayTest.php +++ b/tests/Latvia/RestorationOfIndependenceDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -27,10 +27,11 @@ class RestorationOfIndependenceDayTest extends LatviaBaseTestCase implements Yas /** * The name of the holiday to be tested */ - const HOLIDAY = 'restorationOfIndependenceOfLatviaDay'; + public const HOLIDAY = 'restorationOfIndependenceOfLatviaDay'; /** * Test if holiday is not defined before restoration + * @throws \ReflectionException */ public function testNotHoliday() { @@ -43,8 +44,9 @@ public function testNotHoliday() /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDatesWithHolidayMovedToMonday( 5, @@ -62,6 +64,9 @@ public function holidayDataProvider() * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -75,8 +80,9 @@ public function testHoliday($year, $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -91,8 +97,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Latvia/SecondChristmasDayTest.php b/tests/Latvia/SecondChristmasDayTest.php index 430230f94..7eb0ffce9 100644 --- a/tests/Latvia/SecondChristmasDayTest.php +++ b/tests/Latvia/SecondChristmasDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -26,12 +26,13 @@ class SecondChristmasDayTest extends LatviaBaseTestCase implements YasumiTestCas /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Latvia/StJohnsDayTest.php b/tests/Latvia/StJohnsDayTest.php index 6c2fda9c7..80dfc2b33 100644 --- a/tests/Latvia/StJohnsDayTest.php +++ b/tests/Latvia/StJohnsDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Latvia; @@ -26,12 +26,13 @@ class StJohnsDayTest extends LatviaBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'stJohnsDay'; + public const HOLIDAY = 'stJohnsDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(6, 24, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Lithuania/AllSaintsDayTest.php b/tests/Lithuania/AllSaintsDayTest.php index 9b093e916..50983d4ac 100644 --- a/tests/Lithuania/AllSaintsDayTest.php +++ b/tests/Lithuania/AllSaintsDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -26,12 +26,13 @@ class AllSaintsDayTest extends LithuaniaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Lithuania/AssumptionOfMaryDayTest.php b/tests/Lithuania/AssumptionOfMaryDayTest.php index dc9e9a4aa..5a358fa91 100644 --- a/tests/Lithuania/AssumptionOfMaryDayTest.php +++ b/tests/Lithuania/AssumptionOfMaryDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -26,12 +26,13 @@ class AssumptionOfMaryDayTest extends LithuaniaBaseTestCase implements YasumiTes /** * The name of the holiday to be tested */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Lithuania/ChristmasDayTest.php b/tests/Lithuania/ChristmasDayTest.php index 00b65cd26..798b03be3 100644 --- a/tests/Lithuania/ChristmasDayTest.php +++ b/tests/Lithuania/ChristmasDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -26,12 +26,13 @@ class ChristmasDayTest extends LithuaniaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Lithuania/ChristmasEveDayTest.php b/tests/Lithuania/ChristmasEveDayTest.php index 91138b114..b1e25c710 100644 --- a/tests/Lithuania/ChristmasEveDayTest.php +++ b/tests/Lithuania/ChristmasEveDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -26,12 +26,13 @@ class ChristmasEveDayTest extends LithuaniaBaseTestCase implements YasumiTestCas /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasEve'; + public const HOLIDAY = 'christmasEve'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(12, 24, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Lithuania/EasterDayTest.php b/tests/Lithuania/EasterDayTest.php index 52bd3d25a..04fea788c 100644 --- a/tests/Lithuania/EasterDayTest.php +++ b/tests/Lithuania/EasterDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -26,12 +26,13 @@ class EasterDayTest extends LithuaniaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomEasterDates(self::TIMEZONE); } @@ -43,6 +44,9 @@ public function holidayDataProvider() * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -56,8 +60,9 @@ public function testHoliday($year, $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -69,8 +74,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Lithuania/EasterMondayDayTest.php b/tests/Lithuania/EasterMondayDayTest.php index c1eae15c1..c88b5e179 100644 --- a/tests/Lithuania/EasterMondayDayTest.php +++ b/tests/Lithuania/EasterMondayDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -26,12 +26,13 @@ class EasterMondayDayTest extends LithuaniaBaseTestCase implements YasumiTestCas /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomEasterMondayDates(self::TIMEZONE); } @@ -43,6 +44,9 @@ public function holidayDataProvider() * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -56,8 +60,9 @@ public function testHoliday($year, $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -69,8 +74,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Lithuania/InternationalWorkersDayTest.php b/tests/Lithuania/InternationalWorkersDayTest.php index 8534af6cd..41bc8319e 100644 --- a/tests/Lithuania/InternationalWorkersDayTest.php +++ b/tests/Lithuania/InternationalWorkersDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -26,12 +26,13 @@ class InternationalWorkersDayTest extends LithuaniaBaseTestCase implements Yasum /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Lithuania/LithuaniaBaseTestCase.php b/tests/Lithuania/LithuaniaBaseTestCase.php index 51bbf23da..761dbc054 100644 --- a/tests/Lithuania/LithuaniaBaseTestCase.php +++ b/tests/Lithuania/LithuaniaBaseTestCase.php @@ -3,16 +3,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** @@ -20,22 +21,22 @@ * * @author Gedas Lukošius */ -abstract class LithuaniaBaseTestCase extends \PHPUnit_Framework_TestCase +abstract class LithuaniaBaseTestCase extends TestCase { use YasumiBase; /** * Name of the country to be tested */ - const REGION = 'Lithuania'; + public const REGION = 'Lithuania'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Vilnius'; + public const TIMEZONE = 'Europe/Vilnius'; /** * Locale that is considered common for this provider */ - const LOCALE = 'lt_LT'; + public const LOCALE = 'lt_LT'; } diff --git a/tests/Lithuania/LithuaniaTest.php b/tests/Lithuania/LithuaniaTest.php index 038e0576c..f4d95d7f2 100644 --- a/tests/Lithuania/LithuaniaTest.php +++ b/tests/Lithuania/LithuaniaTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -25,8 +25,9 @@ class LithuaniaTest extends LithuaniaBaseTestCase { /** * Tests if all official holidays in Lithuania are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $holidays = [ 'newYearsDay', @@ -60,32 +61,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Lithuania are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Lithuania are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Lithuania are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_BANK); } /** * Tests if all other holidays in Lithuania are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Lithuania/NewYearsDayTest.php b/tests/Lithuania/NewYearsDayTest.php index b5f9b006c..74d05a0b0 100644 --- a/tests/Lithuania/NewYearsDayTest.php +++ b/tests/Lithuania/NewYearsDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -26,12 +26,13 @@ class NewYearsDayTest extends LithuaniaBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Lithuania/RestorationOfIndependenceOfLithuaniaDayTest.php b/tests/Lithuania/RestorationOfIndependenceOfLithuaniaDayTest.php index adeef54ce..fe901ab69 100644 --- a/tests/Lithuania/RestorationOfIndependenceOfLithuaniaDayTest.php +++ b/tests/Lithuania/RestorationOfIndependenceOfLithuaniaDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -27,10 +27,11 @@ class RestorationOfIndependenceOfLithuaniaDayTest extends LithuaniaBaseTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'restorationOfIndependenceOfLithuaniaDay'; + public const HOLIDAY = 'restorationOfIndependenceOfLithuaniaDay'; /** * Test if holiday is not defined before restoration + * @throws \ReflectionException */ public function testHolidayBeforeRestoration() { @@ -43,6 +44,8 @@ public function testHolidayBeforeRestoration() /** * Test if holiday is defined after restoration + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayAfterRestoration() { @@ -58,8 +61,10 @@ public function testHolidayAfterRestoration() /** * {@inheritdoc} + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -77,8 +82,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Lithuania/RestorationOfTheStateOfLithuaniaDayTest.php b/tests/Lithuania/RestorationOfTheStateOfLithuaniaDayTest.php index d5d37e08e..576d192d7 100644 --- a/tests/Lithuania/RestorationOfTheStateOfLithuaniaDayTest.php +++ b/tests/Lithuania/RestorationOfTheStateOfLithuaniaDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -27,10 +27,11 @@ class RestorationOfTheStateOfLithuaniaDayTest extends LithuaniaBaseTestCase impl /** * The name of the holiday to be tested */ - const HOLIDAY = 'restorationOfTheStateOfLithuaniaDay'; + public const HOLIDAY = 'restorationOfTheStateOfLithuaniaDay'; /** * Test if holiday is not defined before restoration + * @throws \ReflectionException */ public function testHolidayBeforeRestoration() { @@ -43,6 +44,8 @@ public function testHolidayBeforeRestoration() /** * Test if holiday is defined after restoration + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayAfterRestoration() { @@ -58,8 +61,10 @@ public function testHolidayAfterRestoration() /** * {@inheritdoc} + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -77,8 +82,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Lithuania/SecondChristmasDayTest.php b/tests/Lithuania/SecondChristmasDayTest.php index 0802d9703..e4922fd99 100644 --- a/tests/Lithuania/SecondChristmasDayTest.php +++ b/tests/Lithuania/SecondChristmasDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -26,12 +26,13 @@ class SecondChristmasDayTest extends LithuaniaBaseTestCase implements YasumiTest /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Lithuania/StJohnsDayTest.php b/tests/Lithuania/StJohnsDayTest.php index 4e4a04d72..f93c97d54 100644 --- a/tests/Lithuania/StJohnsDayTest.php +++ b/tests/Lithuania/StJohnsDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -26,12 +26,13 @@ class StJohnsDayTest extends LithuaniaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'stJohnsDay'; + public const HOLIDAY = 'stJohnsDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(6, 24, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Lithuania/StatehoodDayTest.php b/tests/Lithuania/StatehoodDayTest.php index 8b80d1270..0cb69ff74 100644 --- a/tests/Lithuania/StatehoodDayTest.php +++ b/tests/Lithuania/StatehoodDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Lithuania; @@ -27,10 +27,11 @@ class StatehoodDayTest extends LithuaniaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'statehoodDay'; + public const HOLIDAY = 'statehoodDay'; /** * Test if holiday is not defined before restoration + * @throws \ReflectionException */ public function testHolidayBeforeRestoration() { @@ -43,6 +44,8 @@ public function testHolidayBeforeRestoration() /** * Test if holiday is defined after restoration + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayAfterRestoration() { @@ -58,8 +61,10 @@ public function testHolidayAfterRestoration() /** * {@inheritdoc} + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -77,8 +82,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Netherlands/AscensionDayTest.php b/tests/Netherlands/AscensionDayTest.php index 0bafc549e..d737ba2be 100644 --- a/tests/Netherlands/AscensionDayTest.php +++ b/tests/Netherlands/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,10 +25,12 @@ class AscensionDayTest extends NetherlandsBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Netherlands/AshWednesdayTest.php b/tests/Netherlands/AshWednesdayTest.php index d0700d288..6576c79df 100644 --- a/tests/Netherlands/AshWednesdayTest.php +++ b/tests/Netherlands/AshWednesdayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,10 +25,12 @@ class AshWednesdayTest extends NetherlandsBaseTestCase implements YasumiTestCase /** * The name of the holiday */ - const HOLIDAY = 'ashWednesday'; + public const HOLIDAY = 'ashWednesday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of Ash Wednesday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Netherlands/ChristmasDayTest.php b/tests/Netherlands/ChristmasDayTest.php index 288b6a7da..508bdd5a6 100644 --- a/tests/Netherlands/ChristmasDayTest.php +++ b/tests/Netherlands/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -24,7 +24,7 @@ class ChristmasDayTest extends NetherlandsBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ChristmasDayTest extends NetherlandsBaseTestCase implements YasumiTestCase * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Netherlands/CommemorationDayTest.php b/tests/Netherlands/CommemorationDayTest.php index 80790da83..9050043ce 100644 --- a/tests/Netherlands/CommemorationDayTest.php +++ b/tests/Netherlands/CommemorationDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,15 +25,16 @@ class CommemorationDayTest extends NetherlandsBaseTestCase implements YasumiTest /** * The name of the holiday */ - const HOLIDAY = 'commemorationDay'; + public const HOLIDAY = 'commemorationDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1947; + public const ESTABLISHMENT_YEAR = 1947; /** * Tests Commemoration Day before 1947. Commemoration Day was established after WWII in 1947. + * @throws \ReflectionException */ public function testCommemorationDayBefore1947() { @@ -46,6 +47,8 @@ public function testCommemorationDayBefore1947() /** * Tests Commemoration Day after 1947. Commemoration Day was established after WWII in 1947. + * @throws \Exception + * @throws \ReflectionException */ public function testCommemorationDayOnAfter1947() { @@ -60,8 +63,9 @@ public function testCommemorationDayOnAfter1947() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Netherlands/EasterMondayTest.php b/tests/Netherlands/EasterMondayTest.php index 33cc1c6eb..d12746fc8 100644 --- a/tests/Netherlands/EasterMondayTest.php +++ b/tests/Netherlands/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,10 +25,12 @@ class EasterMondayTest extends NetherlandsBaseTestCase implements YasumiTestCase /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Netherlands/EasterTest.php b/tests/Netherlands/EasterTest.php index a5a09c851..32c9d1a37 100644 --- a/tests/Netherlands/EasterTest.php +++ b/tests/Netherlands/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,10 +25,12 @@ class EasterTest extends NetherlandsBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests Easter. + * @throws \Exception + * @throws \ReflectionException */ public function testEaster() { @@ -43,8 +45,9 @@ public function testEaster() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Netherlands/EpiphanyTest.php b/tests/Netherlands/EpiphanyTest.php index 06cc8c6a4..cfdf9f4a9 100644 --- a/tests/Netherlands/EpiphanyTest.php +++ b/tests/Netherlands/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -24,7 +24,7 @@ class EpiphanyTest extends NetherlandsBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** * Tests Epiphany. @@ -33,6 +33,8 @@ class EpiphanyTest extends NetherlandsBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which Epiphany needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testEpiphany($year, $expected) { @@ -43,16 +45,18 @@ public function testEpiphany($year, $expected) * Returns a list of random test dates used for assertion of Epiphany. * * @return array list of test dates for Epiphany + * @throws \Exception */ - public function EpiphanyDataProvider() + public function EpiphanyDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Netherlands/FathersDayTest.php b/tests/Netherlands/FathersDayTest.php index 4fc9f5187..ed4577d20 100644 --- a/tests/Netherlands/FathersDayTest.php +++ b/tests/Netherlands/FathersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,10 +25,12 @@ class FathersDayTest extends NetherlandsBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'fathersDay'; + public const HOLIDAY = 'fathersDay'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Netherlands/GoodFridayTest.php b/tests/Netherlands/GoodFridayTest.php index 2c2cbb6b7..df2eb3075 100644 --- a/tests/Netherlands/GoodFridayTest.php +++ b/tests/Netherlands/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,10 +25,12 @@ class GoodFridayTest extends NetherlandsBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests Good Friday. + * @throws \Exception + * @throws \ReflectionException */ public function testGoodFriday() { @@ -43,8 +45,9 @@ public function testGoodFriday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Netherlands/HalloweenTest.php b/tests/Netherlands/HalloweenTest.php index 7b5149c34..35585826c 100644 --- a/tests/Netherlands/HalloweenTest.php +++ b/tests/Netherlands/HalloweenTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -24,7 +24,7 @@ class HalloweenTest extends NetherlandsBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'halloween'; + public const HOLIDAY = 'halloween'; /** * Tests Halloween. @@ -33,6 +33,8 @@ class HalloweenTest extends NetherlandsBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which Halloween needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of Halloween. * * @return array list of test dates for Halloween + * @throws \Exception */ - public function HalloweenDataProvider() + public function HalloweenDataProvider(): array { return $this->generateRandomDates(10, 31, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Netherlands/InternationalWorkersDayTest.php b/tests/Netherlands/InternationalWorkersDayTest.php index edf1728fc..86fad8cde 100644 --- a/tests/Netherlands/InternationalWorkersDayTest.php +++ b/tests/Netherlands/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends NetherlandsBaseTestCase implements Yas /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests International Workers' Day. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends NetherlandsBaseTestCase implements Yas * * @param int $year the year for which International Workers' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testInternationalWorkersDay($year, $expected) { @@ -43,16 +45,18 @@ public function testInternationalWorkersDay($year, $expected) * Returns a list of random test dates used for assertion of International Workers' Day. * * @return array list of test dates for International Workers' Day + * @throws \Exception */ - public function InternationalWorkersDayDataProvider() + public function InternationalWorkersDayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Netherlands/KingsDayTest.php b/tests/Netherlands/KingsDayTest.php index 03a03535f..3ba65e6f3 100644 --- a/tests/Netherlands/KingsDayTest.php +++ b/tests/Netherlands/KingsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,15 +25,17 @@ class KingsDayTest extends NetherlandsBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'kingsDay'; + public const HOLIDAY = 'kingsDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 2014; + public const ESTABLISHMENT_YEAR = 2014; /** * Tests Kings Day on or after 2014. King's Day is celebrated from 2014 onwards on April 27th. + * @throws \Exception + * @throws \ReflectionException */ public function testKingsDayOnAfter2014() { @@ -48,6 +50,8 @@ public function testKingsDayOnAfter2014() /** * Tests Kings Day substituted on Saturday (when Kings Day falls on a Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testKingsDayOnAfter2014SubstitutedDay() { @@ -62,6 +66,7 @@ public function testKingsDayOnAfter2014SubstitutedDay() /** * Tests Kings Day before 2014. King's Day is celebrated from 2014 onwards on April 27th. + * @throws \ReflectionException */ public function testKingsDayBefore2014() { @@ -74,8 +79,9 @@ public function testKingsDayBefore2014() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -87,8 +93,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Netherlands/LiberationDayTest.php b/tests/Netherlands/LiberationDayTest.php index b13e60599..f8e4ad60c 100644 --- a/tests/Netherlands/LiberationDayTest.php +++ b/tests/Netherlands/LiberationDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,15 +25,16 @@ class LiberationDayTest extends NetherlandsBaseTestCase implements YasumiTestCas /** * The name of the holiday */ - const HOLIDAY = 'liberationDay'; + public const HOLIDAY = 'liberationDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1947; + public const ESTABLISHMENT_YEAR = 1947; /** * Tests Liberation Day before 1947. Liberation Day was established after WWII in 1947. + * @throws \ReflectionException */ public function testLiberationDayBefore1947() { @@ -46,6 +47,8 @@ public function testLiberationDayBefore1947() /** * Tests Liberation Day after 1947. Liberation Day was established after WWII in 1947. + * @throws \Exception + * @throws \ReflectionException */ public function testLiberationDayOnAfter1947() { @@ -60,8 +63,9 @@ public function testLiberationDayOnAfter1947() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Netherlands/MothersDayTest.php b/tests/Netherlands/MothersDayTest.php index 83f5ffe11..27c521267 100644 --- a/tests/Netherlands/MothersDayTest.php +++ b/tests/Netherlands/MothersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,10 +25,12 @@ class MothersDayTest extends NetherlandsBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'mothersDay'; + public const HOLIDAY = 'mothersDay'; /** * Tests Mother's Day. + * @throws \Exception + * @throws \ReflectionException */ public function testMothersDay() { @@ -43,8 +45,9 @@ public function testMothersDay() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Netherlands/NetherlandsBaseTestCase.php b/tests/Netherlands/NetherlandsBaseTestCase.php index 3b830006e..25b8b02b4 100644 --- a/tests/Netherlands/NetherlandsBaseTestCase.php +++ b/tests/Netherlands/NetherlandsBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Netherlands holiday provider. */ -abstract class NetherlandsBaseTestCase extends PHPUnit_Framework_TestCase +abstract class NetherlandsBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Netherlands'; + public const REGION = 'Netherlands'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Amsterdam'; + public const TIMEZONE = 'Europe/Amsterdam'; /** * Locale that is considered common for this provider */ - const LOCALE = 'nl_NL'; + public const LOCALE = 'nl_NL'; } diff --git a/tests/Netherlands/NetherlandsTest.php b/tests/Netherlands/NetherlandsTest.php index 8915af74d..2dacd5ce1 100644 --- a/tests/Netherlands/NetherlandsTest.php +++ b/tests/Netherlands/NetherlandsTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -26,8 +26,9 @@ class NetherlandsTest extends NetherlandsBaseTestCase /** * Tests if all official holidays in Netherlands are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -44,8 +45,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Netherlands are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'stMartinsDay', @@ -63,24 +65,28 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Netherlands are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { - $this->assertDefinedHolidays(['summerTime', 'winterTime'], self::REGION, $this->year, Holiday::TYPE_SEASON); + $year = $this->generateRandomYear(1978, 2037); + $this->assertDefinedHolidays(['summerTime', 'winterTime'], self::REGION, $year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Netherlands are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Netherlands are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([ 'internationalWorkersDay', diff --git a/tests/Netherlands/NewYearsDayTest.php b/tests/Netherlands/NewYearsDayTest.php index 5cedb503a..08a40a1dd 100644 --- a/tests/Netherlands/NewYearsDayTest.php +++ b/tests/Netherlands/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -24,7 +24,7 @@ class NewYearsDayTest extends NetherlandsBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends NetherlandsBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -43,16 +45,18 @@ public function testNewYearsDay($year, $expected) * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Netherlands/PentecostTest.php b/tests/Netherlands/PentecostTest.php index 2ec78eabe..aa8d08517 100644 --- a/tests/Netherlands/PentecostTest.php +++ b/tests/Netherlands/PentecostTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,10 +25,12 @@ class PentecostTest extends NetherlandsBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Netherlands/QueensDayTest.php b/tests/Netherlands/QueensDayTest.php index e2107094e..99ab5a78e 100644 --- a/tests/Netherlands/QueensDayTest.php +++ b/tests/Netherlands/QueensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,10 +25,12 @@ class QueensDayTest extends NetherlandsBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'queensDay'; + public const HOLIDAY = 'queensDay'; /** * Tests Queens Day between 1891 and 1948. + * @throws \Exception + * @throws \ReflectionException */ public function testQueensBetween1891and1948() { @@ -43,6 +45,8 @@ public function testQueensBetween1891and1948() /** * Tests Queens Day between 1891 and 1948 substituted one day later (when Queens Day falls on a Sunday). + * @throws \Exception + * @throws \ReflectionException */ public function testQueensBetween1891and1948SubstitutedLater() { @@ -57,6 +61,8 @@ public function testQueensBetween1891and1948SubstitutedLater() /** * Tests Queens Day between 1949 and 2013. + * @throws \Exception + * @throws \ReflectionException */ public function testQueensBetween1949and2013() { @@ -71,6 +77,8 @@ public function testQueensBetween1949and2013() /** * Tests Queens Day between 1949 and 2013 substituted one day later. + * @throws \Exception + * @throws \ReflectionException */ public function testQueensBetween1949and2013SubstitutedLater() { @@ -85,6 +93,8 @@ public function testQueensBetween1949and2013SubstitutedLater() /** * Tests Queens Day between 1949 and 2013 substituted one day earlier. + * @throws \Exception + * @throws \ReflectionException */ public function testQueensBetween1949and2013SubstitutedEarlier() { @@ -99,6 +109,7 @@ public function testQueensBetween1949and2013SubstitutedEarlier() /** * Tests Queen's Day before 1891. + * @throws \ReflectionException */ public function testQueensDayBefore1891() { @@ -107,6 +118,7 @@ public function testQueensDayBefore1891() /** * Tests Queen's Day after 2013. + * @throws \ReflectionException */ public function testQueensDayAfter2013() { @@ -115,8 +127,9 @@ public function testQueensDayAfter2013() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -128,8 +141,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Netherlands/SummertimeTest.php b/tests/Netherlands/SummertimeTest.php index 36d4abd48..4334f3ee3 100644 --- a/tests/Netherlands/SummertimeTest.php +++ b/tests/Netherlands/SummertimeTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,14 +25,27 @@ class SummertimeTest extends NetherlandsBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'summerTime'; + public const HOLIDAY = 'summerTime'; /** * Tests Summertime. + * + * @throws \Exception + * @throws \ReflectionException */ public function testSummertime() { - $year = $this->generateRandomYear(); + $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(1946, 1976)); + + $year = $this->generateRandomYear(1977, 1980); + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("first sunday of april $year", new DateTimeZone(self::TIMEZONE)) + ); + + $year = $this->generateRandomYear(1981, 2036); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -43,22 +56,24 @@ public function testSummertime() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + $this->generateRandomYear(1978, 2037), [self::LOCALE => 'Zomertijd'] ); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_SEASON); + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1978, 2037), Holiday::TYPE_SEASON); } } diff --git a/tests/Netherlands/ValentinesDayTest.php b/tests/Netherlands/ValentinesDayTest.php index c0c15d59b..9344b667b 100644 --- a/tests/Netherlands/ValentinesDayTest.php +++ b/tests/Netherlands/ValentinesDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -24,7 +24,7 @@ class ValentinesDayTest extends NetherlandsBaseTestCase implements YasumiTestCas /** * The name of the holiday */ - const HOLIDAY = 'valentinesDay'; + public const HOLIDAY = 'valentinesDay'; /** * Tests Valentines Day. @@ -33,6 +33,8 @@ class ValentinesDayTest extends NetherlandsBaseTestCase implements YasumiTestCas * * @param int $year the year for which Valentines Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testValentinesDay($year, $expected) { @@ -43,8 +45,9 @@ public function testValentinesDay($year, $expected) * Returns a list of random test dates used for assertion of Valentines Day. * * @return array list of test dates for Valentines Day + * @throws \Exception */ - public function ValentinesDayDataProvider() + public function ValentinesDayDataProvider(): array { return $this->generateRandomDates(2, 14, self::TIMEZONE); } @@ -52,16 +55,18 @@ public function ValentinesDayDataProvider() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, diff --git a/tests/Netherlands/WintertimeTest.php b/tests/Netherlands/WintertimeTest.php index 375f797d0..e5fcdf126 100644 --- a/tests/Netherlands/WintertimeTest.php +++ b/tests/Netherlands/WintertimeTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,14 +25,26 @@ class WintertimeTest extends NetherlandsBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'winterTime'; + public const HOLIDAY = 'winterTime'; /** * Tests Wintertime. + * @throws \Exception + * @throws \ReflectionException */ public function testWintertime() { - $year = $this->generateRandomYear(); + $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(1946, 1976)); + + $year = $this->generateRandomYear(1979, 1995); + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("last sunday of september $year", new DateTimeZone(self::TIMEZONE)) + ); + + $year = $this->generateRandomYear(1996, 2037); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -43,22 +55,24 @@ public function testWintertime() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + $this->generateRandomYear(1978, 2037), [self::LOCALE => 'Wintertijd'] ); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_SEASON); + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1978, 2037), Holiday::TYPE_SEASON); } } diff --git a/tests/Netherlands/WorldAnimalDayTest.php b/tests/Netherlands/WorldAnimalDayTest.php index 693f210fb..aa44862ce 100644 --- a/tests/Netherlands/WorldAnimalDayTest.php +++ b/tests/Netherlands/WorldAnimalDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,15 +25,17 @@ class WorldAnimalDayTest extends NetherlandsBaseTestCase implements YasumiTestCa /** * The name of the holiday */ - const HOLIDAY = 'worldAnimalDay'; + public const HOLIDAY = 'worldAnimalDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1931; + public const ESTABLISHMENT_YEAR = 1931; /** * Tests World Animal Day on or after 1931. + * @throws \Exception + * @throws \ReflectionException */ public function testWorldAnimalDayOnAfter1931() { @@ -48,6 +50,7 @@ public function testWorldAnimalDayOnAfter1931() /** * Tests World Animal Day before 1931. + * @throws \ReflectionException */ public function testWorldAnimalBefore1931() { @@ -60,8 +63,9 @@ public function testWorldAnimalBefore1931() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, @@ -73,8 +77,9 @@ public function testHolidayType() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, diff --git a/tests/Netherlands/carnivalDayTest.php b/tests/Netherlands/carnivalDayTest.php index 3dd830c02..8518936c3 100644 --- a/tests/Netherlands/carnivalDayTest.php +++ b/tests/Netherlands/carnivalDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -26,10 +26,12 @@ class carnivalDayTest extends NetherlandsBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'carnivalDay'; + public const HOLIDAY = 'carnivalDay'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -44,16 +46,18 @@ public function testHoliday() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, diff --git a/tests/Netherlands/pentecostMondayTest.php b/tests/Netherlands/pentecostMondayTest.php index a7e943ef8..8d3bd7797 100644 --- a/tests/Netherlands/pentecostMondayTest.php +++ b/tests/Netherlands/pentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,10 +25,12 @@ class pentecostMondayTest extends NetherlandsBaseTestCase implements YasumiTestC /** * The name of the holiday to be tested */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Netherlands/princesDayTest.php b/tests/Netherlands/princesDayTest.php index 8a2c5589d..ca696b1f0 100644 --- a/tests/Netherlands/princesDayTest.php +++ b/tests/Netherlands/princesDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,10 +25,12 @@ class princesDayTest extends NetherlandsBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'princesDay'; + public const HOLIDAY = 'princesDay'; /** * Tests Prince's Day. + * @throws \Exception + * @throws \ReflectionException */ public function testPrincesDay() { @@ -43,8 +45,9 @@ public function testPrincesDay() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Netherlands/secondCarnivalDay.php b/tests/Netherlands/secondCarnivalDay.php index 1a086a28b..88fc749cd 100644 --- a/tests/Netherlands/secondCarnivalDay.php +++ b/tests/Netherlands/secondCarnivalDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -26,7 +26,7 @@ class secondCarnivalDay extends NetherlandsBaseTestCase implements YasumiTestCas /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondCarnivalDay'; + public const HOLIDAY = 'secondCarnivalDay'; /** * Tests the holiday defined in this test. @@ -35,6 +35,8 @@ class secondCarnivalDay extends NetherlandsBaseTestCase implements YasumiTestCas * @throws \InvalidArgumentException * @throws \PHPUnit_Framework_AssertionFailedError * @throws \RuntimeException + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday() { @@ -54,8 +56,9 @@ public function testHoliday() * @throws \PHPUnit_Framework_AssertionFailedError * @throws \RuntimeException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } @@ -67,8 +70,9 @@ public function testHolidayType() * @throws \PHPUnit_Framework_AssertionFailedError * @throws \RuntimeException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, diff --git a/tests/Netherlands/secondChristmasdayTest.php b/tests/Netherlands/secondChristmasdayTest.php index 392ab9cc0..4371d8a18 100644 --- a/tests/Netherlands/secondChristmasdayTest.php +++ b/tests/Netherlands/secondChristmasdayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -24,7 +24,7 @@ class secondChristmasdayTest extends NetherlandsBaseTestCase implements YasumiTe /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class secondChristmasdayTest extends NetherlandsBaseTestCase implements YasumiTe * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Netherlands/stMartinsDayTest.php b/tests/Netherlands/stMartinsDayTest.php index b4fddc4c7..8d83a33e8 100644 --- a/tests/Netherlands/stMartinsDayTest.php +++ b/tests/Netherlands/stMartinsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -24,7 +24,7 @@ class stMartinsDayTest extends NetherlandsBaseTestCase implements YasumiTestCase /** * The name of the holiday */ - const HOLIDAY = 'stMartinsDay'; + public const HOLIDAY = 'stMartinsDay'; /** * Tests Sint Martins Day. @@ -33,6 +33,8 @@ class stMartinsDayTest extends NetherlandsBaseTestCase implements YasumiTestCase * * @param int $year the year for which Sint Martins Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function teststMartinsDay($year, $expected) { @@ -43,16 +45,18 @@ public function teststMartinsDay($year, $expected) * Returns a list of random test dates used for assertion of Sint Martins Day. * * @return array list of test dates for Sint Martins Day + * @throws \Exception */ - public function stMartinsDayDataProvider() + public function stMartinsDayDataProvider(): array { return $this->generateRandomDates(11, 11, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Netherlands/stNicholasDayTest.php b/tests/Netherlands/stNicholasDayTest.php index 2c7417d5d..13c76dfb0 100644 --- a/tests/Netherlands/stNicholasDayTest.php +++ b/tests/Netherlands/stNicholasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -25,7 +25,7 @@ class stNicholasDayTest extends NetherlandsBaseTestCase implements YasumiTestCas /** * The name of the holiday */ - const HOLIDAY = 'stNicholasDay'; + public const HOLIDAY = 'stNicholasDay'; /** * Tests Sint Nicholas Day. @@ -34,6 +34,8 @@ class stNicholasDayTest extends NetherlandsBaseTestCase implements YasumiTestCas * * @param int $year the year for which Sint Nicholas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function teststNicholasDay($year, $expected) { @@ -44,16 +46,18 @@ public function teststNicholasDay($year, $expected) * Returns a list of random test dates used for assertion of Sint Nicholas Day. * * @return array list of test dates for Sint Nicholas Day + * @throws \Exception */ - public function stNicholasDayDataProvider() + public function stNicholasDayDataProvider(): array { return $this->generateRandomDates(12, 5, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -65,8 +69,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Netherlands/thirdCarnivalDay.php b/tests/Netherlands/thirdCarnivalDay.php index c40a567d4..a6ff63f68 100644 --- a/tests/Netherlands/thirdCarnivalDay.php +++ b/tests/Netherlands/thirdCarnivalDay.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Netherlands; @@ -26,7 +26,7 @@ class thirdCarnivalDay extends NetherlandsBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'thirdCarnivalDay'; + public const HOLIDAY = 'thirdCarnivalDay'; /** * Tests the holiday defined in this test. @@ -35,6 +35,8 @@ class thirdCarnivalDay extends NetherlandsBaseTestCase implements YasumiTestCase * @throws \InvalidArgumentException * @throws \PHPUnit_Framework_AssertionFailedError * @throws \RuntimeException + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday() { @@ -54,8 +56,9 @@ public function testHoliday() * @throws \PHPUnit_Framework_AssertionFailedError * @throws \RuntimeException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } @@ -67,8 +70,9 @@ public function testHolidayType() * @throws \PHPUnit_Framework_AssertionFailedError * @throws \RuntimeException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, diff --git a/tests/NewZealand/AnzacDayTest.php b/tests/NewZealand/AnzacDayTest.php index 9dc00b424..5cb489905 100644 --- a/tests/NewZealand/AnzacDayTest.php +++ b/tests/NewZealand/AnzacDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\NewZealand; @@ -25,12 +25,12 @@ class AnzacDayTest extends NewZealandBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'anzacDay'; + public const HOLIDAY = 'anzacDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1921; + public const ESTABLISHMENT_YEAR = 1921; /** * Tests ANZAC Day @@ -39,6 +39,9 @@ class AnzacDayTest extends NewZealandBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -52,6 +55,7 @@ public function testHoliday($year, $expected) /** * Tests that Labour Day is not present before 1921 + * @throws \ReflectionException */ public function testNotHoliday() { @@ -62,8 +66,9 @@ public function testNotHoliday() * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDatesWithModifier(4, 25, function ($year, \DateTime $date) { // in 2015 some policy was introduced to make sure this holiday was celebrated during the working week. @@ -75,8 +80,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -88,8 +94,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/NewZealand/BoxingDayTest.php b/tests/NewZealand/BoxingDayTest.php index c83db05d7..bc901a052 100644 --- a/tests/NewZealand/BoxingDayTest.php +++ b/tests/NewZealand/BoxingDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\NewZealand; @@ -26,7 +26,7 @@ class BoxingDayTest extends NewZealandBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * Tests Boxing Day @@ -35,6 +35,9 @@ class BoxingDayTest extends NewZealandBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -50,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -59,7 +63,7 @@ public function HolidayDataProvider() $year = $this->generateRandomYear(); $date = new DateTime("$year-12-26", new DateTimeZone(self::TIMEZONE)); - if (in_array((int)$date->format('w'), [0, 6], true)) { + if (\in_array((int)$date->format('w'), [0, 6], true)) { $date->add(new DateInterval('P2D')); } @@ -71,8 +75,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -84,8 +89,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/NewZealand/ChristmasDayTest.php b/tests/NewZealand/ChristmasDayTest.php index 1197a9ea9..9c5a49d14 100644 --- a/tests/NewZealand/ChristmasDayTest.php +++ b/tests/NewZealand/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\NewZealand; @@ -26,7 +26,7 @@ class ChristmasDayTest extends NewZealandBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day @@ -35,6 +35,9 @@ class ChristmasDayTest extends NewZealandBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -50,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -59,7 +63,7 @@ public function HolidayDataProvider() $year = $this->generateRandomYear(); $date = new DateTime("$year-12-25", new DateTimeZone(self::TIMEZONE)); - if (in_array((int)$date->format('w'), [0, 6], true)) { + if (\in_array((int)$date->format('w'), [0, 6], true)) { $date->add(new DateInterval('P2D')); } @@ -71,8 +75,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -84,8 +89,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/NewZealand/DayAfterNewYearsDayTest.php b/tests/NewZealand/DayAfterNewYearsDayTest.php index 4d5d0f50e..c7f15b83f 100644 --- a/tests/NewZealand/DayAfterNewYearsDayTest.php +++ b/tests/NewZealand/DayAfterNewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\NewZealand; @@ -26,7 +26,7 @@ class DayAfterNewYearsDayTest extends NewZealandBaseTestCase implements YasumiTe /** * The name of the holiday */ - const HOLIDAY = 'dayAfterNewYearsDay'; + public const HOLIDAY = 'dayAfterNewYearsDay'; /** * Tests Day After New Years Day @@ -35,6 +35,9 @@ class DayAfterNewYearsDayTest extends NewZealandBaseTestCase implements YasumiTe * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -48,8 +51,9 @@ public function testHoliday($year, $expected) /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -61,8 +65,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -71,8 +76,9 @@ public function testHolidayType() * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; diff --git a/tests/NewZealand/EasterMondayTest.php b/tests/NewZealand/EasterMondayTest.php index f0945ed59..f6e0fe56c 100644 --- a/tests/NewZealand/EasterMondayTest.php +++ b/tests/NewZealand/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\NewZealand; @@ -26,7 +26,7 @@ class EasterMondayTest extends NewZealandBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday @@ -35,6 +35,9 @@ class EasterMondayTest extends NewZealandBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -50,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -68,8 +72,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -81,8 +86,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/NewZealand/GoodFridayTest.php b/tests/NewZealand/GoodFridayTest.php index 3cdd2c4c6..adeeae15f 100644 --- a/tests/NewZealand/GoodFridayTest.php +++ b/tests/NewZealand/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\NewZealand; @@ -26,7 +26,7 @@ class GoodFridayTest extends NewZealandBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests Good Friday @@ -35,6 +35,9 @@ class GoodFridayTest extends NewZealandBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -50,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -67,8 +71,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -80,8 +85,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/NewZealand/LabourDayTest.php b/tests/NewZealand/LabourDayTest.php index 66ae167d8..cb554fb23 100644 --- a/tests/NewZealand/LabourDayTest.php +++ b/tests/NewZealand/LabourDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\NewZealand; @@ -25,12 +25,12 @@ class LabourDayTest extends NewZealandBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'labourDay'; + public const HOLIDAY = 'labourDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1900; + public const ESTABLISHMENT_YEAR = 1900; /** * Tests Labour Day @@ -39,6 +39,9 @@ class LabourDayTest extends NewZealandBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -52,6 +55,7 @@ public function testHoliday($year, $expected) /** * Tests that Labour Day is not present before 1900 + * @throws \ReflectionException */ public function testNotHoliday() { @@ -62,8 +66,9 @@ public function testNotHoliday() * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -82,8 +87,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -95,8 +101,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/NewZealand/NewYearsDayTest.php b/tests/NewZealand/NewYearsDayTest.php index 3c2eb3582..b408bff8b 100644 --- a/tests/NewZealand/NewYearsDayTest.php +++ b/tests/NewZealand/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\NewZealand; @@ -26,7 +26,7 @@ class NewYearsDayTest extends NewZealandBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day @@ -35,6 +35,9 @@ class NewYearsDayTest extends NewZealandBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -50,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -76,8 +80,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -89,8 +94,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/NewZealand/NewZealandBaseTestCase.php b/tests/NewZealand/NewZealandBaseTestCase.php index ab72a8ecb..dcd2e9598 100644 --- a/tests/NewZealand/NewZealandBaseTestCase.php +++ b/tests/NewZealand/NewZealandBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\NewZealand; -use PHPUnit_Framework_TestCase; +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 +abstract class NewZealandBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'NewZealand'; + public const REGION = 'NewZealand'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Pacific/Auckland'; + public const TIMEZONE = 'Pacific/Auckland'; /** * Locale that is considered common for this provider */ - const LOCALE = 'en_NZ'; + public const LOCALE = 'en_NZ'; } diff --git a/tests/NewZealand/NewZealandTest.php b/tests/NewZealand/NewZealandTest.php index 589f20afc..2cc6f8a0f 100644 --- a/tests/NewZealand/NewZealandTest.php +++ b/tests/NewZealand/NewZealandTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\NewZealand; @@ -26,8 +26,9 @@ class NewZealandTest extends NewZealandBaseTestCase /** * Tests if all official holidays in New Zealand are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -44,32 +45,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in New Zealand are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in New Zealand are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in New Zealand are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in New Zealand are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/NewZealand/QueensBirthdayTest.php b/tests/NewZealand/QueensBirthdayTest.php index fde1c942a..48a8bd3a5 100644 --- a/tests/NewZealand/QueensBirthdayTest.php +++ b/tests/NewZealand/QueensBirthdayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\NewZealand; @@ -25,12 +25,12 @@ class QueensBirthdayTest extends NewZealandBaseTestCase implements YasumiTestCas /** * The name of the holiday */ - const HOLIDAY = 'queensBirthday'; + public const HOLIDAY = 'queensBirthday'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1952; + public const ESTABLISHMENT_YEAR = 1952; /** * Tests Queens Birthday @@ -39,6 +39,8 @@ class QueensBirthdayTest extends NewZealandBaseTestCase implements YasumiTestCas * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -47,6 +49,7 @@ public function testHoliday($year, $expected) /** * Tests that Holiday is not present before 1952 + * @throws \ReflectionException */ public function testNotHoliday() { @@ -57,8 +60,9 @@ public function testNotHoliday() * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -73,8 +77,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -86,8 +91,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/NewZealand/WaitangiDayTest.php b/tests/NewZealand/WaitangiDayTest.php index fd94040f9..b922fb747 100644 --- a/tests/NewZealand/WaitangiDayTest.php +++ b/tests/NewZealand/WaitangiDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\NewZealand; @@ -25,12 +25,12 @@ class WaitangiDayTest extends NewZealandBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'waitangiDay'; + public const HOLIDAY = 'waitangiDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1974; + public const ESTABLISHMENT_YEAR = 1974; /** * Tests Waitangi Day @@ -39,6 +39,9 @@ class WaitangiDayTest extends NewZealandBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -52,6 +55,7 @@ public function testHoliday($year, $expected) /** * Tests that Holiday is not present before 1974 + * @throws \ReflectionException */ public function testNotHoliday() { @@ -60,8 +64,9 @@ public function testNotHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, @@ -88,8 +94,9 @@ public function testHolidayType() * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDatesWithModifier(2, 06, function ($year, \DateTime $date) { // in 2015 some policy was introduced to make sure this holiday was celebrated during the working week. diff --git a/tests/Norway/AscensionDayTest.php b/tests/Norway/AscensionDayTest.php index 1e8334b17..4e0278c8e 100644 --- a/tests/Norway/AscensionDayTest.php +++ b/tests/Norway/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; @@ -25,10 +25,12 @@ class AscensionDayTest extends NorwayBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Norway/ChristmasDayTest.php b/tests/Norway/ChristmasDayTest.php index 697efa324..271624175 100644 --- a/tests/Norway/ChristmasDayTest.php +++ b/tests/Norway/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; @@ -24,7 +24,7 @@ class ChristmasDayTest extends NorwayBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ChristmasDayTest extends NorwayBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Norway/ConstitutionDayTest.php b/tests/Norway/ConstitutionDayTest.php index 732457c92..cac5ce94b 100644 --- a/tests/Norway/ConstitutionDayTest.php +++ b/tests/Norway/ConstitutionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; @@ -25,15 +25,17 @@ class ConstitutionDayTest extends NorwayBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'constitutionDay'; + public const HOLIDAY = 'constitutionDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1836; + public const ESTABLISHMENT_YEAR = 1836; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,21 +63,23 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), - [self::LOCALE => 'Nasjonaldagen'] + [self::LOCALE => 'Grunnlovsdagen'] ); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Norway/EasterMondayTest.php b/tests/Norway/EasterMondayTest.php index aa0ad31bc..e7eb773eb 100644 --- a/tests/Norway/EasterMondayTest.php +++ b/tests/Norway/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; @@ -25,10 +25,12 @@ class EasterMondayTest extends NorwayBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Norway/EasterTest.php b/tests/Norway/EasterTest.php index 3c2f8f0db..b18f84fc6 100644 --- a/tests/Norway/EasterTest.php +++ b/tests/Norway/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; @@ -25,10 +25,12 @@ class EasterTest extends NorwayBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Norway/GoodFridayTest.php b/tests/Norway/GoodFridayTest.php index 84c9ea5c2..361eee5b2 100644 --- a/tests/Norway/GoodFridayTest.php +++ b/tests/Norway/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; @@ -25,10 +25,12 @@ class GoodFridayTest extends NorwayBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Norway/InternationalWorkersDayTest.php b/tests/Norway/InternationalWorkersDayTest.php index 39a690186..084bf38b1 100644 --- a/tests/Norway/InternationalWorkersDayTest.php +++ b/tests/Norway/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends NorwayBaseTestCase implements YasumiTe /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests International Workers' Day. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends NorwayBaseTestCase implements YasumiTe * * @param int $year the year for which International Workers' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testInternationalWorkersDay($year, $expected) { @@ -41,8 +43,9 @@ public function testInternationalWorkersDay($year, $expected) /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of International Workers' Day. * * @return array list of test dates for International Workers' Day + * @throws \Exception */ - public function InternationalWorkersDayDataProvider() + public function InternationalWorkersDayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } diff --git a/tests/Norway/MaundyThursdayTest.php b/tests/Norway/MaundyThursdayTest.php index f0c39376f..5be075298 100644 --- a/tests/Norway/MaundyThursdayTest.php +++ b/tests/Norway/MaundyThursdayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; @@ -25,10 +25,12 @@ class MaundyThursdayTest extends NorwayBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'maundyThursday'; + public const HOLIDAY = 'maundyThursday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Norway/NewYearsDayTest.php b/tests/Norway/NewYearsDayTest.php index 944144964..d789a4bc0 100644 --- a/tests/Norway/NewYearsDayTest.php +++ b/tests/Norway/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; @@ -24,7 +24,7 @@ class NewYearsDayTest extends NorwayBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends NorwayBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Norway/NorwayBaseTestCase.php b/tests/Norway/NorwayBaseTestCase.php index 060b791b4..c9b0bb3c7 100644 --- a/tests/Norway/NorwayBaseTestCase.php +++ b/tests/Norway/NorwayBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Norway holiday provider. */ -abstract class NorwayBaseTestCase extends PHPUnit_Framework_TestCase +abstract class NorwayBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Norway'; + public const REGION = 'Norway'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Oslo'; + public const TIMEZONE = 'Europe/Oslo'; /** * Locale that is considered common for this provider */ - const LOCALE = 'nb_NO'; + public const LOCALE = 'nb_NO'; } diff --git a/tests/Norway/NorwayTest.php b/tests/Norway/NorwayTest.php index 2c13ced37..4ed420f95 100644 --- a/tests/Norway/NorwayTest.php +++ b/tests/Norway/NorwayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; @@ -26,8 +26,9 @@ class NorwayTest extends NorwayBaseTestCase /** * Tests if all official holidays in Norway are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -47,32 +48,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Norway are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Norway are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Norway are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Norway are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Norway/PentecostMondayTest.php b/tests/Norway/PentecostMondayTest.php index 18e2a6f78..c9f3c8ac9 100644 --- a/tests/Norway/PentecostMondayTest.php +++ b/tests/Norway/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; @@ -25,10 +25,12 @@ class PentecostMondayTest extends NorwayBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Norway/PentecostTest.php b/tests/Norway/PentecostTest.php index 19dbe54eb..997601173 100644 --- a/tests/Norway/PentecostTest.php +++ b/tests/Norway/PentecostTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; @@ -25,10 +25,12 @@ class PentecostTest extends NorwayBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Norway/SecondChristmasDayTest.php b/tests/Norway/SecondChristmasDayTest.php index 47e81e2a3..a1147ab4b 100644 --- a/tests/Norway/SecondChristmasDayTest.php +++ b/tests/Norway/SecondChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Norway; @@ -24,7 +24,7 @@ class SecondChristmasDayTest extends NorwayBaseTestCase implements YasumiTestCas /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class SecondChristmasDayTest extends NorwayBaseTestCase implements YasumiTestCas * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Poland/AllSaintsDayTest.php b/tests/Poland/AllSaintsDayTest.php index cf2be1f7f..8e03a557a 100644 --- a/tests/Poland/AllSaintsDayTest.php +++ b/tests/Poland/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends PolandBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends PolandBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Poland/AssumptionOfMaryTest.php b/tests/Poland/AssumptionOfMaryTest.php index dec590c7c..c83f41ea7 100644 --- a/tests/Poland/AssumptionOfMaryTest.php +++ b/tests/Poland/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends PolandBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends PolandBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Poland/ChristmasTest.php b/tests/Poland/ChristmasTest.php index cfdb3011c..e71bfe978 100644 --- a/tests/Poland/ChristmasTest.php +++ b/tests/Poland/ChristmasTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -24,7 +24,7 @@ class ChristmasTest extends PolandBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasTest extends PolandBaseTestCase implements YasumiTestCaseInterfac * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Poland/ConstitutionDayTest.php b/tests/Poland/ConstitutionDayTest.php index e6da1c543..474e600f2 100644 --- a/tests/Poland/ConstitutionDayTest.php +++ b/tests/Poland/ConstitutionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -25,15 +25,17 @@ class ConstitutionDayTest extends PolandBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'constitutionDay'; + public const HOLIDAY = 'constitutionDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1791; + public const ESTABLISHMENT_YEAR = 1791; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Poland/CorpusChristiTest.php b/tests/Poland/CorpusChristiTest.php index bff132362..789882a0c 100644 --- a/tests/Poland/CorpusChristiTest.php +++ b/tests/Poland/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -25,10 +25,12 @@ class CorpusChristiTest extends PolandBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of Corpus Christi. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Poland/EasterMondayTest.php b/tests/Poland/EasterMondayTest.php index ecb008925..7f87744df 100644 --- a/tests/Poland/EasterMondayTest.php +++ b/tests/Poland/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -25,10 +25,12 @@ class EasterMondayTest extends PolandBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Poland/EasterTest.php b/tests/Poland/EasterTest.php index 9ec08cb71..1187399d7 100644 --- a/tests/Poland/EasterTest.php +++ b/tests/Poland/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -25,10 +25,12 @@ class EasterTest extends PolandBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Poland/EpiphanyTest.php b/tests/Poland/EpiphanyTest.php index 648b2baa5..b64a40362 100644 --- a/tests/Poland/EpiphanyTest.php +++ b/tests/Poland/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -24,7 +24,7 @@ class EpiphanyTest extends PolandBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** * Tests Epiphany. @@ -33,6 +33,8 @@ class EpiphanyTest extends PolandBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which Epiphany needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testEpiphany($year, $expected) { @@ -43,16 +45,18 @@ public function testEpiphany($year, $expected) * Returns a list of random test dates used for assertion of Epiphany. * * @return array list of test dates for Epiphany + * @throws \Exception */ - public function EpiphanyDataProvider() + public function EpiphanyDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests translated name of Epiphany. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Poland/IndependenceDayTest.php b/tests/Poland/IndependenceDayTest.php index 37144604e..6c5bc2b42 100644 --- a/tests/Poland/IndependenceDayTest.php +++ b/tests/Poland/IndependenceDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -25,15 +25,17 @@ class IndependenceDayTest extends PolandBaseTestCase implements YasumiTestCaseIn /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1918; + public const ESTABLISHMENT_YEAR = 1918; /** * The name of the holiday */ - const HOLIDAY = 'independenceDay'; + public const HOLIDAY = 'independenceDay'; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Poland/InternationalWorkersDayTest.php b/tests/Poland/InternationalWorkersDayTest.php index 7f2eced76..77c0e5edc 100644 --- a/tests/Poland/InternationalWorkersDayTest.php +++ b/tests/Poland/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends PolandBaseTestCase implements YasumiTe /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests International Workers' Day. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends PolandBaseTestCase implements YasumiTe * * @param int $year the year for which International Workers' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testInternationalWorkersDay($year, $expected) { @@ -41,8 +43,9 @@ public function testInternationalWorkersDay($year, $expected) /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of International Workers' Day. * * @return array list of test dates for International Workers' Day + * @throws \Exception */ - public function InternationalWorkersDayDataProvider() + public function InternationalWorkersDayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } diff --git a/tests/Poland/NewYearsDayTest.php b/tests/Poland/NewYearsDayTest.php index 05e2964be..d40ac0beb 100644 --- a/tests/Poland/NewYearsDayTest.php +++ b/tests/Poland/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -24,7 +24,7 @@ class NewYearsDayTest extends PolandBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends PolandBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Poland/PentecostTest.php b/tests/Poland/PentecostTest.php index 6401e4be9..af5081ac3 100644 --- a/tests/Poland/PentecostTest.php +++ b/tests/Poland/PentecostTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -25,10 +25,12 @@ class PentecostTest extends PolandBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Poland/PolandBaseTestCase.php b/tests/Poland/PolandBaseTestCase.php index 6f1134e73..bfb029a85 100644 --- a/tests/Poland/PolandBaseTestCase.php +++ b/tests/Poland/PolandBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Poland holiday provider. */ -abstract class PolandBaseTestCase extends PHPUnit_Framework_TestCase +abstract class PolandBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Poland'; + public const REGION = 'Poland'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Warsaw'; + public const TIMEZONE = 'Europe/Warsaw'; /** * Locale that is considered common for this provider */ - const LOCALE = 'pl_PL'; + public const LOCALE = 'pl_PL'; } diff --git a/tests/Poland/PolandTest.php b/tests/Poland/PolandTest.php index 2e55dfd23..b523629fe 100644 --- a/tests/Poland/PolandTest.php +++ b/tests/Poland/PolandTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -26,8 +26,9 @@ class PolandTest extends PolandBaseTestCase /** * Tests if all official holidays in Poland are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -47,32 +48,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Poland are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Poland are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Poland are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Poland are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['corpusChristi'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Poland/SecondChristmasDayTest.php b/tests/Poland/SecondChristmasDayTest.php index a97bd98ac..d28404870 100644 --- a/tests/Poland/SecondChristmasDayTest.php +++ b/tests/Poland/SecondChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Poland; @@ -24,7 +24,7 @@ class SecondChristmasDayTest extends PolandBaseTestCase implements YasumiTestCas /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class SecondChristmasDayTest extends PolandBaseTestCase implements YasumiTestCas * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Portugal/AllSaintsDayTest.php b/tests/Portugal/AllSaintsDayTest.php index 5bd2d1c60..4afac9092 100644 --- a/tests/Portugal/AllSaintsDayTest.php +++ b/tests/Portugal/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -25,20 +25,24 @@ class AllSaintsDayTest extends PortugalBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Holiday was abolished by the portuguese government in 2014. */ - const HOLIDAY_YEAR_ABOLISHED = 2014; + public const HOLIDAY_YEAR_ABOLISHED = 2014; /** * Holiday was restored by the portuguese government in 2016. */ - const HOLIDAY_YEAR_RESTORED = 2016; + public const HOLIDAY_YEAR_RESTORED = 2016; /** * Tests the holiday defined in this test. + * @throws \ReflectionException + * @throws \Exception + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday() { @@ -53,6 +57,7 @@ public function testHoliday() /** * Test that the holiday did not happen in 2014 and 2015. + * @throws \ReflectionException */ public function testNotHoliday() { @@ -62,8 +67,9 @@ public function testNotHoliday() /** * Tests translated name of Corpus Christi. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $year = $this->generateRandomYear(self::HOLIDAY_YEAR_RESTORED); $this->assertTranslatedHolidayName( @@ -76,8 +82,10 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { // After restoration $year = $this->generateRandomYear(self::HOLIDAY_YEAR_RESTORED); diff --git a/tests/Portugal/AssumptionOfMaryTest.php b/tests/Portugal/AssumptionOfMaryTest.php index 9800e7840..63e338766 100644 --- a/tests/Portugal/AssumptionOfMaryTest.php +++ b/tests/Portugal/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends PortugalBaseTestCase implements YasumiTestCas /** * The name of the holiday to be tested */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends PortugalBaseTestCase implements YasumiTestCas * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Portugal/CarnationRevolutionDayTest.php b/tests/Portugal/CarnationRevolutionDayTest.php index 9045cd4a5..b1470c583 100644 --- a/tests/Portugal/CarnationRevolutionDayTest.php +++ b/tests/Portugal/CarnationRevolutionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -25,15 +25,17 @@ class CarnationRevolutionDayTest extends PortugalBaseTestCase implements YasumiT /** * The year in which the holiday was established */ - const ESTABLISHMENT_YEAR = 1974; + public const ESTABLISHMENT_YEAR = 1974; /** * The name of the holiday to be tested */ - const HOLIDAY = '25thApril'; + public const HOLIDAY = '25thApril'; /** * Test that the holiday is valid after the year of establishment + * @throws \ReflectionException + * @throws \Exception */ public function testHolidayAfterEstablishment() { @@ -44,6 +46,7 @@ public function testHolidayAfterEstablishment() /** * Tests that the holiday is not a holiday before the year of establishment + * @throws \ReflectionException */ public function testNotHolidayBeforeEstablishment() { @@ -53,8 +56,9 @@ public function testNotHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Dia da Liberdade']); @@ -62,8 +66,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); diff --git a/tests/Portugal/ChristmasTest.php b/tests/Portugal/ChristmasTest.php index 4b2356daa..50c91ca63 100644 --- a/tests/Portugal/ChristmasTest.php +++ b/tests/Portugal/ChristmasTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -24,7 +24,7 @@ class ChristmasTest extends PortugalBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasTest extends PortugalBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Portugal/CorpusChristiTest.php b/tests/Portugal/CorpusChristiTest.php index fa1e5560a..0d3dc59f9 100644 --- a/tests/Portugal/CorpusChristiTest.php +++ b/tests/Portugal/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -25,20 +25,22 @@ class CorpusChristiTest extends PortugalBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Holiday was abolished by the portuguese government in 2014. */ - const HOLIDAY_YEAR_ABOLISHED = 2014; + public const HOLIDAY_YEAR_ABOLISHED = 2014; /** * Holiday was restored by the portuguese government in 2016. */ - const HOLIDAY_YEAR_RESTORED = 2016; + public const HOLIDAY_YEAR_RESTORED = 2016; /** * Tests the holiday defined in this test. + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday() { @@ -49,6 +51,7 @@ public function testHoliday() /** * Test that the holiday did not happen in 2014 and 2015. + * @throws \ReflectionException */ public function testNotHoliday() { @@ -58,8 +61,9 @@ public function testNotHoliday() /** * Tests translated name of Corpus Christi. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $year = $this->generateRandomYear(self::HOLIDAY_YEAR_RESTORED); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Corpo de Deus']); @@ -67,8 +71,10 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { // Before abolishment $year = $this->generateRandomYear(1000, self::HOLIDAY_YEAR_ABOLISHED - 1); diff --git a/tests/Portugal/EasterTest.php b/tests/Portugal/EasterTest.php index 2cc217e2b..d99945082 100644 --- a/tests/Portugal/EasterTest.php +++ b/tests/Portugal/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -25,10 +25,12 @@ class EasterTest extends PortugalBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Portugal/GoodFridayTest.php b/tests/Portugal/GoodFridayTest.php index 62b59b2d1..c1c9d67b4 100644 --- a/tests/Portugal/GoodFridayTest.php +++ b/tests/Portugal/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -25,10 +25,12 @@ class GoodFridayTest extends PortugalBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Portugal/ImmaculateConceptionTest.php b/tests/Portugal/ImmaculateConceptionTest.php index 247c4a046..e4e930051 100644 --- a/tests/Portugal/ImmaculateConceptionTest.php +++ b/tests/Portugal/ImmaculateConceptionTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -24,7 +24,7 @@ class ImmaculateConceptionTest extends PortugalBaseTestCase implements YasumiTes /** * The name of the holiday to be tested */ - const HOLIDAY = 'immaculateConception'; + public const HOLIDAY = 'immaculateConception'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ImmaculateConceptionTest extends PortugalBaseTestCase implements YasumiTes * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Portugal/InternationalWorkersDayTest.php b/tests/Portugal/InternationalWorkersDayTest.php index 6c4cd6060..8ccc69266 100644 --- a/tests/Portugal/InternationalWorkersDayTest.php +++ b/tests/Portugal/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends PortugalBaseTestCase implements Yasumi /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests International Workers' Day. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends PortugalBaseTestCase implements Yasumi * * @param int $year the year for which International Workers' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testInternationalWorkersDay($year, $expected) { @@ -41,8 +43,9 @@ public function testInternationalWorkersDay($year, $expected) /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of International Workers' Day. * * @return array list of test dates for International Workers' Day + * @throws \Exception */ - public function InternationalWorkersDayDataProvider() + public function InternationalWorkersDayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } diff --git a/tests/Portugal/NewYearsDayTest.php b/tests/Portugal/NewYearsDayTest.php index aa0e6be08..b4feb9b29 100644 --- a/tests/Portugal/NewYearsDayTest.php +++ b/tests/Portugal/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -24,7 +24,7 @@ class NewYearsDayTest extends PortugalBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends PortugalBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Portugal/PortugalBaseTestCase.php b/tests/Portugal/PortugalBaseTestCase.php index b36a3ef84..b02f16342 100644 --- a/tests/Portugal/PortugalBaseTestCase.php +++ b/tests/Portugal/PortugalBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Portugal holiday provider. */ -abstract class PortugalBaseTestCase extends PHPUnit_Framework_TestCase +abstract class PortugalBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Portugal'; + public const REGION = 'Portugal'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Lisbon'; + public const TIMEZONE = 'Europe/Lisbon'; /** * Locale that is considered common for this provider */ - const LOCALE = 'pt_PT'; + public const LOCALE = 'pt_PT'; } diff --git a/tests/Portugal/PortugalDayTest.php b/tests/Portugal/PortugalDayTest.php index f88ca1290..349c1652e 100644 --- a/tests/Portugal/PortugalDayTest.php +++ b/tests/Portugal/PortugalDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -26,21 +26,23 @@ class PortugalDayTest extends PortugalBaseTestCase implements YasumiTestCaseInte /** * The year in which the holiday was abolished */ - const ESTABLISHMENT_YEAR_BEFORE = 1932; + public const ESTABLISHMENT_YEAR_BEFORE = 1932; /** * The year in which the holiday was restored */ - const ESTABLISHMENT_YEAR_AFTER = 1974; + public const ESTABLISHMENT_YEAR_AFTER = 1974; /** * The name of the holiday to be tested */ - const HOLIDAY = 'portugalDay'; + public const HOLIDAY = 'portugalDay'; /** * Tests the holiday defined in this test before it was abolished. * @see Portugal::calculatePortugalDay() + * @throws \ReflectionException + * @throws \Exception */ public function testHolidayBeforeAbolishment() { @@ -52,6 +54,8 @@ public function testHolidayBeforeAbolishment() /** * Tests the holiday defined in this test after it was restored * @see Portugal::calculatePortugalDay() + * @throws \ReflectionException + * @throws \Exception */ public function testHolidayAfterRestoration() { @@ -63,6 +67,8 @@ public function testHolidayAfterRestoration() /** * Tests that the holiday defined in this test does not exist during the period that it was abolished * @see Portugal::calculatePortugalDay() + * + * @throws \ReflectionException */ public function testNotHolidayDuringAbolishment() { @@ -75,8 +81,10 @@ public function testNotHolidayDuringAbolishment() /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR_BEFORE); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Dia de Portugal']); @@ -87,8 +95,10 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR_BEFORE); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); diff --git a/tests/Portugal/PortugalTest.php b/tests/Portugal/PortugalTest.php index 845677d8e..6d3192387 100644 --- a/tests/Portugal/PortugalTest.php +++ b/tests/Portugal/PortugalTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -26,8 +26,9 @@ class PortugalTest extends PortugalBaseTestCase /** * Tests if all official holidays in Portugal are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -47,32 +48,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Portugal are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Portugal are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Portugal are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in PortugalPortugal are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $holidays = []; diff --git a/tests/Portugal/PortugueseRepublicDayTest.php b/tests/Portugal/PortugueseRepublicDayTest.php index 25af9bab8..fbde1d4e5 100644 --- a/tests/Portugal/PortugueseRepublicDayTest.php +++ b/tests/Portugal/PortugueseRepublicDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -25,15 +25,19 @@ class PortugueseRepublicDayTest extends PortugalBaseTestCase implements YasumiTe /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1910; + public const ESTABLISHMENT_YEAR = 1910; /** * The name of the holiday to be tested */ - const HOLIDAY = 'portugueseRepublic'; + public const HOLIDAY = 'portugueseRepublic'; /** * Tests the holiday defined in this test on or after establishment. + * @throws \ReflectionException + * @throws \Exception + * @throws \ReflectionException + * @throws \Exception */ public function testHolidayOnAfterEstablishment() { @@ -49,6 +53,8 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -61,8 +67,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +81,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Portugal/RestorationOfIndependenceTest.php b/tests/Portugal/RestorationOfIndependenceTest.php index 8e71fcae9..3ccad8eae 100644 --- a/tests/Portugal/RestorationOfIndependenceTest.php +++ b/tests/Portugal/RestorationOfIndependenceTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Portugal; @@ -25,25 +25,29 @@ class RestorationOfIndependenceTest extends PortugalBaseTestCase implements Yasu /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1850; + public const ESTABLISHMENT_YEAR = 1850; /** * Holiday was abolished by the portuguese government in 2014. */ - const HOLIDAY_YEAR_ABOLISHED = 2014; + public const HOLIDAY_YEAR_ABOLISHED = 2014; /** * Holiday was restored by the portuguese government in 2016. */ - const HOLIDAY_YEAR_RESTORED = 2016; + public const HOLIDAY_YEAR_RESTORED = 2016; /** * The name of the holiday to be tested */ - const HOLIDAY = 'restorationOfIndependence'; + public const HOLIDAY = 'restorationOfIndependence'; /** * Tests the holiday defined in this test on or after establishment. + * @throws \ReflectionException + * @throws \Exception + * @throws \ReflectionException + * @throws \Exception */ public function testHolidayOnAfterEstablishment() { @@ -59,6 +63,10 @@ public function testHolidayOnAfterEstablishment() /** * Test that the holiday if in effect in 2016 and later dates. + * @throws \ReflectionException + * @throws \Exception + * @throws \ReflectionException + * @throws \Exception */ public function testHolidayOnAfterRestoration() { @@ -75,6 +83,7 @@ public function testHolidayOnAfterRestoration() /** * Test that the holiday did not happen in 2014 and 2015. + * @throws \ReflectionException */ public function testNotHolidayDuringAbolishment() { @@ -84,6 +93,8 @@ public function testNotHolidayDuringAbolishment() /** * Tests the holiday defined in this test before establishment. + * + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -96,8 +107,10 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::HOLIDAY_YEAR_ABOLISHED - 1); $this->assertTranslatedHolidayName( @@ -118,8 +131,10 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { // After establishment and before abolishment $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::HOLIDAY_YEAR_ABOLISHED - 1); diff --git a/tests/Romania/AssumptionOfMaryTest.php b/tests/Romania/AssumptionOfMaryTest.php index 4435cb65c..51e38dad5 100644 --- a/tests/Romania/AssumptionOfMaryTest.php +++ b/tests/Romania/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -25,15 +25,17 @@ class AssumptionOfMaryTest extends RomaniaBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 2008; + public const ESTABLISHMENT_YEAR = 2008; /** * Tests Assumption Of Mary Day on or after 2008. + * @throws \Exception + * @throws \ReflectionException */ public function testAssumptionOfMaryDayOnAfter2008() { @@ -48,6 +50,7 @@ public function testAssumptionOfMaryDayOnAfter2008() /** * Tests Assumption of Mary Day before 2008. + * @throws \ReflectionException */ public function testAssumptionOfMaryDayBefore2008() { @@ -60,8 +63,9 @@ public function testAssumptionOfMaryDayBefore2008() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Romania/ChildrensDayTest.php b/tests/Romania/ChildrensDayTest.php index 99581106c..1bcbf41b1 100644 --- a/tests/Romania/ChildrensDayTest.php +++ b/tests/Romania/ChildrensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -25,15 +25,17 @@ class ChildrensDayTest extends RomaniaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'childrensDay'; + public const HOLIDAY = 'childrensDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1950; + public const ESTABLISHMENT_YEAR = 1950; /** * Tests Children's Day on or after 1950. + * @throws \Exception + * @throws \ReflectionException */ public function testChildrensDayOnAfter1950() { @@ -48,6 +50,7 @@ public function testChildrensDayOnAfter1950() /** * Tests Children's Day before 1950. + * @throws \ReflectionException */ public function testChildrensDayBefore1950() { @@ -60,8 +63,9 @@ public function testChildrensDayBefore1950() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,10 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Romania/ChristmasDayTest.php b/tests/Romania/ChristmasDayTest.php index c68837982..7e276ce76 100644 --- a/tests/Romania/ChristmasDayTest.php +++ b/tests/Romania/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -24,7 +24,7 @@ class ChristmasDayTest extends RomaniaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ChristmasDayTest extends RomaniaBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Romania/ConstantinBrancusiDayTest.php b/tests/Romania/ConstantinBrancusiDayTest.php index 9eaa57a55..e176f2390 100644 --- a/tests/Romania/ConstantinBrancusiDayTest.php +++ b/tests/Romania/ConstantinBrancusiDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -25,15 +25,17 @@ class ConstantinBrancusiDayTest extends RomaniaBaseTestCase implements YasumiTes /** * The name of the holiday to be tested */ - const HOLIDAY = 'constantinBrancusiDay'; + public const HOLIDAY = 'constantinBrancusiDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 2016; + public const ESTABLISHMENT_YEAR = 2016; /** * Tests Constantin Brancusi Day on or after 2016. + * @throws \Exception + * @throws \ReflectionException */ public function testConstantinBrancusiDayOnAfter2016() { @@ -48,6 +50,7 @@ public function testConstantinBrancusiDayOnAfter2016() /** * Tests Constantin Brancusi Day before 2016. + * @throws \ReflectionException */ public function testConstantinBrancusiDayBefore2016() { @@ -60,8 +63,9 @@ public function testConstantinBrancusiDayBefore2016() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Romania/DayAfterNewYearsDayTest.php b/tests/Romania/DayAfterNewYearsDayTest.php index ef3a831a6..264dfb4de 100644 --- a/tests/Romania/DayAfterNewYearsDayTest.php +++ b/tests/Romania/DayAfterNewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -24,7 +24,7 @@ class DayAfterNewYearsDayTest extends RomaniaBaseTestCase implements YasumiTestC /** * The name of the holiday to be tested */ - const HOLIDAY = 'dayAfterNewYearsDay'; + public const HOLIDAY = 'dayAfterNewYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class DayAfterNewYearsDayTest extends RomaniaBaseTestCase implements YasumiTestC * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 2, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Romania/EasterMondayTest.php b/tests/Romania/EasterMondayTest.php index 7f2ced733..1e5585084 100755 --- a/tests/Romania/EasterMondayTest.php +++ b/tests/Romania/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -26,10 +26,12 @@ class EasterMondayTest extends RomaniaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -44,8 +46,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -57,8 +60,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Romania/EasterTest.php b/tests/Romania/EasterTest.php index c1f952afb..c79d6ba35 100755 --- a/tests/Romania/EasterTest.php +++ b/tests/Romania/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -26,10 +26,12 @@ class EasterTest extends RomaniaBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -44,8 +46,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -57,8 +60,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Romania/InternationalWorkersDayTest.php b/tests/Romania/InternationalWorkersDayTest.php index 2b45f20f5..fe860285a 100755 --- a/tests/Romania/InternationalWorkersDayTest.php +++ b/tests/Romania/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends RomaniaBaseTestCase implements YasumiT /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests International Workers' Day. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends RomaniaBaseTestCase implements YasumiT * * @param int $year the year for which International Workers' Day needs to be tested * @param \DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testInternationalWorkersDay($year, $expected) { @@ -41,8 +43,9 @@ public function testInternationalWorkersDay($year, $expected) /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of International Workers' Day. * * @return array list of test dates for International Workers' Day + * @throws \Exception */ - public function InternationalWorkersDayDataProvider() + public function InternationalWorkersDayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } diff --git a/tests/Romania/NationalDayTest.php b/tests/Romania/NationalDayTest.php index 292a7e46a..b078e2c97 100644 --- a/tests/Romania/NationalDayTest.php +++ b/tests/Romania/NationalDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -25,15 +25,17 @@ class NationalDayTest extends RomaniaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'nationalDay'; + public const HOLIDAY = 'nationalDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1866; + public const ESTABLISHMENT_YEAR = 1866; /** * Tests National Day on or after 1990. + * @throws \Exception + * @throws \ReflectionException */ public function testNationalDayOnAfter1990() { @@ -48,6 +50,8 @@ public function testNationalDayOnAfter1990() /** * Tests National Day between 1948 - 1989. + * @throws \Exception + * @throws \ReflectionException */ public function testNationalDayBetween1948_1989() { @@ -62,6 +66,8 @@ public function testNationalDayBetween1948_1989() /** * Tests National Day between 1866 - 1947. + * @throws \Exception + * @throws \ReflectionException */ public function testNationalDayBetween1866_1947() { @@ -76,6 +82,7 @@ public function testNationalDayBetween1866_1947() /** * Tests National Day before 1865. + * @throws \ReflectionException */ public function testNationalDayBefore1865() { @@ -88,8 +95,9 @@ public function testNationalDayBefore1865() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -101,8 +109,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Romania/NewYearsDayTest.php b/tests/Romania/NewYearsDayTest.php index f27ef505b..30766ec45 100644 --- a/tests/Romania/NewYearsDayTest.php +++ b/tests/Romania/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -24,7 +24,7 @@ class NewYearsDayTest extends RomaniaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends RomaniaBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Romania/PentecostMondayTest.php b/tests/Romania/PentecostMondayTest.php index 0cfcdb233..d357c06d6 100644 --- a/tests/Romania/PentecostMondayTest.php +++ b/tests/Romania/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -26,15 +26,17 @@ class PentecostMondayTest extends RomaniaBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 2008; + public const ESTABLISHMENT_YEAR = 2008; /** * Tests the Pentecost Monday Day on and after 2008. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMondayOnAfter2008() { @@ -49,6 +51,7 @@ public function testPentecostMondayOnAfter2008() /** * Tests the Pentecost Day before 2008. + * @throws \ReflectionException */ public function testPentecostMondayBefore2008() { @@ -61,8 +64,9 @@ public function testPentecostMondayBefore2008() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Romania/PentecostTest.php b/tests/Romania/PentecostTest.php index 778d0f853..41164c5b2 100644 --- a/tests/Romania/PentecostTest.php +++ b/tests/Romania/PentecostTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -26,15 +26,17 @@ class PentecostTest extends RomaniaBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 2008; + public const ESTABLISHMENT_YEAR = 2008; /** * Tests the Pentecost Day on and after 2008. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostDayOnAfter2008() { @@ -49,6 +51,7 @@ public function testPentecostDayOnAfter2008() /** * Tests the Pentecost Day before 2008. + * @throws \ReflectionException */ public function testPentecostDayBefore2008() { @@ -61,8 +64,9 @@ public function testPentecostDayBefore2008() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Romania/RomaniaBaseTestCase.php b/tests/Romania/RomaniaBaseTestCase.php index ed00acaec..73dc32d9c 100755 --- a/tests/Romania/RomaniaBaseTestCase.php +++ b/tests/Romania/RomaniaBaseTestCase.php @@ -2,39 +2,39 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Class RomaniaBaseTestCase * @package Yasumi\tests\Romania */ -class RomaniaBaseTestCase extends PHPUnit_Framework_TestCase +class RomaniaBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Romania'; + public const REGION = 'Romania'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Bucharest'; + public const TIMEZONE = 'Europe/Bucharest'; /** * Locale that is considered common for this provider */ - const LOCALE = 'ro_RO'; + public const LOCALE = 'ro_RO'; } diff --git a/tests/Romania/RomaniaTest.php b/tests/Romania/RomaniaTest.php index 7ea8aa345..2ecef9abc 100755 --- a/tests/Romania/RomaniaTest.php +++ b/tests/Romania/RomaniaTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -28,8 +28,9 @@ class RomaniaTest extends RomaniaBaseTestCase /** * Tests if all official holidays in Romania are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $national_holidays = [ 'newYearsDay', @@ -56,8 +57,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Romania are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $ObservedHolidays = []; @@ -74,24 +76,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Romania are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Romania are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Romania are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Romania/SecondChristmasDayTest.php b/tests/Romania/SecondChristmasDayTest.php index 95fd00e07..c7dacb67f 100644 --- a/tests/Romania/SecondChristmasDayTest.php +++ b/tests/Romania/SecondChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -24,7 +24,7 @@ class SecondChristmasDayTest extends RomaniaBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class SecondChristmasDayTest extends RomaniaBaseTestCase implements YasumiTestCa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Romania/StAndrewDayTest.php b/tests/Romania/StAndrewDayTest.php index aeae7a894..e07e650e6 100644 --- a/tests/Romania/StAndrewDayTest.php +++ b/tests/Romania/StAndrewDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -25,15 +25,17 @@ class StAndrewDayTest extends RomaniaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'stAndrewDay'; + public const HOLIDAY = 'stAndrewDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 2012; + public const ESTABLISHMENT_YEAR = 2012; /** * Tests Saint Andrew Day on or after 2012. + * @throws \Exception + * @throws \ReflectionException */ public function testStAndrewDayOnAfter2012() { @@ -48,6 +50,7 @@ public function testStAndrewDayOnAfter2012() /** * Tests Saint Andrew before 2012. + * @throws \ReflectionException */ public function testStAndrewDayBefore2012() { @@ -60,8 +63,9 @@ public function testStAndrewDayBefore2012() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Romania/UnitedPrincipalitiesDayTest.php b/tests/Romania/UnitedPrincipalitiesDayTest.php index 97863b13b..efcf8d273 100644 --- a/tests/Romania/UnitedPrincipalitiesDayTest.php +++ b/tests/Romania/UnitedPrincipalitiesDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Romania; @@ -25,15 +25,17 @@ class UnitedPrincipalitiesDayTest extends RomaniaBaseTestCase implements YasumiT /** * The name of the holiday to be tested */ - const HOLIDAY = 'unitedPrincipalitiesDay'; + public const HOLIDAY = 'unitedPrincipalitiesDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 2015; + public const ESTABLISHMENT_YEAR = 2015; /** * Tests united Principalities Day on or after 2015. + * @throws \Exception + * @throws \ReflectionException */ public function testUnitedPrincipalitiesDayOnAfter2015() { @@ -48,6 +50,7 @@ public function testUnitedPrincipalitiesDayOnAfter2015() /** * Tests unitedPrincipalitiesDay before 2015. + * @throws \ReflectionException */ public function testUnitedPrincipalitiesDayBefore2015() { @@ -60,8 +63,9 @@ public function testUnitedPrincipalitiesDayBefore2015() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Russia/DefenceOfTheFatherlandDayTest.php b/tests/Russia/DefenceOfTheFatherlandDayTest.php index 95ff9244a..f39bc455a 100644 --- a/tests/Russia/DefenceOfTheFatherlandDayTest.php +++ b/tests/Russia/DefenceOfTheFatherlandDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -26,10 +26,11 @@ class DefenceOfTheFatherlandDayTest extends RussiaBaseTestCase implements Yasumi /** * The name of the holiday to be tested */ - const HOLIDAY = 'defenceOfTheFatherlandDay'; + public const HOLIDAY = 'defenceOfTheFatherlandDay'; /** * Test if holiday is not defined before + * @throws \ReflectionException */ public function testHolidayBefore() { @@ -42,6 +43,8 @@ public function testHolidayBefore() /** * Test if holiday is defined after + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayAfter() { @@ -57,8 +60,10 @@ public function testHolidayAfter() /** * {@inheritdoc} + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -76,8 +81,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Russia/InternationalWomensDayTest.php b/tests/Russia/InternationalWomensDayTest.php index 11b6040b3..bd1a2983e 100644 --- a/tests/Russia/InternationalWomensDayTest.php +++ b/tests/Russia/InternationalWomensDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -26,12 +26,13 @@ class InternationalWomensDayTest extends RussiaBaseTestCase implements YasumiTes /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWomensDay'; + public const HOLIDAY = 'internationalWomensDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(3, 8, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Russia/NewYearHolidaysDay2Test.php b/tests/Russia/NewYearHolidaysDay2Test.php index 6c055f017..71a9580cf 100644 --- a/tests/Russia/NewYearHolidaysDay2Test.php +++ b/tests/Russia/NewYearHolidaysDay2Test.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -26,12 +26,13 @@ class NewYearHolidaysDay2Test extends RussiaBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearHolidaysDay2'; + public const HOLIDAY = 'newYearHolidaysDay2'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(1, 2, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Russia/NewYearHolidaysDay3Test.php b/tests/Russia/NewYearHolidaysDay3Test.php index 02d178919..7e0c11b35 100644 --- a/tests/Russia/NewYearHolidaysDay3Test.php +++ b/tests/Russia/NewYearHolidaysDay3Test.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -26,12 +26,13 @@ class NewYearHolidaysDay3Test extends RussiaBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearHolidaysDay3'; + public const HOLIDAY = 'newYearHolidaysDay3'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(1, 3, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Russia/NewYearHolidaysDay4Test.php b/tests/Russia/NewYearHolidaysDay4Test.php index a5c1f4024..f47599133 100644 --- a/tests/Russia/NewYearHolidaysDay4Test.php +++ b/tests/Russia/NewYearHolidaysDay4Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -25,12 +25,13 @@ class NewYearHolidaysDay4Test extends RussiaBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearHolidaysDay4'; + public const HOLIDAY = 'newYearHolidaysDay4'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(1, 4, self::TIMEZONE); } @@ -40,6 +41,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -48,8 +51,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -61,8 +65,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Russia/NewYearHolidaysDay5Test.php b/tests/Russia/NewYearHolidaysDay5Test.php index f9b1e5658..1e40951e0 100644 --- a/tests/Russia/NewYearHolidaysDay5Test.php +++ b/tests/Russia/NewYearHolidaysDay5Test.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -26,12 +26,13 @@ class NewYearHolidaysDay5Test extends RussiaBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearHolidaysDay5'; + public const HOLIDAY = 'newYearHolidaysDay5'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(1, 5, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Russia/NewYearHolidaysDay6Test.php b/tests/Russia/NewYearHolidaysDay6Test.php index 170763436..c7f9b50e2 100644 --- a/tests/Russia/NewYearHolidaysDay6Test.php +++ b/tests/Russia/NewYearHolidaysDay6Test.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -26,12 +26,13 @@ class NewYearHolidaysDay6Test extends RussiaBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearHolidaysDay6'; + public const HOLIDAY = 'newYearHolidaysDay6'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Russia/NewYearHolidaysDay8Test.php b/tests/Russia/NewYearHolidaysDay8Test.php index ccf53e898..9c87f5ba7 100644 --- a/tests/Russia/NewYearHolidaysDay8Test.php +++ b/tests/Russia/NewYearHolidaysDay8Test.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -25,12 +25,13 @@ class NewYearHolidaysDay8Test extends RussiaBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearHolidaysDay8'; + public const HOLIDAY = 'newYearHolidaysDay8'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(1, 8, self::TIMEZONE); } @@ -40,6 +41,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -48,8 +51,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -61,8 +65,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Russia/NewYearsDayTest.php b/tests/Russia/NewYearsDayTest.php index 18d8b8224..1128da96b 100644 --- a/tests/Russia/NewYearsDayTest.php +++ b/tests/Russia/NewYearsDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -26,12 +26,13 @@ class NewYearsDayTest extends RussiaBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Russia/OrthodoxChristmasDayTest.php b/tests/Russia/OrthodoxChristmasDayTest.php index a16feaa56..9b31c8fdd 100644 --- a/tests/Russia/OrthodoxChristmasDayTest.php +++ b/tests/Russia/OrthodoxChristmasDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -26,12 +26,13 @@ class OrthodoxChristmasDayTest extends RussiaBaseTestCase implements YasumiTestC /** * The name of the holiday to be tested */ - const HOLIDAY = 'orthodoxChristmasDay'; + public const HOLIDAY = 'orthodoxChristmasDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(1, 7, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Russia/RussiaBaseTestCase.php b/tests/Russia/RussiaBaseTestCase.php index fb0e104a6..0b7d0c954 100644 --- a/tests/Russia/RussiaBaseTestCase.php +++ b/tests/Russia/RussiaBaseTestCase.php @@ -3,16 +3,17 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** @@ -20,22 +21,22 @@ * * @author Gedas Lukošius */ -abstract class RussiaBaseTestCase extends \PHPUnit_Framework_TestCase +abstract class RussiaBaseTestCase extends TestCase { use YasumiBase; /** * Name of the country to be tested */ - const REGION = 'Russia'; + public const REGION = 'Russia'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Moscow'; + public const TIMEZONE = 'Europe/Moscow'; /** * Locale that is considered common for this provider */ - const LOCALE = 'ru_RU'; + public const LOCALE = 'ru_RU'; } diff --git a/tests/Russia/RussiaDayTest.php b/tests/Russia/RussiaDayTest.php index f79db6817..a6d37ed91 100644 --- a/tests/Russia/RussiaDayTest.php +++ b/tests/Russia/RussiaDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -27,10 +27,11 @@ class RussiaDayTest extends RussiaBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday to be tested */ - const HOLIDAY = 'russiaDay'; + public const HOLIDAY = 'russiaDay'; /** * Test if holiday is not defined before + * @throws \ReflectionException */ public function testHolidayBefore() { @@ -43,6 +44,8 @@ public function testHolidayBefore() /** * Test if holiday is defined after + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayAfter() { @@ -58,8 +61,10 @@ public function testHolidayAfter() /** * {@inheritdoc} + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -77,8 +82,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Russia/RussiaTest.php b/tests/Russia/RussiaTest.php index e9c383876..3ad00eed8 100644 --- a/tests/Russia/RussiaTest.php +++ b/tests/Russia/RussiaTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -25,8 +25,9 @@ class RussiaTest extends RussiaBaseTestCase { /** * Tests if all official holidays in Russia are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $holidays = [ 'newYearsDay', @@ -61,32 +62,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Russia are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Russia are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Russia are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_BANK); } /** * Tests if all other holidays in Russia are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Russia/SpringAndLabourDayTest.php b/tests/Russia/SpringAndLabourDayTest.php index e4ef1b681..69cdd350a 100644 --- a/tests/Russia/SpringAndLabourDayTest.php +++ b/tests/Russia/SpringAndLabourDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -26,12 +26,13 @@ class SpringAndLabourDayTest extends RussiaBaseTestCase implements YasumiTestCas /** * The name of the holiday to be tested */ - const HOLIDAY = 'springAndLabourDay'; + public const HOLIDAY = 'springAndLabourDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Russia/UnityDayTest.php b/tests/Russia/UnityDayTest.php index 1f0a0415c..fddd335bc 100644 --- a/tests/Russia/UnityDayTest.php +++ b/tests/Russia/UnityDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -27,10 +27,11 @@ class UnityDayTest extends RussiaBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'unityDay'; + public const HOLIDAY = 'unityDay'; /** * Test if holiday is not defined before + * @throws \ReflectionException */ public function testHolidayBefore() { @@ -43,6 +44,8 @@ public function testHolidayBefore() /** * Test if holiday is defined after + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayAfter() { @@ -58,8 +61,10 @@ public function testHolidayAfter() /** * {@inheritdoc} + * + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -77,8 +82,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Russia/VictoryDayTest.php b/tests/Russia/VictoryDayTest.php index f51fbcf2f..e2cbd3173 100644 --- a/tests/Russia/VictoryDayTest.php +++ b/tests/Russia/VictoryDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Russia; @@ -26,12 +26,13 @@ class VictoryDayTest extends RussiaBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'victoryDay'; + public const HOLIDAY = 'victoryDay'; /** * @return array + * @throws \Exception */ - public function holidayDataProvider() + public function holidayDataProvider(): array { return $this->generateRandomDates(5, 9, self::TIMEZONE); } @@ -41,6 +42,8 @@ public function holidayDataProvider() * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, \DateTime $expected) { @@ -49,8 +52,9 @@ public function testHoliday($year, \DateTime $expected) /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * {@inheritdoc} + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Slovakia/AllSaintsDayTest.php b/tests/Slovakia/AllSaintsDayTest.php index 5adf7e289..2431e02a4 100644 --- a/tests/Slovakia/AllSaintsDayTest.php +++ b/tests/Slovakia/AllSaintsDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -30,7 +30,7 @@ class AllSaintsDayTest extends SlovakiaBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** @@ -40,6 +40,8 @@ class AllSaintsDayTest extends SlovakiaBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -51,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } @@ -60,8 +63,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); } diff --git a/tests/Slovakia/ChristmasDayTest.php b/tests/Slovakia/ChristmasDayTest.php index 898d48c01..af5e75da0 100644 --- a/tests/Slovakia/ChristmasDayTest.php +++ b/tests/Slovakia/ChristmasDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -30,7 +30,7 @@ class ChristmasDayTest extends SlovakiaBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** @@ -40,6 +40,8 @@ class ChristmasDayTest extends SlovakiaBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -51,8 +53,9 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } @@ -60,8 +63,9 @@ public function HolidayDataProvider() /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); } diff --git a/tests/Slovakia/ChristmasEveTest.php b/tests/Slovakia/ChristmasEveTest.php index 04bc39b63..c27288545 100644 --- a/tests/Slovakia/ChristmasEveTest.php +++ b/tests/Slovakia/ChristmasEveTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -30,7 +30,7 @@ class ChristmasEveTest extends SlovakiaBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'christmasEve'; + public const HOLIDAY = 'christmasEve'; /** @@ -40,6 +40,8 @@ class ChristmasEveTest extends SlovakiaBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasEve($year, $expected) { @@ -51,8 +53,9 @@ public function testChristmasEve($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 24, self::TIMEZONE); } @@ -60,8 +63,9 @@ public function HolidayDataProvider() /** * Tests translated name of Christmas Eve. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); } diff --git a/tests/Slovakia/EasterMondayTest.php b/tests/Slovakia/EasterMondayTest.php index 2373354b7..a73ddfb79 100644 --- a/tests/Slovakia/EasterMondayTest.php +++ b/tests/Slovakia/EasterMondayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -31,7 +31,7 @@ class EasterMondayTest extends SlovakiaBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** @@ -41,6 +41,8 @@ class EasterMondayTest extends SlovakiaBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -52,8 +54,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $timezone = self::TIMEZONE; @@ -72,8 +75,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -86,8 +90,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); } diff --git a/tests/Slovakia/EpiphanyTest.php b/tests/Slovakia/EpiphanyTest.php index 4170e4c1f..8c4c1352d 100644 --- a/tests/Slovakia/EpiphanyTest.php +++ b/tests/Slovakia/EpiphanyTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -30,7 +30,7 @@ class EpiphanyTest extends SlovakiaBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** @@ -40,6 +40,8 @@ class EpiphanyTest extends SlovakiaBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -51,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } @@ -60,8 +63,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); } diff --git a/tests/Slovakia/GoodFridayTest.php b/tests/Slovakia/GoodFridayTest.php index 2c665817c..9b757ab0a 100644 --- a/tests/Slovakia/GoodFridayTest.php +++ b/tests/Slovakia/GoodFridayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -31,7 +31,7 @@ class GoodFridayTest extends SlovakiaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** @@ -41,6 +41,8 @@ class GoodFridayTest extends SlovakiaBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -52,8 +54,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $timezone = self::TIMEZONE; @@ -72,8 +75,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -86,8 +90,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); } diff --git a/tests/Slovakia/InternationalWorkersDayTest.php b/tests/Slovakia/InternationalWorkersDayTest.php index 309adfb2d..de8d8d1ad 100644 --- a/tests/Slovakia/InternationalWorkersDayTest.php +++ b/tests/Slovakia/InternationalWorkersDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -30,7 +30,7 @@ class InternationalWorkersDayTest extends SlovakiaBaseTestCase implements Yasumi /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** @@ -40,6 +40,8 @@ class InternationalWorkersDayTest extends SlovakiaBaseTestCase implements Yasumi * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -51,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } @@ -60,8 +63,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); } diff --git a/tests/Slovakia/NewYearsDayTest.php b/tests/Slovakia/NewYearsDayTest.php index 60c35b434..cdaa94da2 100644 --- a/tests/Slovakia/NewYearsDayTest.php +++ b/tests/Slovakia/NewYearsDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -30,7 +30,7 @@ class NewYearsDayTest extends SlovakiaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** @@ -40,6 +40,8 @@ class NewYearsDayTest extends SlovakiaBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -51,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } @@ -60,8 +63,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Slovakia/OurLadyOfSorrowsDayTest.php b/tests/Slovakia/OurLadyOfSorrowsDayTest.php index 0143c9255..1758dd32f 100644 --- a/tests/Slovakia/OurLadyOfSorrowsDayTest.php +++ b/tests/Slovakia/OurLadyOfSorrowsDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -30,7 +30,7 @@ class OurLadyOfSorrowsDayTest extends SlovakiaBaseTestCase implements YasumiTest /** * The name of the holiday */ - const HOLIDAY = 'ourLadyOfSorrowsDay'; + public const HOLIDAY = 'ourLadyOfSorrowsDay'; /** @@ -40,6 +40,8 @@ class OurLadyOfSorrowsDayTest extends SlovakiaBaseTestCase implements YasumiTest * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -51,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(9, 15, self::TIMEZONE); } @@ -60,8 +63,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); } diff --git a/tests/Slovakia/SaintsCyrilAndMethodiusDayTest.php b/tests/Slovakia/SaintsCyrilAndMethodiusDayTest.php index 5dc1c3835..95dbeceb4 100644 --- a/tests/Slovakia/SaintsCyrilAndMethodiusDayTest.php +++ b/tests/Slovakia/SaintsCyrilAndMethodiusDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -30,7 +30,7 @@ class SaintsCyrilAndMethodiusDayTest extends SlovakiaBaseTestCase implements Yas /** * The name of the holiday to be tested */ - const HOLIDAY = 'saintsCyrilAndMethodiusDay'; + public const HOLIDAY = 'saintsCyrilAndMethodiusDay'; /** @@ -40,6 +40,8 @@ class SaintsCyrilAndMethodiusDayTest extends SlovakiaBaseTestCase implements Yas * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -51,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(7, 5, self::TIMEZONE); } @@ -60,8 +63,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Slovakia/SecondChristmasDayTest.php b/tests/Slovakia/SecondChristmasDayTest.php index 6334eaa5f..6f9f9f114 100644 --- a/tests/Slovakia/SecondChristmasDayTest.php +++ b/tests/Slovakia/SecondChristmasDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -30,7 +30,7 @@ class SecondChristmasDayTest extends SlovakiaBaseTestCase implements YasumiTestC /** * The name of the holiday */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** @@ -40,6 +40,8 @@ class SecondChristmasDayTest extends SlovakiaBaseTestCase implements YasumiTestC * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -51,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } @@ -60,8 +63,9 @@ public function HolidayDataProvider() /** * Tests translated name of Second Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); } diff --git a/tests/Slovakia/SlovakConstitutionDayTest.php b/tests/Slovakia/SlovakConstitutionDayTest.php index 3af38bd97..02498edd5 100644 --- a/tests/Slovakia/SlovakConstitutionDayTest.php +++ b/tests/Slovakia/SlovakConstitutionDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -30,7 +30,7 @@ class SlovakConstitutionDayTest extends SlovakiaBaseTestCase implements YasumiTe /** * The name of the holiday to be tested */ - const HOLIDAY = 'slovakConstitutionDay'; + public const HOLIDAY = 'slovakConstitutionDay'; /** * Tests the holiday defined in this test. @@ -39,6 +39,8 @@ class SlovakConstitutionDayTest extends SlovakiaBaseTestCase implements YasumiTe * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -50,8 +52,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(9, 1, self::TIMEZONE); } @@ -59,8 +62,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Slovakia/SlovakNationalUprisingDayTest.php b/tests/Slovakia/SlovakNationalUprisingDayTest.php index f4bd0d106..5b21fa1b1 100644 --- a/tests/Slovakia/SlovakNationalUprisingDayTest.php +++ b/tests/Slovakia/SlovakNationalUprisingDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -30,7 +30,7 @@ class SlovakNationalUprisingDayTest extends SlovakiaBaseTestCase implements Yasu /** * The name of the holiday to be tested */ - const HOLIDAY = 'slovakNationalUprisingDay'; + public const HOLIDAY = 'slovakNationalUprisingDay'; /** @@ -40,6 +40,8 @@ class SlovakNationalUprisingDayTest extends SlovakiaBaseTestCase implements Yasu * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -51,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(8, 29, self::TIMEZONE); } @@ -60,8 +63,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Slovakia/SlovakiaBaseTestCase.php b/tests/Slovakia/SlovakiaBaseTestCase.php index 64605a8f8..bff5cabb0 100644 --- a/tests/Slovakia/SlovakiaBaseTestCase.php +++ b/tests/Slovakia/SlovakiaBaseTestCase.php @@ -3,18 +3,18 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Slovakia; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** @@ -24,22 +24,22 @@ * @package Yasumi\tests\Slovakia * @author Andrej Rypak (dakujem) */ -abstract class SlovakiaBaseTestCase extends PHPUnit_Framework_TestCase +abstract class SlovakiaBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Slovakia'; + public const REGION = 'Slovakia'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Bratislava'; + public const TIMEZONE = 'Europe/Bratislava'; /** * Locale that is considered common for this provider */ - const LOCALE = 'sk_SK'; + public const LOCALE = 'sk_SK'; } diff --git a/tests/Slovakia/SlovakiaTest.php b/tests/Slovakia/SlovakiaTest.php index f13d2bf82..f134c50d2 100644 --- a/tests/Slovakia/SlovakiaTest.php +++ b/tests/Slovakia/SlovakiaTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -33,8 +33,9 @@ class SlovakiaTest extends SlovakiaBaseTestCase /** * Tests if all official holidays in Slovakia are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -48,8 +49,9 @@ public function testOfficialHolidays() /** * Tests if all bank holidays in Slovakia are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([ 'epiphany', @@ -68,8 +70,9 @@ public function testBankHolidays() /** * Tests if all observed holidays in Slovakia are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } @@ -77,8 +80,9 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Slovakia are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } @@ -86,8 +90,9 @@ public function testSeasonalHolidays() /** * Tests if all other holidays in Slovakia are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Slovakia/StruggleForFreedomAndDemocracyDayTest.php b/tests/Slovakia/StruggleForFreedomAndDemocracyDayTest.php index 27413d85d..1bf3aa96b 100644 --- a/tests/Slovakia/StruggleForFreedomAndDemocracyDayTest.php +++ b/tests/Slovakia/StruggleForFreedomAndDemocracyDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -30,7 +30,7 @@ class StruggleForFreedomAndDemocracyDayTest extends SlovakiaBaseTestCase impleme /** * The name of the holiday to be tested */ - const HOLIDAY = 'struggleForFreedomAndDemocracyDay'; + public const HOLIDAY = 'struggleForFreedomAndDemocracyDay'; /** @@ -40,6 +40,8 @@ class StruggleForFreedomAndDemocracyDayTest extends SlovakiaBaseTestCase impleme * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -51,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 17, self::TIMEZONE); } @@ -60,8 +63,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Slovakia/VictoryInEuropeDayTest.php b/tests/Slovakia/VictoryInEuropeDayTest.php index db93e286e..4a92c15e1 100644 --- a/tests/Slovakia/VictoryInEuropeDayTest.php +++ b/tests/Slovakia/VictoryInEuropeDayTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ @@ -30,7 +30,7 @@ class VictoryInEuropeDayTest extends SlovakiaBaseTestCase implements YasumiTestC /** * The name of the holiday */ - const HOLIDAY = 'victoryInEuropeDay'; + public const HOLIDAY = 'victoryInEuropeDay'; /** @@ -40,6 +40,8 @@ class VictoryInEuropeDayTest extends SlovakiaBaseTestCase implements YasumiTestC * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -51,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(5, 8, self::TIMEZONE); } @@ -60,8 +63,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +78,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); } diff --git a/tests/SouthAfrica/ChristmasDayTest.php b/tests/SouthAfrica/ChristmasDayTest.php index c4e9ab3d4..5ce3ba864 100644 --- a/tests/SouthAfrica/ChristmasDayTest.php +++ b/tests/SouthAfrica/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -30,12 +30,12 @@ class ChristmasDayTest extends SouthAfricaBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1994; + public const ESTABLISHMENT_YEAR = 1994; /** * Tests the holiday defined in this test. @@ -44,6 +44,9 @@ class ChristmasDayTest extends SouthAfricaBaseTestCase implements YasumiTestCase * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -61,8 +64,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -77,6 +81,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -89,8 +94,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -102,8 +108,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/SouthAfrica/FamilyDayTest.php b/tests/SouthAfrica/FamilyDayTest.php index d01491fbe..8ef2c2e19 100644 --- a/tests/SouthAfrica/FamilyDayTest.php +++ b/tests/SouthAfrica/FamilyDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -30,12 +30,12 @@ class FamilyDayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'familyDay'; + public const HOLIDAY = 'familyDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1994; + public const ESTABLISHMENT_YEAR = 1994; /** * Tests the holiday defined in this test. @@ -44,6 +44,9 @@ class FamilyDayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -59,8 +62,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -76,6 +80,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -88,8 +93,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -101,8 +107,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/SouthAfrica/FreedomDayTest.php b/tests/SouthAfrica/FreedomDayTest.php index 82b218045..81f8acb48 100644 --- a/tests/SouthAfrica/FreedomDayTest.php +++ b/tests/SouthAfrica/FreedomDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -30,12 +30,12 @@ class FreedomDayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'freedomDay'; + public const HOLIDAY = 'freedomDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1994; + public const ESTABLISHMENT_YEAR = 1994; /** * Tests the holiday defined in this test. @@ -44,6 +44,9 @@ class FreedomDayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -61,8 +64,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -77,6 +81,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -89,8 +94,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -102,8 +108,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/SouthAfrica/GoodFridayTest.php b/tests/SouthAfrica/GoodFridayTest.php index 330d25b7a..7b7e45be9 100644 --- a/tests/SouthAfrica/GoodFridayTest.php +++ b/tests/SouthAfrica/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -30,12 +30,12 @@ class GoodFridayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1994; + public const ESTABLISHMENT_YEAR = 1994; /** * Tests the holiday defined in this test. @@ -44,6 +44,9 @@ class GoodFridayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -59,8 +62,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -76,6 +80,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -88,8 +93,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -101,8 +107,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/SouthAfrica/HeritageDayTest.php b/tests/SouthAfrica/HeritageDayTest.php index 76e565ff0..b761744f6 100644 --- a/tests/SouthAfrica/HeritageDayTest.php +++ b/tests/SouthAfrica/HeritageDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -30,12 +30,12 @@ class HeritageDayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'heritageDay'; + public const HOLIDAY = 'heritageDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1994; + public const ESTABLISHMENT_YEAR = 1994; /** * Tests the holiday defined in this test. @@ -44,6 +44,9 @@ class HeritageDayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -61,8 +64,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -77,6 +81,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -89,8 +94,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -102,8 +108,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/SouthAfrica/HumanRightsDayTest.php b/tests/SouthAfrica/HumanRightsDayTest.php index e0ea504f8..cc9fb0e5b 100644 --- a/tests/SouthAfrica/HumanRightsDayTest.php +++ b/tests/SouthAfrica/HumanRightsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -30,12 +30,12 @@ class HumanRightsDayTest extends SouthAfricaBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'humanRightsDay'; + public const HOLIDAY = 'humanRightsDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1994; + public const ESTABLISHMENT_YEAR = 1994; /** * Tests the holiday defined in this test. @@ -44,6 +44,9 @@ class HumanRightsDayTest extends SouthAfricaBaseTestCase implements YasumiTestCa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -61,8 +64,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -77,6 +81,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -89,8 +94,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -102,8 +108,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/SouthAfrica/MunicipalElections2016DayTest.php b/tests/SouthAfrica/MunicipalElections2016DayTest.php index 68dff80bb..8276e9d3a 100644 --- a/tests/SouthAfrica/MunicipalElections2016DayTest.php +++ b/tests/SouthAfrica/MunicipalElections2016DayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -29,15 +29,17 @@ class MunicipalElections2016DayTest extends SouthAfricaBaseTestCase implements Y /** * The name of the holiday to be tested */ - const HOLIDAY = '2016MunicipalElectionsDay'; + public const HOLIDAY = '2016MunicipalElectionsDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 2016; + public const ESTABLISHMENT_YEAR = 2016; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -51,6 +53,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -63,6 +66,7 @@ public function testHolidayBeforeEstablishment() /** * Tests the holiday defined in this test after completion. + * @throws \ReflectionException */ public function testHolidayDayAfterCompletion() { @@ -71,8 +75,9 @@ public function testHolidayDayAfterCompletion() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -84,8 +89,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/SouthAfrica/NationalWomensDayTest.php b/tests/SouthAfrica/NationalWomensDayTest.php index 1ac219bfe..690890044 100644 --- a/tests/SouthAfrica/NationalWomensDayTest.php +++ b/tests/SouthAfrica/NationalWomensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -30,12 +30,12 @@ class NationalWomensDayTest extends SouthAfricaBaseTestCase implements YasumiTes /** * The name of the holiday to be tested */ - const HOLIDAY = 'nationalWomensDay'; + public const HOLIDAY = 'nationalWomensDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1994; + public const ESTABLISHMENT_YEAR = 1994; /** * Tests the holiday defined in this test. @@ -44,6 +44,9 @@ class NationalWomensDayTest extends SouthAfricaBaseTestCase implements YasumiTes * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -61,8 +64,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -77,6 +81,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -89,8 +94,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -102,8 +108,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/SouthAfrica/NewYearsDayTest.php b/tests/SouthAfrica/NewYearsDayTest.php index a72aa1906..89877de56 100644 --- a/tests/SouthAfrica/NewYearsDayTest.php +++ b/tests/SouthAfrica/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -30,12 +30,12 @@ class NewYearsDayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1994; + public const ESTABLISHMENT_YEAR = 1994; /** * Tests the holiday defined in this test. @@ -44,6 +44,9 @@ class NewYearsDayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -61,8 +64,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -77,6 +81,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -89,8 +94,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -102,8 +108,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/SouthAfrica/ReconciliationDayTest.php b/tests/SouthAfrica/ReconciliationDayTest.php index 80fbe6730..d7cf225e5 100644 --- a/tests/SouthAfrica/ReconciliationDayTest.php +++ b/tests/SouthAfrica/ReconciliationDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -30,12 +30,12 @@ class ReconciliationDayTest extends SouthAfricaBaseTestCase implements YasumiTes /** * The name of the holiday to be tested */ - const HOLIDAY = 'reconciliationDay'; + public const HOLIDAY = 'reconciliationDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1994; + public const ESTABLISHMENT_YEAR = 1994; /** * Tests the holiday defined in this test. @@ -44,6 +44,9 @@ class ReconciliationDayTest extends SouthAfricaBaseTestCase implements YasumiTes * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -61,8 +64,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -77,6 +81,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -89,8 +94,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -102,8 +108,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/SouthAfrica/SecondChristmasDayTest.php b/tests/SouthAfrica/SecondChristmasDayTest.php index 8a54f3557..5c73614bb 100644 --- a/tests/SouthAfrica/SecondChristmasDayTest.php +++ b/tests/SouthAfrica/SecondChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -30,12 +30,12 @@ class SecondChristmasDayTest extends SouthAfricaBaseTestCase implements YasumiTe /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1994; + public const ESTABLISHMENT_YEAR = 1994; /** * Tests the holiday defined in this test. @@ -44,6 +44,9 @@ class SecondChristmasDayTest extends SouthAfricaBaseTestCase implements YasumiTe * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -61,8 +64,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -77,6 +81,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -89,8 +94,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -102,8 +108,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/SouthAfrica/SouthAfricaBaseTestCase.php b/tests/SouthAfrica/SouthAfricaBaseTestCase.php index 729759156..f7a322161 100644 --- a/tests/SouthAfrica/SouthAfricaBaseTestCase.php +++ b/tests/SouthAfrica/SouthAfricaBaseTestCase.php @@ -3,41 +3,41 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the South Africa holiday provider. * * @package Yasumi\tests\SouthAfrica - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ -abstract class SouthAfricaBaseTestCase extends PHPUnit_Framework_TestCase +abstract class SouthAfricaBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'SouthAfrica'; + public const REGION = 'SouthAfrica'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Africa/Johannesburg'; + public const TIMEZONE = 'Africa/Johannesburg'; /** * Locale that is considered common for this provider */ - const LOCALE = 'en_ZA'; + public const LOCALE = 'en_ZA'; } diff --git a/tests/SouthAfrica/SouthAfricaTest.php b/tests/SouthAfrica/SouthAfricaTest.php index d3c192d1a..263104f8b 100644 --- a/tests/SouthAfrica/SouthAfricaTest.php +++ b/tests/SouthAfrica/SouthAfricaTest.php @@ -3,12 +3,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -19,7 +19,7 @@ * Class for testing holidays in South Africa. * * @package Yasumi\tests\SouthAfrica - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ class SouthAfricaTest extends SouthAfricaBaseTestCase { @@ -30,8 +30,9 @@ class SouthAfricaTest extends SouthAfricaBaseTestCase /** * Tests if all official holidays in SouthAfrica are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = [ 'newYearsDay', @@ -58,32 +59,36 @@ public function testOfficialHolidays() /** * Tests if all bank holidays in South Africa are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all observed holidays in South Africa are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in South Africa are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all other holidays in South Africa are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/SouthAfrica/SubstituteDayOfGoodwillTest.php b/tests/SouthAfrica/SubstituteDayOfGoodwillTest.php index 8cf678553..4aa10f7e2 100644 --- a/tests/SouthAfrica/SubstituteDayOfGoodwillTest.php +++ b/tests/SouthAfrica/SubstituteDayOfGoodwillTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -29,15 +29,17 @@ class SubstituteDayOfGoodwillTest extends SouthAfricaBaseTestCase implements Yas /** * The name of the holiday to be tested */ - const HOLIDAY = 'substituteDayOfGoodwill'; + public const HOLIDAY = 'substituteDayOfGoodwill'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 2016; + public const ESTABLISHMENT_YEAR = 2016; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -51,6 +53,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -63,6 +66,7 @@ public function testHolidayBeforeEstablishment() /** * Tests the holiday defined in this test after completion. + * @throws \ReflectionException */ public function testHolidayDayAfterCompletion() { @@ -71,8 +75,9 @@ public function testHolidayDayAfterCompletion() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -84,8 +89,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/SouthAfrica/WorkersDayTest.php b/tests/SouthAfrica/WorkersDayTest.php index 4b0b681e8..7acfe18a8 100644 --- a/tests/SouthAfrica/WorkersDayTest.php +++ b/tests/SouthAfrica/WorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -30,12 +30,12 @@ class WorkersDayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1994; + public const ESTABLISHMENT_YEAR = 1994; /** * Tests the holiday defined in this test. @@ -44,6 +44,9 @@ class WorkersDayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -61,8 +64,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -77,6 +81,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -89,8 +94,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -102,8 +108,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/SouthAfrica/YouthDayTest.php b/tests/SouthAfrica/YouthDayTest.php index 1edf1ed8d..d586f1d97 100644 --- a/tests/SouthAfrica/YouthDayTest.php +++ b/tests/SouthAfrica/YouthDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\SouthAfrica; @@ -30,12 +30,12 @@ class YouthDayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'youthDay'; + public const HOLIDAY = 'youthDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1994; + public const ESTABLISHMENT_YEAR = 1994; /** * Tests the holiday defined in this test. @@ -44,6 +44,9 @@ class YouthDayTest extends SouthAfricaBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -61,8 +64,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -77,6 +81,7 @@ public function HolidayDataProvider() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -89,8 +94,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -102,8 +108,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/AllSaintsDayTest.php b/tests/Spain/AllSaintsDayTest.php index fb32c04b0..fe5d1de6c 100644 --- a/tests/Spain/AllSaintsDayTest.php +++ b/tests/Spain/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends SpainBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends SpainBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Spain/Andalusia/AndalusiaBaseTestCase.php b/tests/Spain/Andalusia/AndalusiaBaseTestCase.php index 8a88abb0c..b39fa1100 100644 --- a/tests/Spain/Andalusia/AndalusiaBaseTestCase.php +++ b/tests/Spain/Andalusia/AndalusiaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Andalusia; @@ -25,10 +25,10 @@ abstract class AndalusiaBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/Andalusia'; + public const REGION = 'Spain/Andalusia'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/Andalusia/AndalusiaDayTest.php b/tests/Spain/Andalusia/AndalusiaDayTest.php index d78ee72ae..b3eb56729 100644 --- a/tests/Spain/Andalusia/AndalusiaDayTest.php +++ b/tests/Spain/Andalusia/AndalusiaDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Andalusia; @@ -25,15 +25,17 @@ class AndalusiaDayTest extends AndalusiaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'andalusiaDay'; + public const HOLIDAY = 'andalusiaDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1980; + public const ESTABLISHMENT_YEAR = 1980; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/Andalusia/AndalusiaTest.php b/tests/Spain/Andalusia/AndalusiaTest.php index bae1be154..3ec3fcc60 100644 --- a/tests/Spain/Andalusia/AndalusiaTest.php +++ b/tests/Spain/Andalusia/AndalusiaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Andalusia; @@ -26,8 +26,9 @@ class AndalusiaTest extends AndalusiaBaseTestCase /** * Tests if all official holidays in Andalusia (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Andalusia are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'maundyThursday', @@ -57,24 +59,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Andalusia are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Andalusia are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Andalusia are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/Aragon/AragonBaseTestCase.php b/tests/Spain/Aragon/AragonBaseTestCase.php index 1145d04f2..8c4de7cdb 100644 --- a/tests/Spain/Aragon/AragonBaseTestCase.php +++ b/tests/Spain/Aragon/AragonBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Aragon; @@ -25,10 +25,10 @@ abstract class AragonBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/Aragon'; + public const REGION = 'Spain/Aragon'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/Aragon/AragonTest.php b/tests/Spain/Aragon/AragonTest.php index 3832b66b1..928c7d1de 100644 --- a/tests/Spain/Aragon/AragonTest.php +++ b/tests/Spain/Aragon/AragonTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Aragon; @@ -26,8 +26,9 @@ class AragonTest extends AragonBaseTestCase /** * Tests if all official holidays in Aragon (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -45,8 +46,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Aragon are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'maundyThursday', @@ -57,24 +59,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Aragon are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Aragon are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Aragon are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/Aragon/StGeorgesDayTest.php b/tests/Spain/Aragon/StGeorgesDayTest.php index ecb402f5f..922ee21dd 100644 --- a/tests/Spain/Aragon/StGeorgesDayTest.php +++ b/tests/Spain/Aragon/StGeorgesDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Aragon; @@ -25,10 +25,12 @@ class StGeorgesDayTest extends AragonBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'stGeorgesDay'; + public const HOLIDAY = 'stGeorgesDay'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Spain/AssumptionOfMaryTest.php b/tests/Spain/AssumptionOfMaryTest.php index c0e05d678..ca52d3132 100644 --- a/tests/Spain/AssumptionOfMaryTest.php +++ b/tests/Spain/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends SpainBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends SpainBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Spain/Asturias/AsturiasBaseTestCase.php b/tests/Spain/Asturias/AsturiasBaseTestCase.php index 306c45f87..402cd677e 100644 --- a/tests/Spain/Asturias/AsturiasBaseTestCase.php +++ b/tests/Spain/Asturias/AsturiasBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Asturias; @@ -25,10 +25,10 @@ abstract class AsturiasBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/Asturias'; + public const REGION = 'Spain/Asturias'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/Asturias/AsturiasDayTest.php b/tests/Spain/Asturias/AsturiasDayTest.php index 0a57d0aa7..87447548e 100644 --- a/tests/Spain/Asturias/AsturiasDayTest.php +++ b/tests/Spain/Asturias/AsturiasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Asturias; @@ -25,15 +25,17 @@ class AsturiasDayTest extends AsturiasBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'asturiasDay'; + public const HOLIDAY = 'asturiasDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1984; + public const ESTABLISHMENT_YEAR = 1984; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/Asturias/AsturiasTest.php b/tests/Spain/Asturias/AsturiasTest.php index c3ef72529..d4532a20f 100644 --- a/tests/Spain/Asturias/AsturiasTest.php +++ b/tests/Spain/Asturias/AsturiasTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Asturias; @@ -26,8 +26,9 @@ class AsturiasTest extends AsturiasBaseTestCase /** * Tests if all official holidays in Asturias (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Asturias are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'stJosephsDay', @@ -58,24 +60,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Asturias are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Asturias are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Asturias are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/BalearicIslands/BalearicIslandsBaseTestCase.php b/tests/Spain/BalearicIslands/BalearicIslandsBaseTestCase.php index b9b5ed8d0..33b009fcc 100644 --- a/tests/Spain/BalearicIslands/BalearicIslandsBaseTestCase.php +++ b/tests/Spain/BalearicIslands/BalearicIslandsBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\BalearicIslands; @@ -25,10 +25,10 @@ abstract class BalearicIslandsBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/BalearicIslands'; + public const REGION = 'Spain/BalearicIslands'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/BalearicIslands/BalearicIslandsDayTest.php b/tests/Spain/BalearicIslands/BalearicIslandsDayTest.php index 0f53271f6..55c4e8f11 100644 --- a/tests/Spain/BalearicIslands/BalearicIslandsDayTest.php +++ b/tests/Spain/BalearicIslands/BalearicIslandsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\BalearicIslands; @@ -25,15 +25,17 @@ class BalearicIslandsDayTest extends BalearicIslandsBaseTestCase implements Yasu /** * The name of the holiday to be tested */ - const HOLIDAY = 'balearicIslandsDay'; + public const HOLIDAY = 'balearicIslandsDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1983; + public const ESTABLISHMENT_YEAR = 1983; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/BalearicIslands/BalearicIslandsTest.php b/tests/Spain/BalearicIslands/BalearicIslandsTest.php index c02f9ea47..8850fc865 100644 --- a/tests/Spain/BalearicIslands/BalearicIslandsTest.php +++ b/tests/Spain/BalearicIslands/BalearicIslandsTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\BalearicIslands; @@ -26,8 +26,9 @@ class BalearicIslandsTest extends BalearicIslandsBaseTestCase /** * Tests if all official holidays in the Balearic Islands (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in the Balearic Islands are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'stJosephsDay', @@ -60,24 +62,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in the Balearic Islands are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in the Balearic Islands are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in the Balearic Islands are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/BasqueCountry/BasqueCountryBaseTestCase.php b/tests/Spain/BasqueCountry/BasqueCountryBaseTestCase.php index f9a4484f8..bb07cae22 100644 --- a/tests/Spain/BasqueCountry/BasqueCountryBaseTestCase.php +++ b/tests/Spain/BasqueCountry/BasqueCountryBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\BasqueCountry; @@ -25,10 +25,10 @@ abstract class BasqueCountryBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/BasqueCountry'; + public const REGION = 'Spain/BasqueCountry'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/BasqueCountry/BasqueCountryDayTest.php b/tests/Spain/BasqueCountry/BasqueCountryDayTest.php index 2528db300..9b65ef58b 100644 --- a/tests/Spain/BasqueCountry/BasqueCountryDayTest.php +++ b/tests/Spain/BasqueCountry/BasqueCountryDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\BasqueCountry; @@ -25,20 +25,22 @@ class BasqueCountryDayTest extends BasqueCountryBaseTestCase implements YasumiTe /** * The name of the holiday to be tested */ - const HOLIDAY = 'basqueCountryDay'; + public const HOLIDAY = 'basqueCountryDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 2011; + public const ESTABLISHMENT_YEAR = 2011; /** * The year in which the holiday was abolished */ - const ABOLISHMENT_YEAR = 2013; + public const ABOLISHMENT_YEAR = 2013; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -53,6 +55,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -65,6 +68,7 @@ public function testHolidayBeforeEstablishment() /** * Tests the holiday defined in this test after abolishment. + * @throws \ReflectionException */ public function testHolidayDayAfterAbolishment() { @@ -73,8 +77,9 @@ public function testHolidayDayAfterAbolishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -86,8 +91,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/BasqueCountry/BasqueCountryTest.php b/tests/Spain/BasqueCountry/BasqueCountryTest.php index 726b2f2b4..742121110 100644 --- a/tests/Spain/BasqueCountry/BasqueCountryTest.php +++ b/tests/Spain/BasqueCountry/BasqueCountryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\BasqueCountry; @@ -26,8 +26,9 @@ class BasqueCountryTest extends BasqueCountryBaseTestCase /** * Tests if all official holidays in Basque Country (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Basque Country are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'maundyThursday', @@ -58,24 +60,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Basque Country are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Basque Country are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Basque Country are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/CanaryIslands/CanaryIslandsBaseTestCase.php b/tests/Spain/CanaryIslands/CanaryIslandsBaseTestCase.php index e029a6bbf..2848b58f8 100644 --- a/tests/Spain/CanaryIslands/CanaryIslandsBaseTestCase.php +++ b/tests/Spain/CanaryIslands/CanaryIslandsBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\CanaryIslands; @@ -25,10 +25,10 @@ abstract class CanaryIslandsBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/CanaryIslands'; + public const REGION = 'Spain/CanaryIslands'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Atlantic/Canary'; + public const TIMEZONE = 'Atlantic/Canary'; } diff --git a/tests/Spain/CanaryIslands/CanaryIslandsDayTest.php b/tests/Spain/CanaryIslands/CanaryIslandsDayTest.php index 60b7849f3..dc1a3eb3e 100644 --- a/tests/Spain/CanaryIslands/CanaryIslandsDayTest.php +++ b/tests/Spain/CanaryIslands/CanaryIslandsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\CanaryIslands; @@ -25,15 +25,17 @@ class CanaryIslandsDayTest extends CanaryIslandsBaseTestCase implements YasumiTe /** * The name of the holiday to be tested */ - const HOLIDAY = 'canaryIslandsDay'; + public const HOLIDAY = 'canaryIslandsDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1984; + public const ESTABLISHMENT_YEAR = 1984; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/CanaryIslands/CanaryIslandsTest.php b/tests/Spain/CanaryIslands/CanaryIslandsTest.php index 4a3a9249a..8ab7983a8 100644 --- a/tests/Spain/CanaryIslands/CanaryIslandsTest.php +++ b/tests/Spain/CanaryIslands/CanaryIslandsTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\CanaryIslands; @@ -26,8 +26,9 @@ class CanaryIslandsTest extends CanaryIslandsBaseTestCase /** * Tests if all official holidays in the Canary Islands (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in the Canary Islands are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'maundyThursday', @@ -57,24 +59,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in the Canary Islands are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in the Canary Islands are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in the Canary Islands are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/Cantabria/CantabriaBaseTestCase.php b/tests/Spain/Cantabria/CantabriaBaseTestCase.php index 8baa995d9..5fa512d10 100644 --- a/tests/Spain/Cantabria/CantabriaBaseTestCase.php +++ b/tests/Spain/Cantabria/CantabriaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Cantabria; @@ -25,10 +25,10 @@ abstract class CantabriaBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/Cantabria'; + public const REGION = 'Spain/Cantabria'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/Cantabria/CantabriaDayTest.php b/tests/Spain/Cantabria/CantabriaDayTest.php index 828bde052..afbc24080 100644 --- a/tests/Spain/Cantabria/CantabriaDayTest.php +++ b/tests/Spain/Cantabria/CantabriaDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Cantabria; @@ -25,15 +25,17 @@ class CantabriaDayTest extends CantabriaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'cantabriaDay'; + public const HOLIDAY = 'cantabriaDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1967; + public const ESTABLISHMENT_YEAR = 1967; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/Cantabria/CantabriaTest.php b/tests/Spain/Cantabria/CantabriaTest.php index 7bab1b5a2..ebff05205 100644 --- a/tests/Spain/Cantabria/CantabriaTest.php +++ b/tests/Spain/Cantabria/CantabriaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Cantabria; @@ -26,8 +26,9 @@ class CantabriaTest extends CantabriaBaseTestCase /** * Tests if all official holidays in Cantabria (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Cantabria are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'maundyThursday', @@ -57,24 +59,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Cantabria are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Cantabria are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Cantabria are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/CastileAndLeon/CastileAndLeonBaseTestCase.php b/tests/Spain/CastileAndLeon/CastileAndLeonBaseTestCase.php index 76cad454c..019c69360 100644 --- a/tests/Spain/CastileAndLeon/CastileAndLeonBaseTestCase.php +++ b/tests/Spain/CastileAndLeon/CastileAndLeonBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\CastileAndLeon; @@ -25,10 +25,10 @@ abstract class CastileAndLeonBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/CastileAndLeon'; + public const REGION = 'Spain/CastileAndLeon'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/CastileAndLeon/CastileAndLeonDayTest.php b/tests/Spain/CastileAndLeon/CastileAndLeonDayTest.php index 5af36f01c..bed03d85b 100644 --- a/tests/Spain/CastileAndLeon/CastileAndLeonDayTest.php +++ b/tests/Spain/CastileAndLeon/CastileAndLeonDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\CastileAndLeon; @@ -25,15 +25,17 @@ class CastileAndLeonDayTest extends CastileAndLeonBaseTestCase implements Yasumi /** * The name of the holiday to be tested */ - const HOLIDAY = 'castileAndLeonDay'; + public const HOLIDAY = 'castileAndLeonDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1976; + public const ESTABLISHMENT_YEAR = 1976; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/CastileAndLeon/CastileAndLeonTest.php b/tests/Spain/CastileAndLeon/CastileAndLeonTest.php index 041d33335..adfadbb2c 100644 --- a/tests/Spain/CastileAndLeon/CastileAndLeonTest.php +++ b/tests/Spain/CastileAndLeon/CastileAndLeonTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\CastileAndLeon; @@ -26,8 +26,9 @@ class CastileAndLeonTest extends CastileAndLeonBaseTestCase /** * Tests if all official holidays in Castile And Leon (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Castile And Leon are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'maundyThursday', @@ -57,24 +59,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Castile And Leon are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Castile And Leon are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Castile And Leon are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/CastillaLaMancha/CastillaLaManchaBaseTestCase.php b/tests/Spain/CastillaLaMancha/CastillaLaManchaBaseTestCase.php index d7a630352..146bca8e0 100644 --- a/tests/Spain/CastillaLaMancha/CastillaLaManchaBaseTestCase.php +++ b/tests/Spain/CastillaLaMancha/CastillaLaManchaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\CastillaLaMancha; @@ -25,10 +25,10 @@ abstract class CastillaLaManchaBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/CastillaLaMancha'; + public const REGION = 'Spain/CastillaLaMancha'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/CastillaLaMancha/CastillaLaManchaDayTest.php b/tests/Spain/CastillaLaMancha/CastillaLaManchaDayTest.php index 7262db3f9..df0772d0f 100644 --- a/tests/Spain/CastillaLaMancha/CastillaLaManchaDayTest.php +++ b/tests/Spain/CastillaLaMancha/CastillaLaManchaDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\CastillaLaMancha; @@ -25,15 +25,17 @@ class CastillaLaManchaDayTest extends CastillaLaManchaBaseTestCase implements Ya /** * The name of the holiday to be tested */ - const HOLIDAY = 'castillaLaManchaDay'; + public const HOLIDAY = 'castillaLaManchaDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1984; + public const ESTABLISHMENT_YEAR = 1984; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/CastillaLaMancha/CastillaLaManchaTest.php b/tests/Spain/CastillaLaMancha/CastillaLaManchaTest.php index 5e84af943..fe3037e7d 100644 --- a/tests/Spain/CastillaLaMancha/CastillaLaManchaTest.php +++ b/tests/Spain/CastillaLaMancha/CastillaLaManchaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\CastillaLaMancha; @@ -26,8 +26,9 @@ class CastillaLaManchaTest extends CastillaLaManchaBaseTestCase /** * Tests if all official holidays in Castilla-La Mancha (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Castilla-La Mancha are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'stJosephsDay', @@ -58,24 +60,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Castilla-La Mancha are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Castilla-La Mancha are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Castilla-La Mancha are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/Catalonia/CataloniaBaseTestCase.php b/tests/Spain/Catalonia/CataloniaBaseTestCase.php index fb7f7cb06..ef816dc2a 100644 --- a/tests/Spain/Catalonia/CataloniaBaseTestCase.php +++ b/tests/Spain/Catalonia/CataloniaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Catalonia; @@ -25,10 +25,10 @@ abstract class CataloniaBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/Catalonia'; + public const REGION = 'Spain/Catalonia'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/Catalonia/CataloniaTest.php b/tests/Spain/Catalonia/CataloniaTest.php index 77e26f56a..9880c198d 100644 --- a/tests/Spain/Catalonia/CataloniaTest.php +++ b/tests/Spain/Catalonia/CataloniaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Catalonia; @@ -26,8 +26,9 @@ class CataloniaTest extends CataloniaBaseTestCase /** * Tests if all official holidays in Catalonia (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Catalonia are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'easter', @@ -59,24 +61,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Catalonia are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Catalonia are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Catalonia are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/Catalonia/nationalCataloniaDayTest.php b/tests/Spain/Catalonia/nationalCataloniaDayTest.php index b47ec6b31..b6385f183 100644 --- a/tests/Spain/Catalonia/nationalCataloniaDayTest.php +++ b/tests/Spain/Catalonia/nationalCataloniaDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Catalonia; @@ -25,15 +25,17 @@ class nationalCataloniaDayTest extends CataloniaBaseTestCase implements YasumiTe /** * The name of the holiday to be tested */ - const HOLIDAY = 'nationalCataloniaDay'; + public const HOLIDAY = 'nationalCataloniaDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1886; + public const ESTABLISHMENT_YEAR = 1886; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/Catalonia/stJohnsDayTest.php b/tests/Spain/Catalonia/stJohnsDayTest.php index a2cb3dd3e..75e48ebe4 100644 --- a/tests/Spain/Catalonia/stJohnsDayTest.php +++ b/tests/Spain/Catalonia/stJohnsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Catalonia; @@ -24,7 +24,7 @@ class stJohnsDayTest extends CataloniaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'stJohnsDay'; + public const HOLIDAY = 'stJohnsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class stJohnsDayTest extends CataloniaBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(6, 24, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Spain/Ceuta/CeutaBaseTestCase.php b/tests/Spain/Ceuta/CeutaBaseTestCase.php index 4ee467c4b..5eac73ed1 100644 --- a/tests/Spain/Ceuta/CeutaBaseTestCase.php +++ b/tests/Spain/Ceuta/CeutaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Ceuta; @@ -25,10 +25,10 @@ abstract class CeutaBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/Ceuta'; + public const REGION = 'Spain/Ceuta'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/Ceuta/CeutaTest.php b/tests/Spain/Ceuta/CeutaTest.php index 3a3dd4efd..cf3144196 100644 --- a/tests/Spain/Ceuta/CeutaTest.php +++ b/tests/Spain/Ceuta/CeutaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Ceuta; @@ -26,8 +26,9 @@ class CeutaTest extends CeutaBaseTestCase /** * Tests if all official holidays in Ceuta (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Ceuta are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'maundyThursday', @@ -57,24 +59,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Ceuta are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Ceuta are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Ceuta are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/Ceuta/ceutaDayTest.php b/tests/Spain/Ceuta/ceutaDayTest.php index 7a2184f31..fcae69cc9 100644 --- a/tests/Spain/Ceuta/ceutaDayTest.php +++ b/tests/Spain/Ceuta/ceutaDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Ceuta; @@ -25,15 +25,17 @@ class ceutaDayTest extends CeutaBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'ceutaDay'; + public const HOLIDAY = 'ceutaDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1416; + public const ESTABLISHMENT_YEAR = 1416; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/ChristmasTest.php b/tests/Spain/ChristmasTest.php index f5d8c8bb6..af54f26e8 100644 --- a/tests/Spain/ChristmasTest.php +++ b/tests/Spain/ChristmasTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -24,7 +24,7 @@ class ChristmasTest extends SpainBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ChristmasTest extends SpainBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Spain/CommunityOfMadrid/CommunityOfMadridBaseTestCase.php b/tests/Spain/CommunityOfMadrid/CommunityOfMadridBaseTestCase.php index b44d8eda2..4d1190756 100644 --- a/tests/Spain/CommunityOfMadrid/CommunityOfMadridBaseTestCase.php +++ b/tests/Spain/CommunityOfMadrid/CommunityOfMadridBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\CommunityOfMadrid; @@ -25,10 +25,10 @@ abstract class CommunityOfMadridBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/CommunityOfMadrid'; + public const REGION = 'Spain/CommunityOfMadrid'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/CommunityOfMadrid/CommunityOfMadridTest.php b/tests/Spain/CommunityOfMadrid/CommunityOfMadridTest.php index 5b0e06b89..2fe035e41 100644 --- a/tests/Spain/CommunityOfMadrid/CommunityOfMadridTest.php +++ b/tests/Spain/CommunityOfMadrid/CommunityOfMadridTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\CommunityOfMadrid; @@ -26,8 +26,9 @@ class CommunityOfMadridTest extends CommunityOfMadridBaseTestCase /** * Tests if all official holidays in the Community of Madrid (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in the Community of Madrid are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'stJosephsDay', @@ -59,24 +61,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in the Community of Madrid are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in the Community of Madrid are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in the Community of Madrid are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/CommunityOfMadrid/DosdeMayoUprisingDayTest.php b/tests/Spain/CommunityOfMadrid/DosdeMayoUprisingDayTest.php index 667cf50f2..bf0b92edd 100644 --- a/tests/Spain/CommunityOfMadrid/DosdeMayoUprisingDayTest.php +++ b/tests/Spain/CommunityOfMadrid/DosdeMayoUprisingDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\CommunityOfMadrid; @@ -25,10 +25,12 @@ class DosdeMayoUprisingDayTest extends CommunityOfMadridBaseTestCase implements /** * The name of the holiday to be tested */ - const HOLIDAY = 'dosdeMayoUprisingDay'; + public const HOLIDAY = 'dosdeMayoUprisingDay'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Spain/ConstitutionDayTest.php b/tests/Spain/ConstitutionDayTest.php index 078c06b04..fe9cb9e73 100644 --- a/tests/Spain/ConstitutionDayTest.php +++ b/tests/Spain/ConstitutionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -25,15 +25,17 @@ class ConstitutionDayTest extends SpainBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'constitutionDay'; + public const HOLIDAY = 'constitutionDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1978; + public const ESTABLISHMENT_YEAR = 1978; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/EasterMondayTest.php b/tests/Spain/EasterMondayTest.php index b81cba9d5..67e990d07 100644 --- a/tests/Spain/EasterMondayTest.php +++ b/tests/Spain/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -25,16 +25,18 @@ class EasterMondayTest extends SpainBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Name of the region (e.g. country / state) to be tested * Using Catalonia as the holiday provider as not all regions celebrate Easter Monday in Spain. */ - const REGION = 'Spain/Catalonia'; + public const REGION = 'Spain/Catalonia'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -49,8 +51,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +65,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Spain/EpiphanyTest.php b/tests/Spain/EpiphanyTest.php index 4dadc3588..23f02c78d 100644 --- a/tests/Spain/EpiphanyTest.php +++ b/tests/Spain/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -24,7 +24,7 @@ class EpiphanyTest extends SpainBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class EpiphanyTest extends SpainBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Spain/Extremadura/ExtremaduraBaseTestCase.php b/tests/Spain/Extremadura/ExtremaduraBaseTestCase.php index d1cdbfeb0..74f382c33 100644 --- a/tests/Spain/Extremadura/ExtremaduraBaseTestCase.php +++ b/tests/Spain/Extremadura/ExtremaduraBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Extremadura; @@ -25,10 +25,10 @@ abstract class ExtremaduraBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/Extremadura'; + public const REGION = 'Spain/Extremadura'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/Extremadura/ExtremaduraDayTest.php b/tests/Spain/Extremadura/ExtremaduraDayTest.php index dd3255cc2..b064c2c3d 100644 --- a/tests/Spain/Extremadura/ExtremaduraDayTest.php +++ b/tests/Spain/Extremadura/ExtremaduraDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Extremadura; @@ -25,15 +25,17 @@ class ExtremaduraDayTest extends ExtremaduraBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'extremaduraDay'; + public const HOLIDAY = 'extremaduraDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1985; + public const ESTABLISHMENT_YEAR = 1985; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/Extremadura/ExtremaduraTest.php b/tests/Spain/Extremadura/ExtremaduraTest.php index 394bf6261..e1bbfcf2e 100644 --- a/tests/Spain/Extremadura/ExtremaduraTest.php +++ b/tests/Spain/Extremadura/ExtremaduraTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Extremadura; @@ -26,8 +26,9 @@ class ExtremaduraTest extends ExtremaduraBaseTestCase /** * Tests if all official holidays in Extremadura (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Extremadura are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'maundyThursday', @@ -57,24 +59,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Extremadura are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Extremadura are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Extremadura are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/Galicia/GaliciaBaseTestCase.php b/tests/Spain/Galicia/GaliciaBaseTestCase.php index f27e12bc4..a30ca3164 100644 --- a/tests/Spain/Galicia/GaliciaBaseTestCase.php +++ b/tests/Spain/Galicia/GaliciaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Galicia; @@ -25,10 +25,10 @@ abstract class GaliciaBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/Galicia'; + public const REGION = 'Spain/Galicia'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/Galicia/GaliciaTest.php b/tests/Spain/Galicia/GaliciaTest.php index 4d3341172..9027603fd 100644 --- a/tests/Spain/Galicia/GaliciaTest.php +++ b/tests/Spain/Galicia/GaliciaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Galicia; @@ -26,8 +26,9 @@ class GaliciaTest extends GaliciaBaseTestCase /** * Tests if all official holidays in Galicia (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -47,8 +48,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Galicia are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'stJosephsDay', @@ -59,24 +61,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Galicia are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Galicia are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Galicia are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/Galicia/GalicianLiteratureDayTest.php b/tests/Spain/Galicia/GalicianLiteratureDayTest.php index d2fe37d88..b1779c075 100644 --- a/tests/Spain/Galicia/GalicianLiteratureDayTest.php +++ b/tests/Spain/Galicia/GalicianLiteratureDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Galicia; @@ -25,15 +25,17 @@ class GalicianLiteratureDayTest extends GaliciaBaseTestCase implements YasumiTes /** * The name of the holiday to be tested */ - const HOLIDAY = 'galicianLiteratureDay'; + public const HOLIDAY = 'galicianLiteratureDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1991; + public const ESTABLISHMENT_YEAR = 1991; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/Galicia/stJamesDayTest.php b/tests/Spain/Galicia/stJamesDayTest.php index 31c82129b..e7a4ad630 100644 --- a/tests/Spain/Galicia/stJamesDayTest.php +++ b/tests/Spain/Galicia/stJamesDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Galicia; @@ -25,15 +25,17 @@ class stJamesDayTest extends GaliciaBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'stJamesDay'; + public const HOLIDAY = 'stJamesDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 2000; + public const ESTABLISHMENT_YEAR = 2000; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/GoodFridayTest.php b/tests/Spain/GoodFridayTest.php index 030933c5e..57d56a282 100644 --- a/tests/Spain/GoodFridayTest.php +++ b/tests/Spain/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -25,10 +25,12 @@ class GoodFridayTest extends SpainBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Spain/ImmaculateConceptionTest.php b/tests/Spain/ImmaculateConceptionTest.php index 2a4776ebf..8fe5cc655 100644 --- a/tests/Spain/ImmaculateConceptionTest.php +++ b/tests/Spain/ImmaculateConceptionTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -24,7 +24,7 @@ class ImmaculateConceptionTest extends SpainBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'immaculateConception'; + public const HOLIDAY = 'immaculateConception'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ImmaculateConceptionTest extends SpainBaseTestCase implements YasumiTestCa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Spain/InternationalWorkersDayTest.php b/tests/Spain/InternationalWorkersDayTest.php index 2953195b0..7be3c7971 100644 --- a/tests/Spain/InternationalWorkersDayTest.php +++ b/tests/Spain/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends SpainBaseTestCase implements YasumiTes /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends SpainBaseTestCase implements YasumiTes * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Spain/LaRioja/LaRiojaBaseTestCase.php b/tests/Spain/LaRioja/LaRiojaBaseTestCase.php index eeb9756b9..dcf68061c 100644 --- a/tests/Spain/LaRioja/LaRiojaBaseTestCase.php +++ b/tests/Spain/LaRioja/LaRiojaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\LaRioja; @@ -25,10 +25,10 @@ abstract class LaRiojaBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/LaRioja'; + public const REGION = 'Spain/LaRioja'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/LaRioja/LaRiojaDayTest.php b/tests/Spain/LaRioja/LaRiojaDayTest.php index e5940c419..43363c26e 100644 --- a/tests/Spain/LaRioja/LaRiojaDayTest.php +++ b/tests/Spain/LaRioja/LaRiojaDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\LaRioja; @@ -25,15 +25,17 @@ class LaRiojaDayTest extends LaRiojaBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'laRiojaDay'; + public const HOLIDAY = 'laRiojaDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1983; + public const ESTABLISHMENT_YEAR = 1983; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/LaRioja/LaRiojaTest.php b/tests/Spain/LaRioja/LaRiojaTest.php index 862c9bc16..9dff92452 100644 --- a/tests/Spain/LaRioja/LaRiojaTest.php +++ b/tests/Spain/LaRioja/LaRiojaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\LaRioja; @@ -26,8 +26,9 @@ class LaRiojaTest extends LaRiojaBaseTestCase /** * Tests if all official holidays in La Rioja (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in La Rioja are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'maundyThursday', @@ -57,24 +59,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in La Rioja are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in La Rioja are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in La Rioja are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/MaundyThursdayTest.php b/tests/Spain/MaundyThursdayTest.php index a4d4ace12..ab72b930a 100644 --- a/tests/Spain/MaundyThursdayTest.php +++ b/tests/Spain/MaundyThursdayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -25,16 +25,18 @@ class MaundyThursdayTest extends SpainBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'maundyThursday'; + public const HOLIDAY = 'maundyThursday'; /** * Name of the region (e.g. country / state) to be tested * Using the Region of Murcia as the holiday provider as not all regions celebrate Maundy Thursday in Spain. */ - const REGION = 'Spain/RegionOfMurcia'; + public const REGION = 'Spain/RegionOfMurcia'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -49,8 +51,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +65,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Spain/Melilla/MelillaBaseTestCase.php b/tests/Spain/Melilla/MelillaBaseTestCase.php index 06a8f7b04..715c416c6 100644 --- a/tests/Spain/Melilla/MelillaBaseTestCase.php +++ b/tests/Spain/Melilla/MelillaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Melilla; @@ -25,10 +25,10 @@ abstract class MelillaBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/Melilla'; + public const REGION = 'Spain/Melilla'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/Melilla/MelillaTest.php b/tests/Spain/Melilla/MelillaTest.php index b2ce87270..eaab2d2f0 100644 --- a/tests/Spain/Melilla/MelillaTest.php +++ b/tests/Spain/Melilla/MelillaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Melilla; @@ -26,8 +26,9 @@ class MelillaTest extends MelillaBaseTestCase /** * Tests if all official holidays in Melilla (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -45,8 +46,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Melilla are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'stJosephsDay', @@ -57,24 +59,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Melilla are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Melilla are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Melilla are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/NationalDayTest.php b/tests/Spain/NationalDayTest.php index 62b37383e..dcf03f8a0 100644 --- a/tests/Spain/NationalDayTest.php +++ b/tests/Spain/NationalDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -25,15 +25,17 @@ class NationalDayTest extends SpainBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'nationalDay'; + public const HOLIDAY = 'nationalDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1981; + public const ESTABLISHMENT_YEAR = 1981; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/Navarre/NavarreBaseTestCase.php b/tests/Spain/Navarre/NavarreBaseTestCase.php index e2a67f714..07b335a72 100644 --- a/tests/Spain/Navarre/NavarreBaseTestCase.php +++ b/tests/Spain/Navarre/NavarreBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Navarre; @@ -25,10 +25,10 @@ abstract class NavarreBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/Navarre'; + public const REGION = 'Spain/Navarre'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/Navarre/NavarreTest.php b/tests/Spain/Navarre/NavarreTest.php index 3fe993c83..080f68977 100644 --- a/tests/Spain/Navarre/NavarreTest.php +++ b/tests/Spain/Navarre/NavarreTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\Navarre; @@ -26,8 +26,9 @@ class NavarreTest extends NavarreBaseTestCase /** * Tests if all official holidays in Navarre (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -45,8 +46,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Navarre are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'stJosephsDay', @@ -58,24 +60,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Navarre are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Navarre are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Navarre are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/NewYearsDayTest.php b/tests/Spain/NewYearsDayTest.php index 70803cb2c..4475813e8 100644 --- a/tests/Spain/NewYearsDayTest.php +++ b/tests/Spain/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -24,7 +24,7 @@ class NewYearsDayTest extends SpainBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends SpainBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Spain/RegionOfMurcia/RegionOfMurciaBaseTestCase.php b/tests/Spain/RegionOfMurcia/RegionOfMurciaBaseTestCase.php index f029fd5a6..5db949d25 100644 --- a/tests/Spain/RegionOfMurcia/RegionOfMurciaBaseTestCase.php +++ b/tests/Spain/RegionOfMurcia/RegionOfMurciaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\RegionOfMurcia; @@ -25,10 +25,10 @@ abstract class RegionOfMurciaBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/RegionOfMurcia'; + public const REGION = 'Spain/RegionOfMurcia'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/RegionOfMurcia/RegionOfMurciaDayTest.php b/tests/Spain/RegionOfMurcia/RegionOfMurciaDayTest.php index 0791458ba..8be0e5335 100644 --- a/tests/Spain/RegionOfMurcia/RegionOfMurciaDayTest.php +++ b/tests/Spain/RegionOfMurcia/RegionOfMurciaDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\RegionOfMurcia; @@ -25,15 +25,17 @@ class RegionOfMurciaDayTest extends RegionOfMurciaBaseTestCase implements Yasumi /** * The name of the holiday to be tested */ - const HOLIDAY = 'murciaDay'; + public const HOLIDAY = 'murciaDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1983; + public const ESTABLISHMENT_YEAR = 1983; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/RegionOfMurcia/RegionOfMurciaTest.php b/tests/Spain/RegionOfMurcia/RegionOfMurciaTest.php index d2a549cbc..b462ff338 100644 --- a/tests/Spain/RegionOfMurcia/RegionOfMurciaTest.php +++ b/tests/Spain/RegionOfMurcia/RegionOfMurciaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\RegionOfMurcia; @@ -26,8 +26,9 @@ class RegionOfMurciaTest extends RegionOfMurciaBaseTestCase /** * Tests if all official holidays in the Region of Murcia (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in the Region of Murcia are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'stJosephsDay', @@ -58,24 +60,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in the Region of Murcia are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in the Region of Murcia are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in the Region of Murcia are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/SpainBaseTestCase.php b/tests/Spain/SpainBaseTestCase.php index 8a6051371..99363d9ce 100644 --- a/tests/Spain/SpainBaseTestCase.php +++ b/tests/Spain/SpainBaseTestCase.php @@ -2,39 +2,39 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Spain holiday provider. */ -abstract class SpainBaseTestCase extends PHPUnit_Framework_TestCase +abstract class SpainBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain'; + public const REGION = 'Spain'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; /** * Locale that is considered common for this provider */ - const LOCALE = 'es_ES'; + public const LOCALE = 'es_ES'; } diff --git a/tests/Spain/SpainTest.php b/tests/Spain/SpainTest.php index 7291b24a3..e6ac37ac7 100644 --- a/tests/Spain/SpainTest.php +++ b/tests/Spain/SpainTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -26,8 +26,9 @@ class SpainTest extends SpainBaseTestCase /** * Tests if all official holidays in Spain are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -45,32 +46,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Spain are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays(['easter'], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Spain are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Spain are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Spain are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/ValencianCommunity/ValencianCommunityBaseTestCase.php b/tests/Spain/ValencianCommunity/ValencianCommunityBaseTestCase.php index 9b03c87d6..36c9a5ad0 100644 --- a/tests/Spain/ValencianCommunity/ValencianCommunityBaseTestCase.php +++ b/tests/Spain/ValencianCommunity/ValencianCommunityBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\ValencianCommunity; @@ -25,10 +25,10 @@ abstract class ValencianCommunityBaseTestCase extends SpainBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Spain/ValencianCommunity'; + public const REGION = 'Spain/ValencianCommunity'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Madrid'; + public const TIMEZONE = 'Europe/Madrid'; } diff --git a/tests/Spain/ValencianCommunity/ValencianCommunityDayTest.php b/tests/Spain/ValencianCommunity/ValencianCommunityDayTest.php index b9d0d0234..ae431eccb 100644 --- a/tests/Spain/ValencianCommunity/ValencianCommunityDayTest.php +++ b/tests/Spain/ValencianCommunity/ValencianCommunityDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\ValencianCommunity; @@ -25,15 +25,17 @@ class ValencianCommunityDayTest extends ValencianCommunityBaseTestCase implement /** * The name of the holiday to be tested */ - const HOLIDAY = 'valencianCommunityDay'; + public const HOLIDAY = 'valencianCommunityDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1239; // Not entirely sure about this year + public const ESTABLISHMENT_YEAR = 1239; // Not entirely sure about this year /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Spain/ValencianCommunity/ValencianCommunityTest.php b/tests/Spain/ValencianCommunity/ValencianCommunityTest.php index d32863b2a..16ee3f717 100644 --- a/tests/Spain/ValencianCommunity/ValencianCommunityTest.php +++ b/tests/Spain/ValencianCommunity/ValencianCommunityTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain\ValencianCommunity; @@ -26,8 +26,9 @@ class ValencianCommunityTest extends ValencianCommunityBaseTestCase /** * Tests if all official holidays in the Valencian Community (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -46,8 +47,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in the Valencian Community are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([ 'stJosephsDay', @@ -58,24 +60,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in the Valencian Community are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in the Valencian Community are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in the Valencian Community are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays(['valentinesDay'], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Spain/ValentinesDayTest.php b/tests/Spain/ValentinesDayTest.php index 8d0dadce1..64f3f128a 100644 --- a/tests/Spain/ValentinesDayTest.php +++ b/tests/Spain/ValentinesDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -24,7 +24,7 @@ class ValentinesDayTest extends SpainBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'valentinesDay'; + public const HOLIDAY = 'valentinesDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ValentinesDayTest extends SpainBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(2, 14, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Spain/stJosephsDayTest.php b/tests/Spain/stJosephsDayTest.php index 78789f58e..0e82eecf8 100644 --- a/tests/Spain/stJosephsDayTest.php +++ b/tests/Spain/stJosephsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Spain; @@ -24,13 +24,13 @@ class stJosephsDayTest extends SpainBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'stJosephsDay'; + public const HOLIDAY = 'stJosephsDay'; /** * Name of the region (e.g. country / state) to be tested * Using Asturias as the holiday provider as not all regions celebrate St. Joseph's Day in Spain. */ - const REGION = 'Spain/Asturias'; + public const REGION = 'Spain/Asturias'; /** * Tests the holiday defined in this test. @@ -39,6 +39,8 @@ class stJosephsDayTest extends SpainBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -49,16 +51,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(3, 19, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -70,8 +74,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); } diff --git a/tests/Sweden/AllSaintsDayTest.php b/tests/Sweden/AllSaintsDayTest.php index 6cd3732f8..f53e8cf12 100644 --- a/tests/Sweden/AllSaintsDayTest.php +++ b/tests/Sweden/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -26,7 +26,7 @@ class AllSaintsDayTest extends SwedenBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests the holiday defined in this test. @@ -35,6 +35,8 @@ class AllSaintsDayTest extends SwedenBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -45,8 +47,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -69,8 +72,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -82,8 +86,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Sweden/AscensionDayTest.php b/tests/Sweden/AscensionDayTest.php index 72f07076f..983b419e9 100644 --- a/tests/Sweden/AscensionDayTest.php +++ b/tests/Sweden/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -25,10 +25,12 @@ class AscensionDayTest extends SwedenBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,21 +45,23 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, $this->generateRandomYear(), - [self::LOCALE => 'Kristi himmelsfärds dag'] + [self::LOCALE => 'Kristi himmelsfärdsdag'] ); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Sweden/ChristmasDayTest.php b/tests/Sweden/ChristmasDayTest.php index 2079ef28e..1d98ea646 100644 --- a/tests/Sweden/ChristmasDayTest.php +++ b/tests/Sweden/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -24,7 +24,7 @@ class ChristmasDayTest extends SwedenBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ChristmasDayTest extends SwedenBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Sweden/ChristmasEveTest.php b/tests/Sweden/ChristmasEveTest.php index ad7fa29a8..d0c7eb967 100644 --- a/tests/Sweden/ChristmasEveTest.php +++ b/tests/Sweden/ChristmasEveTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -24,7 +24,7 @@ class ChristmasEveTest extends SwedenBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'christmasEve'; + public const HOLIDAY = 'christmasEve'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ChristmasEveTest extends SwedenBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 24, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Sweden/EasterMondayTest.php b/tests/Sweden/EasterMondayTest.php index e94b4167e..92c9d53ea 100644 --- a/tests/Sweden/EasterMondayTest.php +++ b/tests/Sweden/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -25,10 +25,12 @@ class EasterMondayTest extends SwedenBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Sweden/EasterTest.php b/tests/Sweden/EasterTest.php index 8f13a9987..7e4265e3f 100644 --- a/tests/Sweden/EasterTest.php +++ b/tests/Sweden/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -25,10 +25,12 @@ class EasterTest extends SwedenBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Sweden/EpiphanyTest.php b/tests/Sweden/EpiphanyTest.php index 6652dbc41..1547e9fee 100644 --- a/tests/Sweden/EpiphanyTest.php +++ b/tests/Sweden/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -24,7 +24,7 @@ class EpiphanyTest extends SwedenBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class EpiphanyTest extends SwedenBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Sweden/GoodFridayTest.php b/tests/Sweden/GoodFridayTest.php index 1688bc2ed..3f8d993f4 100644 --- a/tests/Sweden/GoodFridayTest.php +++ b/tests/Sweden/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -25,10 +25,12 @@ class GoodFridayTest extends SwedenBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Sweden/InternationalWorkersDayTest.php b/tests/Sweden/InternationalWorkersDayTest.php index c621677cf..8ec4003ee 100644 --- a/tests/Sweden/InternationalWorkersDayTest.php +++ b/tests/Sweden/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends SwedenBaseTestCase implements YasumiTe /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests International Workers' Day. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends SwedenBaseTestCase implements YasumiTe * * @param int $year the year for which International Workers' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testInternationalWorkersDay($year, $expected) { @@ -41,8 +43,9 @@ public function testInternationalWorkersDay($year, $expected) /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of International Workers' Day. * * @return array list of test dates for International Workers' Day + * @throws \Exception */ - public function InternationalWorkersDayDataProvider() + public function InternationalWorkersDayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } diff --git a/tests/Sweden/NationalDayTest.php b/tests/Sweden/NationalDayTest.php index 89d11c141..59b93a054 100644 --- a/tests/Sweden/NationalDayTest.php +++ b/tests/Sweden/NationalDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -25,15 +25,17 @@ class NationalDayTest extends SwedenBaseTestCase implements YasumiTestCaseInterf /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1916; + public const ESTABLISHMENT_YEAR = 1916; /** * The name of the holiday */ - const HOLIDAY = 'nationalDay'; + public const HOLIDAY = 'nationalDay'; /** * Tests the holiday defined in this test on or after establishment. + * @throws \Exception + * @throws \ReflectionException */ public function testHolidayOnAfterEstablishment() { @@ -48,6 +50,7 @@ public function testHolidayOnAfterEstablishment() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test on or after establishment. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, @@ -86,6 +91,7 @@ public function testHolidayType() /** * Tests the translated name of the holiday defined in this test on or after establishment. + * @throws \ReflectionException */ public function testTranslationOnAfterNameChange() { diff --git a/tests/Sweden/NewYearsDayTest.php b/tests/Sweden/NewYearsDayTest.php index 15119444b..f87db7cf8 100644 --- a/tests/Sweden/NewYearsDayTest.php +++ b/tests/Sweden/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -24,7 +24,7 @@ class NewYearsDayTest extends SwedenBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends SwedenBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Sweden/PentecostTest.php b/tests/Sweden/PentecostTest.php index 5f7aaf1bb..57c62dbca 100644 --- a/tests/Sweden/PentecostTest.php +++ b/tests/Sweden/PentecostTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -25,10 +25,12 @@ class PentecostTest extends SwedenBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Sweden/SecondChristmasDayTest.php b/tests/Sweden/SecondChristmasDayTest.php index 61a340e82..967d5aa9f 100644 --- a/tests/Sweden/SecondChristmasDayTest.php +++ b/tests/Sweden/SecondChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -24,7 +24,7 @@ class SecondChristmasDayTest extends SwedenBaseTestCase implements YasumiTestCas /** * The name of the holiday to be tested */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class SecondChristmasDayTest extends SwedenBaseTestCase implements YasumiTestCas * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Sweden/SwedenBaseTestCase.php b/tests/Sweden/SwedenBaseTestCase.php index e004950ef..d62a92b62 100644 --- a/tests/Sweden/SwedenBaseTestCase.php +++ b/tests/Sweden/SwedenBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Sweden holiday provider. */ -abstract class SwedenBaseTestCase extends PHPUnit_Framework_TestCase +abstract class SwedenBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Sweden'; + public const REGION = 'Sweden'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Stockholm'; + public const TIMEZONE = 'Europe/Stockholm'; /** * Locale that is considered common for this provider */ - const LOCALE = 'sv_SE'; + public const LOCALE = 'sv_SE'; } diff --git a/tests/Sweden/SwedenTest.php b/tests/Sweden/SwedenTest.php index e3f8c9393..a9b56c57b 100644 --- a/tests/Sweden/SwedenTest.php +++ b/tests/Sweden/SwedenTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -26,8 +26,9 @@ class SwedenTest extends SwedenBaseTestCase /** * Tests if all official holidays in Sweden (Spain) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -49,32 +50,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Sweden are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Sweden are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Sweden are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Sweden are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Sweden/stJohnsDayTest.php b/tests/Sweden/stJohnsDayTest.php index df2cf6c4f..b70c108c5 100644 --- a/tests/Sweden/stJohnsDayTest.php +++ b/tests/Sweden/stJohnsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Sweden; @@ -24,10 +24,11 @@ class stJohnsDayTest extends SwedenBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'stJohnsDay'; + public const HOLIDAY = 'stJohnsDay'; /** * Tests the holiday defined in this test. + * @throws \ReflectionException */ public function testHoliday() { @@ -37,7 +38,7 @@ public function testHoliday() $holiday = $holidays->getHoliday(self::HOLIDAY); // Some basic assertions - $this->assertInstanceOf('Yasumi\Provider\\' . str_replace('/', '\\', self::REGION), $holidays); + $this->assertInstanceOf('Yasumi\Provider\\' . \str_replace('/', '\\', self::REGION), $holidays); $this->assertInstanceOf(Holiday::class, $holiday); $this->assertNotNull($holiday); @@ -51,8 +52,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +66,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Switzerland/Aargau/AargauBaseTestCase.php b/tests/Switzerland/Aargau/AargauBaseTestCase.php index d32774cc4..3e6fdbf2e 100644 --- a/tests/Switzerland/Aargau/AargauBaseTestCase.php +++ b/tests/Switzerland/Aargau/AargauBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Aargau; @@ -25,15 +25,15 @@ abstract class AargauBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Aargau'; + public const REGION = 'Switzerland/Aargau'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Aargau/AargauTest.php b/tests/Switzerland/Aargau/AargauTest.php index 13e6f97d8..01df0d9ad 100644 --- a/tests/Switzerland/Aargau/AargauTest.php +++ b/tests/Switzerland/Aargau/AargauTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Aargau; @@ -26,8 +26,10 @@ class AargauTest extends AargauBaseTestCase /** * Tests if all official holidays in Aargau (Switzerland) are defined by the provider class + * + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +40,10 @@ public function testOfficialHolidays() /** * Tests if all official holidays in Aargau (Switzerland) are defined by the provider class + * + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -51,8 +55,10 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Aargau (Switzerland) are defined by the provider class + * + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -64,24 +70,30 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Aargau (Switzerland) are defined by the provider class + * + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Aargau (Switzerland) are defined by the provider class + * + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Aargau (Switzerland) are defined by the provider class + * + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Aargau/AscensionDayTest.php b/tests/Switzerland/Aargau/AscensionDayTest.php index 152ec91f6..68f596701 100644 --- a/tests/Switzerland/Aargau/AscensionDayTest.php +++ b/tests/Switzerland/Aargau/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Aargau; @@ -25,10 +25,12 @@ class AscensionDayTest extends AargauBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Aargau/ChristmasDayTest.php b/tests/Switzerland/Aargau/ChristmasDayTest.php index e2a517de1..c63e6c89a 100644 --- a/tests/Switzerland/Aargau/ChristmasDayTest.php +++ b/tests/Switzerland/Aargau/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Aargau; @@ -24,7 +24,7 @@ class ChristmasDayTest extends AargauBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends AargauBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Aargau/GoodFridayTest.php b/tests/Switzerland/Aargau/GoodFridayTest.php index 42d12c872..d5fdc92a8 100644 --- a/tests/Switzerland/Aargau/GoodFridayTest.php +++ b/tests/Switzerland/Aargau/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Aargau; @@ -25,10 +25,12 @@ class GoodFridayTest extends AargauBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Aargau/NewYearsDayTest.php b/tests/Switzerland/Aargau/NewYearsDayTest.php index 250c2e8a9..fd9a6118c 100644 --- a/tests/Switzerland/Aargau/NewYearsDayTest.php +++ b/tests/Switzerland/Aargau/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Aargau; @@ -24,7 +24,7 @@ class NewYearsDayTest extends AargauBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends AargauBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/AppenzellAusserrhoden/AppenzellAusserrhodenBaseTestCase.php b/tests/Switzerland/AppenzellAusserrhoden/AppenzellAusserrhodenBaseTestCase.php index e9e5d7be8..d831a6710 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/AppenzellAusserrhodenBaseTestCase.php +++ b/tests/Switzerland/AppenzellAusserrhoden/AppenzellAusserrhodenBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellAusserrhoden; @@ -25,15 +25,15 @@ abstract class AppenzellAusserrhodenBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/AppenzellAusserrhoden'; + public const REGION = 'Switzerland/AppenzellAusserrhoden'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/AppenzellAusserrhoden/AppenzellAusserrhodenTest.php b/tests/Switzerland/AppenzellAusserrhoden/AppenzellAusserrhodenTest.php index 2452dbed6..657bed6bb 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/AppenzellAusserrhodenTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/AppenzellAusserrhodenTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellAusserrhoden; @@ -26,8 +26,9 @@ class AppenzellAusserrhodenTest extends AppenzellAusserrhodenBaseTestCase /** * Tests if all official holidays in Appenzell Ausserrhoden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Appenzell Ausserrhoden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -54,8 +56,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Appenzell Ausserrhoden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -67,24 +70,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Appenzell Ausserrhoden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Appenzell Ausserrhoden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Appenzell Ausserrhoden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellAusserrhoden/AscensionDayTest.php b/tests/Switzerland/AppenzellAusserrhoden/AscensionDayTest.php index 4c6bc12e8..b4d50a241 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/AscensionDayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellAusserrhoden; @@ -25,10 +25,12 @@ class AscensionDayTest extends AppenzellAusserrhodenBaseTestCase implements Yasu /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellAusserrhoden/ChristmasDayTest.php b/tests/Switzerland/AppenzellAusserrhoden/ChristmasDayTest.php index aa1f042b7..5c9e93b8f 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/ChristmasDayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellAusserrhoden; @@ -24,7 +24,7 @@ class ChristmasDayTest extends AppenzellAusserrhodenBaseTestCase implements Yasu /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends AppenzellAusserrhodenBaseTestCase implements Yasu * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellAusserrhoden/EasterMondayTest.php b/tests/Switzerland/AppenzellAusserrhoden/EasterMondayTest.php index 28c8d10b6..2a7d584ac 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/EasterMondayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellAusserrhoden; @@ -25,10 +25,12 @@ class EasterMondayTest extends AppenzellAusserrhodenBaseTestCase implements Yasu /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellAusserrhoden/GoodFridayTest.php b/tests/Switzerland/AppenzellAusserrhoden/GoodFridayTest.php index 2c361e752..842e71428 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/GoodFridayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellAusserrhoden; @@ -25,10 +25,12 @@ class GoodFridayTest extends AppenzellAusserrhodenBaseTestCase implements Yasumi /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellAusserrhoden/NewYearsDayTest.php b/tests/Switzerland/AppenzellAusserrhoden/NewYearsDayTest.php index 3a68899c2..584b3962f 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/NewYearsDayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellAusserrhoden; @@ -24,7 +24,7 @@ class NewYearsDayTest extends AppenzellAusserrhodenBaseTestCase implements Yasum /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends AppenzellAusserrhodenBaseTestCase implements Yasum * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/AppenzellAusserrhoden/PentecostMondayTest.php b/tests/Switzerland/AppenzellAusserrhoden/PentecostMondayTest.php index 7e8db9314..73e288d44 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/PentecostMondayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellAusserrhoden; @@ -25,10 +25,12 @@ class PentecostMondayTest extends AppenzellAusserrhodenBaseTestCase implements Y /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellAusserrhoden/StStephensDayTest.php b/tests/Switzerland/AppenzellAusserrhoden/StStephensDayTest.php index a86d5c419..a841297bf 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/StStephensDayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellAusserrhoden; @@ -24,7 +24,7 @@ class StStephensDayTest extends AppenzellAusserrhodenBaseTestCase implements Yas /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends AppenzellAusserrhodenBaseTestCase implements Yas * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellInnerrhoden/AllSaintsDayTest.php b/tests/Switzerland/AppenzellInnerrhoden/AllSaintsDayTest.php index 35b04682a..8bfb8ce38 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/AllSaintsDayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellInnerrhoden; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends AppenzellInnerrhodenBaseTestCase implements Yasum /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends AppenzellInnerrhodenBaseTestCase implements Yasum * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAllSaintsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testAllSaintsDay($year, $expected) /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/AppenzellInnerrhoden/AppenzellInnerrhodenBaseTestCase.php b/tests/Switzerland/AppenzellInnerrhoden/AppenzellInnerrhodenBaseTestCase.php index 5301a2f0a..aac107425 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/AppenzellInnerrhodenBaseTestCase.php +++ b/tests/Switzerland/AppenzellInnerrhoden/AppenzellInnerrhodenBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellInnerrhoden; @@ -25,15 +25,15 @@ abstract class AppenzellInnerrhodenBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/AppenzellInnerrhoden'; + public const REGION = 'Switzerland/AppenzellInnerrhoden'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/AppenzellInnerrhoden/AppenzellInnerrhodenTest.php b/tests/Switzerland/AppenzellInnerrhoden/AppenzellInnerrhodenTest.php index adb5b729c..af30e4757 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/AppenzellInnerrhodenTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/AppenzellInnerrhodenTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellInnerrhoden; @@ -26,8 +26,9 @@ class AppenzellInnerrhodenTest extends AppenzellInnerrhodenBaseTestCase /** * Tests if all official holidays in Appenzell Innerrhoden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Appenzell Innerrhoden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -58,8 +60,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Appenzell Innerrhoden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -71,24 +74,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Appenzell Innerrhoden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Appenzell Innerrhoden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Appenzell Innerrhoden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellInnerrhoden/AscensionDayTest.php b/tests/Switzerland/AppenzellInnerrhoden/AscensionDayTest.php index 6e5db8260..599e704e5 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/AscensionDayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellInnerrhoden; @@ -25,10 +25,12 @@ class AscensionDayTest extends AppenzellInnerrhodenBaseTestCase implements Yasum /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellInnerrhoden/AssumptionOfMaryTest.php b/tests/Switzerland/AppenzellInnerrhoden/AssumptionOfMaryTest.php index c6e69e4ae..29a0bad27 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/AssumptionOfMaryTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellInnerrhoden; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends AppenzellInnerrhodenBaseTestCase implements Y /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the day of the Assumption of Mary. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends AppenzellInnerrhodenBaseTestCase implements Y * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAssumptionOfMary($year, $expected) { @@ -41,8 +43,9 @@ public function testAssumptionOfMary($year, $expected) /** * Tests translated name of the day of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the day of the Assumption of Mary. * * @return array list of test dates for the day of the Assumption of Mary + * @throws \Exception */ - public function AssumptionOfMaryDataProvider() + public function AssumptionOfMaryDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } diff --git a/tests/Switzerland/AppenzellInnerrhoden/ChristmasDayTest.php b/tests/Switzerland/AppenzellInnerrhoden/ChristmasDayTest.php index a995e55a7..b4f6023c1 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/ChristmasDayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellInnerrhoden; @@ -24,7 +24,7 @@ class ChristmasDayTest extends AppenzellInnerrhodenBaseTestCase implements Yasum /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends AppenzellInnerrhodenBaseTestCase implements Yasum * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellInnerrhoden/CorpusChristiTest.php b/tests/Switzerland/AppenzellInnerrhoden/CorpusChristiTest.php index fa3127e41..3ee8a5d31 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/CorpusChristiTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellInnerrhoden; @@ -27,10 +27,13 @@ class CorpusChristiTest extends AppenzellInnerrhodenBaseTestCase implements Yasu /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellInnerrhoden/EasterMondayTest.php b/tests/Switzerland/AppenzellInnerrhoden/EasterMondayTest.php index df4a79d3d..bbfa64464 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/EasterMondayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellInnerrhoden; @@ -25,10 +25,12 @@ class EasterMondayTest extends AppenzellInnerrhodenBaseTestCase implements Yasum /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellInnerrhoden/GoodFridayTest.php b/tests/Switzerland/AppenzellInnerrhoden/GoodFridayTest.php index 28f207fcf..662677557 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/GoodFridayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellInnerrhoden; @@ -25,10 +25,12 @@ class GoodFridayTest extends AppenzellInnerrhodenBaseTestCase implements YasumiT /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellInnerrhoden/ImmaculateConceptionTest.php b/tests/Switzerland/AppenzellInnerrhoden/ImmaculateConceptionTest.php index 4e0700c0d..f88f023f6 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/ImmaculateConceptionTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/ImmaculateConceptionTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellInnerrhoden; @@ -24,7 +24,7 @@ class ImmaculateConceptionTest extends AppenzellInnerrhodenBaseTestCase implemen /** * The name of the holiday to be tested */ - const HOLIDAY = 'immaculateConception'; + public const HOLIDAY = 'immaculateConception'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ImmaculateConceptionTest extends AppenzellInnerrhodenBaseTestCase implemen * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellInnerrhoden/NewYearsDayTest.php b/tests/Switzerland/AppenzellInnerrhoden/NewYearsDayTest.php index 0a6b5092d..b2a0b9ba3 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/NewYearsDayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellInnerrhoden; @@ -24,7 +24,7 @@ class NewYearsDayTest extends AppenzellInnerrhodenBaseTestCase implements Yasumi /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends AppenzellInnerrhodenBaseTestCase implements Yasumi * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/AppenzellInnerrhoden/PentecostMondayTest.php b/tests/Switzerland/AppenzellInnerrhoden/PentecostMondayTest.php index 0f511390a..e70729a20 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/PentecostMondayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellInnerrhoden; @@ -25,10 +25,12 @@ class PentecostMondayTest extends AppenzellInnerrhodenBaseTestCase implements Ya /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/AppenzellInnerrhoden/StStephensDayTest.php b/tests/Switzerland/AppenzellInnerrhoden/StStephensDayTest.php index 7eadfcce4..b25e3c361 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/StStephensDayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\AppenzellInnerrhoden; @@ -24,7 +24,7 @@ class StStephensDayTest extends AppenzellInnerrhodenBaseTestCase implements Yasu /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends AppenzellInnerrhodenBaseTestCase implements Yasu * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselLandschaft/AscensionDayTest.php b/tests/Switzerland/BaselLandschaft/AscensionDayTest.php index 4187b0584..43548e229 100644 --- a/tests/Switzerland/BaselLandschaft/AscensionDayTest.php +++ b/tests/Switzerland/BaselLandschaft/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselLandschaft; @@ -25,10 +25,12 @@ class AscensionDayTest extends BaselLandschaftBaseTestCase implements YasumiTest /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselLandschaft/BaselLandschaftBaseTestCase.php b/tests/Switzerland/BaselLandschaft/BaselLandschaftBaseTestCase.php index 016962d79..3500163ad 100644 --- a/tests/Switzerland/BaselLandschaft/BaselLandschaftBaseTestCase.php +++ b/tests/Switzerland/BaselLandschaft/BaselLandschaftBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselLandschaft; @@ -25,15 +25,15 @@ abstract class BaselLandschaftBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/BaselLandschaft'; + public const REGION = 'Switzerland/BaselLandschaft'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/BaselLandschaft/BaselLandschaftTest.php b/tests/Switzerland/BaselLandschaft/BaselLandschaftTest.php index 18fa53d53..88f245081 100644 --- a/tests/Switzerland/BaselLandschaft/BaselLandschaftTest.php +++ b/tests/Switzerland/BaselLandschaft/BaselLandschaftTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselLandschaft; @@ -26,8 +26,9 @@ class BaselLandschaftTest extends BaselLandschaftBaseTestCase /** * Tests if all official holidays in BaselLandschaft (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in BaselLandschaft (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -55,8 +57,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in BaselLandschaft (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -68,24 +71,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in BaselLandschaft (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in BaselLandschaft (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in BaselLandschaft (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselLandschaft/ChristmasDayTest.php b/tests/Switzerland/BaselLandschaft/ChristmasDayTest.php index cae3f1f23..8fca557d6 100644 --- a/tests/Switzerland/BaselLandschaft/ChristmasDayTest.php +++ b/tests/Switzerland/BaselLandschaft/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselLandschaft; @@ -24,7 +24,7 @@ class ChristmasDayTest extends BaselLandschaftBaseTestCase implements YasumiTest /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends BaselLandschaftBaseTestCase implements YasumiTest * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselLandschaft/EasterMondayTest.php b/tests/Switzerland/BaselLandschaft/EasterMondayTest.php index b52df4fbf..e183c74ab 100644 --- a/tests/Switzerland/BaselLandschaft/EasterMondayTest.php +++ b/tests/Switzerland/BaselLandschaft/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselLandschaft; @@ -25,10 +25,12 @@ class EasterMondayTest extends BaselLandschaftBaseTestCase implements YasumiTest /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselLandschaft/GoodFridayTest.php b/tests/Switzerland/BaselLandschaft/GoodFridayTest.php index 56ce1a777..af822c9af 100644 --- a/tests/Switzerland/BaselLandschaft/GoodFridayTest.php +++ b/tests/Switzerland/BaselLandschaft/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselLandschaft; @@ -25,10 +25,12 @@ class GoodFridayTest extends BaselLandschaftBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselLandschaft/NewYearsDayTest.php b/tests/Switzerland/BaselLandschaft/NewYearsDayTest.php index 6f041d9d3..675ce200e 100644 --- a/tests/Switzerland/BaselLandschaft/NewYearsDayTest.php +++ b/tests/Switzerland/BaselLandschaft/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselLandschaft; @@ -24,7 +24,7 @@ class NewYearsDayTest extends BaselLandschaftBaseTestCase implements YasumiTestC /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends BaselLandschaftBaseTestCase implements YasumiTestC * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/BaselLandschaft/PentecostMondayTest.php b/tests/Switzerland/BaselLandschaft/PentecostMondayTest.php index 7b44fd03e..ba42f5336 100644 --- a/tests/Switzerland/BaselLandschaft/PentecostMondayTest.php +++ b/tests/Switzerland/BaselLandschaft/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselLandschaft; @@ -25,10 +25,12 @@ class PentecostMondayTest extends BaselLandschaftBaseTestCase implements YasumiT /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselLandschaft/StStephensDayTest.php b/tests/Switzerland/BaselLandschaft/StStephensDayTest.php index 12eeb7110..280a1271f 100644 --- a/tests/Switzerland/BaselLandschaft/StStephensDayTest.php +++ b/tests/Switzerland/BaselLandschaft/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselLandschaft; @@ -24,7 +24,7 @@ class StStephensDayTest extends BaselLandschaftBaseTestCase implements YasumiTes /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends BaselLandschaftBaseTestCase implements YasumiTes * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselLandschaft/WorkersDayTest.php b/tests/Switzerland/BaselLandschaft/WorkersDayTest.php index 2d1ca6719..14b758716 100644 --- a/tests/Switzerland/BaselLandschaft/WorkersDayTest.php +++ b/tests/Switzerland/BaselLandschaft/WorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselLandschaft; @@ -25,7 +25,7 @@ class WorkersDayTest extends BaselLandschaftBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -34,6 +34,9 @@ class WorkersDayTest extends BaselLandschaftBaseTestCase implements YasumiTestCa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -45,8 +48,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -61,8 +65,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +79,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselStadt/AscensionDayTest.php b/tests/Switzerland/BaselStadt/AscensionDayTest.php index f233bff5a..26ba32905 100644 --- a/tests/Switzerland/BaselStadt/AscensionDayTest.php +++ b/tests/Switzerland/BaselStadt/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselStadt; @@ -25,10 +25,12 @@ class AscensionDayTest extends BaselStadtBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselStadt/BaselStadtBaseTestCase.php b/tests/Switzerland/BaselStadt/BaselStadtBaseTestCase.php index 9f6bb3a85..6c2e23fe6 100644 --- a/tests/Switzerland/BaselStadt/BaselStadtBaseTestCase.php +++ b/tests/Switzerland/BaselStadt/BaselStadtBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselStadt; @@ -25,15 +25,15 @@ abstract class BaselStadtBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/BaselStadt'; + public const REGION = 'Switzerland/BaselStadt'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/BaselStadt/BaselStadtTest.php b/tests/Switzerland/BaselStadt/BaselStadtTest.php index 78607aee9..b0c82a2f4 100644 --- a/tests/Switzerland/BaselStadt/BaselStadtTest.php +++ b/tests/Switzerland/BaselStadt/BaselStadtTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselStadt; @@ -26,8 +26,9 @@ class BaselStadtTest extends BaselStadtBaseTestCase /** * Tests if all official holidays in Basel Stadt (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Basel Stadt (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -55,8 +57,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Basel Stadt (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -68,24 +71,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Basel Stadt (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Basel Stadt (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Basel Stadt (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselStadt/ChristmasDayTest.php b/tests/Switzerland/BaselStadt/ChristmasDayTest.php index 51303178f..e0c89c661 100644 --- a/tests/Switzerland/BaselStadt/ChristmasDayTest.php +++ b/tests/Switzerland/BaselStadt/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselStadt; @@ -24,7 +24,7 @@ class ChristmasDayTest extends BaselStadtBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends BaselStadtBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselStadt/EasterMondayTest.php b/tests/Switzerland/BaselStadt/EasterMondayTest.php index 778ed444e..c673dff22 100644 --- a/tests/Switzerland/BaselStadt/EasterMondayTest.php +++ b/tests/Switzerland/BaselStadt/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselStadt; @@ -25,10 +25,12 @@ class EasterMondayTest extends BaselStadtBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselStadt/GoodFridayTest.php b/tests/Switzerland/BaselStadt/GoodFridayTest.php index 565e05e32..63da9fc6e 100644 --- a/tests/Switzerland/BaselStadt/GoodFridayTest.php +++ b/tests/Switzerland/BaselStadt/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselStadt; @@ -25,10 +25,12 @@ class GoodFridayTest extends BaselStadtBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselStadt/NewYearsDayTest.php b/tests/Switzerland/BaselStadt/NewYearsDayTest.php index d80a0158c..772db2b7b 100644 --- a/tests/Switzerland/BaselStadt/NewYearsDayTest.php +++ b/tests/Switzerland/BaselStadt/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselStadt; @@ -24,7 +24,7 @@ class NewYearsDayTest extends BaselStadtBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends BaselStadtBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/BaselStadt/PentecostMondayTest.php b/tests/Switzerland/BaselStadt/PentecostMondayTest.php index 6be6c95e5..342f3799b 100644 --- a/tests/Switzerland/BaselStadt/PentecostMondayTest.php +++ b/tests/Switzerland/BaselStadt/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselStadt; @@ -25,10 +25,12 @@ class PentecostMondayTest extends BaselStadtBaseTestCase implements YasumiTestCa /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselStadt/StStephensDayTest.php b/tests/Switzerland/BaselStadt/StStephensDayTest.php index 08b60942c..2fdfcd171 100644 --- a/tests/Switzerland/BaselStadt/StStephensDayTest.php +++ b/tests/Switzerland/BaselStadt/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselStadt; @@ -24,7 +24,7 @@ class StStephensDayTest extends BaselStadtBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends BaselStadtBaseTestCase implements YasumiTestCase * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/BaselStadt/WorkersDayTest.php b/tests/Switzerland/BaselStadt/WorkersDayTest.php index eb60eb8de..be327dde3 100644 --- a/tests/Switzerland/BaselStadt/WorkersDayTest.php +++ b/tests/Switzerland/BaselStadt/WorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\BaselStadt; @@ -25,7 +25,7 @@ class WorkersDayTest extends BaselStadtBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -34,6 +34,9 @@ class WorkersDayTest extends BaselStadtBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -45,8 +48,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -61,8 +65,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +79,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Bern/AscensionDayTest.php b/tests/Switzerland/Bern/AscensionDayTest.php index 69e375de6..b9008a546 100644 --- a/tests/Switzerland/Bern/AscensionDayTest.php +++ b/tests/Switzerland/Bern/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Bern; @@ -25,10 +25,12 @@ class AscensionDayTest extends BernBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Bern/BerchtoldsTagTest.php b/tests/Switzerland/Bern/BerchtoldsTagTest.php index ebbf126cd..1c895eeed 100644 --- a/tests/Switzerland/Bern/BerchtoldsTagTest.php +++ b/tests/Switzerland/Bern/BerchtoldsTagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Bern; @@ -25,10 +25,13 @@ class BerchtoldsTagTest extends BernBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'berchtoldsTag'; + public const HOLIDAY = 'berchtoldsTag'; /** * Tests BerchtoldsTag + * + * @throws \ReflectionException + * @throws \Exception */ public function testBerchtoldsTag() { @@ -41,8 +44,9 @@ public function testBerchtoldsTag() /** * Tests translated name of BerchtoldsTag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +58,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Bern/BernBaseTestCase.php b/tests/Switzerland/Bern/BernBaseTestCase.php index 72851de98..162343ed3 100644 --- a/tests/Switzerland/Bern/BernBaseTestCase.php +++ b/tests/Switzerland/Bern/BernBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Bern; @@ -25,15 +25,15 @@ abstract class BernBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Bern'; + public const REGION = 'Switzerland/Bern'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Bern/BernTest.php b/tests/Switzerland/Bern/BernTest.php index 2fc0fa931..4d2efd5a6 100644 --- a/tests/Switzerland/Bern/BernTest.php +++ b/tests/Switzerland/Bern/BernTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Bern; @@ -26,8 +26,9 @@ class BernTest extends BernBaseTestCase /** * Tests if all official holidays in Bern (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Bern (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -55,8 +57,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Bern (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -68,24 +71,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Bern (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Bern (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Bern (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Bern/ChristmasDayTest.php b/tests/Switzerland/Bern/ChristmasDayTest.php index c51a1e7a2..d95cbea52 100644 --- a/tests/Switzerland/Bern/ChristmasDayTest.php +++ b/tests/Switzerland/Bern/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Bern; @@ -24,7 +24,7 @@ class ChristmasDayTest extends BernBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends BernBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Bern/EasterMondayTest.php b/tests/Switzerland/Bern/EasterMondayTest.php index 639b0eb19..04e38a5b9 100644 --- a/tests/Switzerland/Bern/EasterMondayTest.php +++ b/tests/Switzerland/Bern/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Bern; @@ -25,10 +25,12 @@ class EasterMondayTest extends BernBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Bern/GoodFridayTest.php b/tests/Switzerland/Bern/GoodFridayTest.php index 3fb7f6b14..28c887ead 100644 --- a/tests/Switzerland/Bern/GoodFridayTest.php +++ b/tests/Switzerland/Bern/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Bern; @@ -25,10 +25,12 @@ class GoodFridayTest extends BernBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Bern/NewYearsDayTest.php b/tests/Switzerland/Bern/NewYearsDayTest.php index 4faaa0a34..03b8cddc5 100644 --- a/tests/Switzerland/Bern/NewYearsDayTest.php +++ b/tests/Switzerland/Bern/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Bern; @@ -24,7 +24,7 @@ class NewYearsDayTest extends BernBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends BernBaseTestCase implements YasumiTestCaseInterfac * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Bern/PentecostMondayTest.php b/tests/Switzerland/Bern/PentecostMondayTest.php index 2bb96b347..ed11bd0ac 100644 --- a/tests/Switzerland/Bern/PentecostMondayTest.php +++ b/tests/Switzerland/Bern/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Bern; @@ -25,10 +25,12 @@ class PentecostMondayTest extends BernBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Bern/StStephensDayTest.php b/tests/Switzerland/Bern/StStephensDayTest.php index 8f6d15cd2..9fc26b02d 100644 --- a/tests/Switzerland/Bern/StStephensDayTest.php +++ b/tests/Switzerland/Bern/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Bern; @@ -24,7 +24,7 @@ class StStephensDayTest extends BernBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends BernBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Fribourg/AscensionDayTest.php b/tests/Switzerland/Fribourg/AscensionDayTest.php index 39671c1c7..0d1414cac 100644 --- a/tests/Switzerland/Fribourg/AscensionDayTest.php +++ b/tests/Switzerland/Fribourg/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Fribourg; @@ -25,10 +25,12 @@ class AscensionDayTest extends FribourgBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Fribourg/ChristmasDayTest.php b/tests/Switzerland/Fribourg/ChristmasDayTest.php index 2452c29d5..be07daa19 100644 --- a/tests/Switzerland/Fribourg/ChristmasDayTest.php +++ b/tests/Switzerland/Fribourg/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Fribourg; @@ -24,7 +24,7 @@ class ChristmasDayTest extends FribourgBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends FribourgBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Fribourg/EasterMondayTest.php b/tests/Switzerland/Fribourg/EasterMondayTest.php index 384bce3be..c8dd5fe95 100644 --- a/tests/Switzerland/Fribourg/EasterMondayTest.php +++ b/tests/Switzerland/Fribourg/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Fribourg; @@ -25,10 +25,12 @@ class EasterMondayTest extends FribourgBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Fribourg/FribourgBaseTestCase.php b/tests/Switzerland/Fribourg/FribourgBaseTestCase.php index 56260cfbe..c96572266 100644 --- a/tests/Switzerland/Fribourg/FribourgBaseTestCase.php +++ b/tests/Switzerland/Fribourg/FribourgBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Fribourg; @@ -25,15 +25,15 @@ abstract class FribourgBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Fribourg'; + public const REGION = 'Switzerland/Fribourg'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'fr_CH'; + public const LOCALE = 'fr_CH'; } diff --git a/tests/Switzerland/Fribourg/FribourgTest.php b/tests/Switzerland/Fribourg/FribourgTest.php index 2a2ff66ce..da67975a6 100644 --- a/tests/Switzerland/Fribourg/FribourgTest.php +++ b/tests/Switzerland/Fribourg/FribourgTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Fribourg; @@ -26,8 +26,9 @@ class FribourgTest extends FribourgBaseTestCase /** * Tests if all official holidays in Fribourg (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Fribourg (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -53,8 +55,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Fribourg (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -66,24 +69,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Fribourg (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Fribourg (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Fribourg (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Fribourg/GoodFridayTest.php b/tests/Switzerland/Fribourg/GoodFridayTest.php index 68f8e5c5e..3a7455cd8 100644 --- a/tests/Switzerland/Fribourg/GoodFridayTest.php +++ b/tests/Switzerland/Fribourg/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Fribourg; @@ -25,10 +25,12 @@ class GoodFridayTest extends FribourgBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Fribourg/NewYearsDayTest.php b/tests/Switzerland/Fribourg/NewYearsDayTest.php index 43fffa48c..a6b28e393 100644 --- a/tests/Switzerland/Fribourg/NewYearsDayTest.php +++ b/tests/Switzerland/Fribourg/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Fribourg; @@ -24,7 +24,7 @@ class NewYearsDayTest extends FribourgBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends FribourgBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Fribourg/PentecostMondayTest.php b/tests/Switzerland/Fribourg/PentecostMondayTest.php index 5bb8a5c79..682f5a393 100644 --- a/tests/Switzerland/Fribourg/PentecostMondayTest.php +++ b/tests/Switzerland/Fribourg/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Fribourg; @@ -25,10 +25,12 @@ class PentecostMondayTest extends FribourgBaseTestCase implements YasumiTestCase /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Geneva/AscensionDayTest.php b/tests/Switzerland/Geneva/AscensionDayTest.php index 8ebb14a1b..1b7693bec 100644 --- a/tests/Switzerland/Geneva/AscensionDayTest.php +++ b/tests/Switzerland/Geneva/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Geneva; @@ -25,10 +25,12 @@ class AscensionDayTest extends GenevaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Geneva/ChristmasDayTest.php b/tests/Switzerland/Geneva/ChristmasDayTest.php index 8e797b86e..60fc758b2 100644 --- a/tests/Switzerland/Geneva/ChristmasDayTest.php +++ b/tests/Switzerland/Geneva/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Geneva; @@ -24,7 +24,7 @@ class ChristmasDayTest extends GenevaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends GenevaBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Geneva/EasterMondayTest.php b/tests/Switzerland/Geneva/EasterMondayTest.php index 508e24d17..d6756cf64 100644 --- a/tests/Switzerland/Geneva/EasterMondayTest.php +++ b/tests/Switzerland/Geneva/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Geneva; @@ -25,10 +25,12 @@ class EasterMondayTest extends GenevaBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Geneva/GenevaBaseTestCase.php b/tests/Switzerland/Geneva/GenevaBaseTestCase.php index 104474595..07414c609 100644 --- a/tests/Switzerland/Geneva/GenevaBaseTestCase.php +++ b/tests/Switzerland/Geneva/GenevaBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Geneva; @@ -25,15 +25,15 @@ abstract class GenevaBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Geneva'; + public const REGION = 'Switzerland/Geneva'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'fr_CH'; + public const LOCALE = 'fr_CH'; } diff --git a/tests/Switzerland/Geneva/GenevaTest.php b/tests/Switzerland/Geneva/GenevaTest.php index 53b40727a..693db8309 100644 --- a/tests/Switzerland/Geneva/GenevaTest.php +++ b/tests/Switzerland/Geneva/GenevaTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Geneva; @@ -26,8 +26,9 @@ class GenevaTest extends GenevaBaseTestCase /** * Tests if all official holidays in Geneva (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Geneva (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $regionalHolidays = [ 'goodFriday', @@ -59,8 +61,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Geneva (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -76,24 +79,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Geneva (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Geneva (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Geneva (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $otherHolidays = []; if (($this->year >= 1840 && $this->year <= 1869) || $this->year >= 1966) { diff --git a/tests/Switzerland/Geneva/GoodFridayTest.php b/tests/Switzerland/Geneva/GoodFridayTest.php index 256c2d1af..15fa98fd2 100644 --- a/tests/Switzerland/Geneva/GoodFridayTest.php +++ b/tests/Switzerland/Geneva/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Geneva; @@ -25,10 +25,12 @@ class GoodFridayTest extends GenevaBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Geneva/JeuneGenevoisTest.php b/tests/Switzerland/Geneva/JeuneGenevoisTest.php index d0a08ec45..5dcc25ce6 100644 --- a/tests/Switzerland/Geneva/JeuneGenevoisTest.php +++ b/tests/Switzerland/Geneva/JeuneGenevoisTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Geneva; @@ -26,10 +26,13 @@ class JeuneGenevoisTest extends GenevaBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'jeuneGenevois'; + public const HOLIDAY = 'jeuneGenevois'; /** * Tests Jeune Genevois on or after 1966 + * + * @throws \ReflectionException + * @throws \Exception */ public function testJeuneGenevoisOnAfter1966() { @@ -45,6 +48,9 @@ public function testJeuneGenevoisOnAfter1966() /** * Tests Jeune Genevois between 1870 and 1965 + * + * @throws \ReflectionException + * @throws \Exception */ public function testJeuneGenevoisBetween1870And1965() { @@ -60,6 +66,9 @@ public function testJeuneGenevoisBetween1870And1965() /** * Tests Jeune Genevois between 1840 and 1869 + * + * @throws \ReflectionException + * @throws \Exception */ public function testJeuneGenevoisBetween1840And1869() { @@ -75,6 +84,7 @@ public function testJeuneGenevoisBetween1840And1869() /** * Tests Jeune Genevois before 1840 + * @throws \ReflectionException */ public function testJeuneGenevoisBefore1840() { @@ -84,8 +94,9 @@ public function testJeuneGenevoisBefore1840() /** * Tests translated name of Jeune Genevois. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -97,8 +108,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1966), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Geneva/NewYearsDayTest.php b/tests/Switzerland/Geneva/NewYearsDayTest.php index 4dc48f2f4..5314017e0 100644 --- a/tests/Switzerland/Geneva/NewYearsDayTest.php +++ b/tests/Switzerland/Geneva/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Geneva; @@ -24,7 +24,7 @@ class NewYearsDayTest extends GenevaBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends GenevaBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Geneva/PentecostMondayTest.php b/tests/Switzerland/Geneva/PentecostMondayTest.php index 45a024293..ce1d8d0cf 100644 --- a/tests/Switzerland/Geneva/PentecostMondayTest.php +++ b/tests/Switzerland/Geneva/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Geneva; @@ -25,10 +25,12 @@ class PentecostMondayTest extends GenevaBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Geneva/RestaurationGenevoiseTest.php b/tests/Switzerland/Geneva/RestaurationGenevoiseTest.php index 0c683eb0b..84e07713f 100644 --- a/tests/Switzerland/Geneva/RestaurationGenevoiseTest.php +++ b/tests/Switzerland/Geneva/RestaurationGenevoiseTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Geneva; @@ -25,10 +25,12 @@ class RestaurationGenevoiseTest extends GenevaBaseTestCase implements YasumiTest /** * The name of the holiday */ - const HOLIDAY = 'restaurationGenevoise'; + public const HOLIDAY = 'restaurationGenevoise'; /** * Tests Restauration Genevoise. + * @throws \Exception + * @throws \ReflectionException */ public function testRestaurationGenevoiseAfter1813() { @@ -44,8 +46,9 @@ public function testRestaurationGenevoiseAfter1813() /** * Tests translated name of Restauration Genevoise. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -57,8 +60,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1814), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Glarus/AllSaintsDayTest.php b/tests/Switzerland/Glarus/AllSaintsDayTest.php index 253f124b0..337400a3d 100644 --- a/tests/Switzerland/Glarus/AllSaintsDayTest.php +++ b/tests/Switzerland/Glarus/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Glarus; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends GlarusBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends GlarusBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAllSaintsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testAllSaintsDay($year, $expected) /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Glarus/AscensionDayTest.php b/tests/Switzerland/Glarus/AscensionDayTest.php index 9f0f683be..de0701ebf 100644 --- a/tests/Switzerland/Glarus/AscensionDayTest.php +++ b/tests/Switzerland/Glarus/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Glarus; @@ -25,10 +25,12 @@ class AscensionDayTest extends GlarusBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Glarus/BerchtoldsTagTest.php b/tests/Switzerland/Glarus/BerchtoldsTagTest.php index 8f70dff7f..33fb69dff 100644 --- a/tests/Switzerland/Glarus/BerchtoldsTagTest.php +++ b/tests/Switzerland/Glarus/BerchtoldsTagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Glarus; @@ -25,10 +25,13 @@ class BerchtoldsTagTest extends GlarusBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'berchtoldsTag'; + public const HOLIDAY = 'berchtoldsTag'; /** * Tests BerchtoldsTag + * + * @throws \ReflectionException + * @throws \Exception */ public function testBerchtoldsTag() { @@ -41,8 +44,9 @@ public function testBerchtoldsTag() /** * Tests translated name of BerchtoldsTag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +58,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Glarus/ChristmasDayTest.php b/tests/Switzerland/Glarus/ChristmasDayTest.php index b250cbea6..d3e0df6bd 100644 --- a/tests/Switzerland/Glarus/ChristmasDayTest.php +++ b/tests/Switzerland/Glarus/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Glarus; @@ -24,7 +24,7 @@ class ChristmasDayTest extends GlarusBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends GlarusBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Glarus/EasterMondayTest.php b/tests/Switzerland/Glarus/EasterMondayTest.php index 7dff8c253..ba5155acf 100644 --- a/tests/Switzerland/Glarus/EasterMondayTest.php +++ b/tests/Switzerland/Glarus/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Glarus; @@ -25,10 +25,12 @@ class EasterMondayTest extends GlarusBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Glarus/GlarusBaseTestCase.php b/tests/Switzerland/Glarus/GlarusBaseTestCase.php index 92a268172..2a9ad54ed 100644 --- a/tests/Switzerland/Glarus/GlarusBaseTestCase.php +++ b/tests/Switzerland/Glarus/GlarusBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Glarus; @@ -25,15 +25,15 @@ abstract class GlarusBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Glarus'; + public const REGION = 'Switzerland/Glarus'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Glarus/GlarusTest.php b/tests/Switzerland/Glarus/GlarusTest.php index b93ba9b7d..fba0312a6 100644 --- a/tests/Switzerland/Glarus/GlarusTest.php +++ b/tests/Switzerland/Glarus/GlarusTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Glarus; @@ -26,8 +26,9 @@ class GlarusTest extends GlarusBaseTestCase /** * Tests if all official holidays in Glarus (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Glarus (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -57,8 +59,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Glarus (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -70,24 +73,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Glarus (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Glarus (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Glarus (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Glarus/GoodFridayTest.php b/tests/Switzerland/Glarus/GoodFridayTest.php index b652b5114..587fe53e3 100644 --- a/tests/Switzerland/Glarus/GoodFridayTest.php +++ b/tests/Switzerland/Glarus/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Glarus; @@ -25,10 +25,12 @@ class GoodFridayTest extends GlarusBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Glarus/NafelserFahrtTest.php b/tests/Switzerland/Glarus/NafelserFahrtTest.php index ac2f6c84c..0f1ff6255 100644 --- a/tests/Switzerland/Glarus/NafelserFahrtTest.php +++ b/tests/Switzerland/Glarus/NafelserFahrtTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Glarus; @@ -25,15 +25,17 @@ class NafelserFahrtTest extends GlarusBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'nafelserFahrt'; + public const HOLIDAY = 'nafelserFahrt'; /** * The year in which the holiday was established */ - const ESTABLISHMENT_YEAR = 1389; + public const ESTABLISHMENT_YEAR = 1389; /** * Tests Näfelser Fahrt on or after 1389 + * @throws \ReflectionException + * @throws \Exception */ public function testNafelserFahrtOnAfter1389() { @@ -45,6 +47,7 @@ public function testNafelserFahrtOnAfter1389() /** * Tests Näfelser Fahrt before 1389 + * @throws \ReflectionException */ public function testNafelserFahrtBefore1389() { @@ -54,8 +57,9 @@ public function testNafelserFahrtBefore1389() /** * Tests translated name of Näfelser Fahrt. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -67,8 +71,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Switzerland/Glarus/NewYearsDayTest.php b/tests/Switzerland/Glarus/NewYearsDayTest.php index 0e94f9e4f..915c4f1d1 100644 --- a/tests/Switzerland/Glarus/NewYearsDayTest.php +++ b/tests/Switzerland/Glarus/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Glarus; @@ -24,7 +24,7 @@ class NewYearsDayTest extends GlarusBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends GlarusBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Glarus/PentecostMondayTest.php b/tests/Switzerland/Glarus/PentecostMondayTest.php index 877a682eb..bab326a1a 100644 --- a/tests/Switzerland/Glarus/PentecostMondayTest.php +++ b/tests/Switzerland/Glarus/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Glarus; @@ -25,10 +25,12 @@ class PentecostMondayTest extends GlarusBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Glarus/StStephensDayTest.php b/tests/Switzerland/Glarus/StStephensDayTest.php index da412092f..46d666862 100644 --- a/tests/Switzerland/Glarus/StStephensDayTest.php +++ b/tests/Switzerland/Glarus/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Glarus; @@ -24,7 +24,7 @@ class StStephensDayTest extends GlarusBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends GlarusBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Grisons/AscensionDayTest.php b/tests/Switzerland/Grisons/AscensionDayTest.php index 8909d8a83..3702675d7 100644 --- a/tests/Switzerland/Grisons/AscensionDayTest.php +++ b/tests/Switzerland/Grisons/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Grisons; @@ -25,10 +25,12 @@ class AscensionDayTest extends GrisonsBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Grisons/ChristmasDayTest.php b/tests/Switzerland/Grisons/ChristmasDayTest.php index ad545b331..753da15ca 100644 --- a/tests/Switzerland/Grisons/ChristmasDayTest.php +++ b/tests/Switzerland/Grisons/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Grisons; @@ -24,7 +24,7 @@ class ChristmasDayTest extends GrisonsBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends GrisonsBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Grisons/EasterMondayTest.php b/tests/Switzerland/Grisons/EasterMondayTest.php index e95b8551f..2b61b1490 100644 --- a/tests/Switzerland/Grisons/EasterMondayTest.php +++ b/tests/Switzerland/Grisons/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Grisons; @@ -25,10 +25,12 @@ class EasterMondayTest extends GrisonsBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Grisons/GoodFridayTest.php b/tests/Switzerland/Grisons/GoodFridayTest.php index 9abb06252..6b88ac619 100644 --- a/tests/Switzerland/Grisons/GoodFridayTest.php +++ b/tests/Switzerland/Grisons/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Grisons; @@ -25,10 +25,12 @@ class GoodFridayTest extends GrisonsBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Grisons/GrisonsBaseTestCase.php b/tests/Switzerland/Grisons/GrisonsBaseTestCase.php index b5cfe5e10..b35abc1d1 100644 --- a/tests/Switzerland/Grisons/GrisonsBaseTestCase.php +++ b/tests/Switzerland/Grisons/GrisonsBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Grisons; @@ -25,15 +25,15 @@ abstract class GrisonsBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Grisons'; + public const REGION = 'Switzerland/Grisons'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Grisons/GrisonsTest.php b/tests/Switzerland/Grisons/GrisonsTest.php index 6eac7c84a..4ac400833 100644 --- a/tests/Switzerland/Grisons/GrisonsTest.php +++ b/tests/Switzerland/Grisons/GrisonsTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Grisons; @@ -26,8 +26,9 @@ class GrisonsTest extends GrisonsBaseTestCase /** * Tests if all official holidays in Grisons (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Grisons (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -54,8 +56,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Grisons (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -67,24 +70,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Grisons (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Grisons (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Grisons (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Grisons/NewYearsDayTest.php b/tests/Switzerland/Grisons/NewYearsDayTest.php index ec4fb5acc..bc4079d29 100644 --- a/tests/Switzerland/Grisons/NewYearsDayTest.php +++ b/tests/Switzerland/Grisons/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Grisons; @@ -24,7 +24,7 @@ class NewYearsDayTest extends GrisonsBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends GrisonsBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Grisons/PentecostMondayTest.php b/tests/Switzerland/Grisons/PentecostMondayTest.php index d053a00f9..0a13bf1a2 100644 --- a/tests/Switzerland/Grisons/PentecostMondayTest.php +++ b/tests/Switzerland/Grisons/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Grisons; @@ -25,10 +25,12 @@ class PentecostMondayTest extends GrisonsBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Grisons/StStephensDayTest.php b/tests/Switzerland/Grisons/StStephensDayTest.php index f91a1f703..a6f8ec8c0 100644 --- a/tests/Switzerland/Grisons/StStephensDayTest.php +++ b/tests/Switzerland/Grisons/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Grisons; @@ -24,7 +24,7 @@ class StStephensDayTest extends GrisonsBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends GrisonsBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Jura/AllSaintsDayTest.php b/tests/Switzerland/Jura/AllSaintsDayTest.php index 56bd092dd..541ffc4ee 100644 --- a/tests/Switzerland/Jura/AllSaintsDayTest.php +++ b/tests/Switzerland/Jura/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends JuraBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends JuraBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAllSaintsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testAllSaintsDay($year, $expected) /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Jura/AscensionDayTest.php b/tests/Switzerland/Jura/AscensionDayTest.php index cac92318c..fa9a5e342 100644 --- a/tests/Switzerland/Jura/AscensionDayTest.php +++ b/tests/Switzerland/Jura/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -25,10 +25,12 @@ class AscensionDayTest extends JuraBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Jura/AssumptionOfMaryTest.php b/tests/Switzerland/Jura/AssumptionOfMaryTest.php index 3ab063c96..ee32521bd 100644 --- a/tests/Switzerland/Jura/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Jura/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends JuraBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the day of the Assumption of Mary. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends JuraBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAssumptionOfMary($year, $expected) { @@ -41,8 +43,9 @@ public function testAssumptionOfMary($year, $expected) /** * Tests translated name of the day of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the day of the Assumption of Mary. * * @return array list of test dates for the day of the Assumption of Mary + * @throws \Exception */ - public function AssumptionOfMaryDataProvider() + public function AssumptionOfMaryDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } diff --git a/tests/Switzerland/Jura/BerchtoldsTagTest.php b/tests/Switzerland/Jura/BerchtoldsTagTest.php index 3628a5ac8..8df4b3343 100644 --- a/tests/Switzerland/Jura/BerchtoldsTagTest.php +++ b/tests/Switzerland/Jura/BerchtoldsTagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -25,10 +25,13 @@ class BerchtoldsTagTest extends JuraBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'berchtoldsTag'; + public const HOLIDAY = 'berchtoldsTag'; /** * Tests BerchtoldsTag + * + * @throws \ReflectionException + * @throws \Exception */ public function testBerchtoldsTag() { @@ -41,8 +44,9 @@ public function testBerchtoldsTag() /** * Tests translated name of BerchtoldsTag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +58,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Jura/ChristmasDayTest.php b/tests/Switzerland/Jura/ChristmasDayTest.php index d3dc25632..aff31ae7c 100644 --- a/tests/Switzerland/Jura/ChristmasDayTest.php +++ b/tests/Switzerland/Jura/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -24,7 +24,7 @@ class ChristmasDayTest extends JuraBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends JuraBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Jura/CorpusChristiTest.php b/tests/Switzerland/Jura/CorpusChristiTest.php index 06ea48ff4..096750be7 100644 --- a/tests/Switzerland/Jura/CorpusChristiTest.php +++ b/tests/Switzerland/Jura/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -27,10 +27,13 @@ class CorpusChristiTest extends JuraBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Jura/EasterMondayTest.php b/tests/Switzerland/Jura/EasterMondayTest.php index 31ccd98af..b3ceb36c3 100644 --- a/tests/Switzerland/Jura/EasterMondayTest.php +++ b/tests/Switzerland/Jura/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -25,10 +25,12 @@ class EasterMondayTest extends JuraBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Jura/GoodFridayTest.php b/tests/Switzerland/Jura/GoodFridayTest.php index 480d3a0d5..5b41e66b0 100644 --- a/tests/Switzerland/Jura/GoodFridayTest.php +++ b/tests/Switzerland/Jura/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -25,10 +25,12 @@ class GoodFridayTest extends JuraBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Jura/JuraBaseTestCase.php b/tests/Switzerland/Jura/JuraBaseTestCase.php index c6d631cc8..c78937257 100644 --- a/tests/Switzerland/Jura/JuraBaseTestCase.php +++ b/tests/Switzerland/Jura/JuraBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -25,15 +25,15 @@ abstract class JuraBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Jura'; + public const REGION = 'Switzerland/Jura'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'fr_CH'; + public const LOCALE = 'fr_CH'; } diff --git a/tests/Switzerland/Jura/JuraTest.php b/tests/Switzerland/Jura/JuraTest.php index 5fb4f6108..ee7ca33b1 100644 --- a/tests/Switzerland/Jura/JuraTest.php +++ b/tests/Switzerland/Jura/JuraTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -26,8 +26,9 @@ class JuraTest extends JuraBaseTestCase /** * Tests if all official holidays in Jura (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Jura (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -59,8 +61,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Jura (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -72,24 +75,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Jura (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Jura (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Jura (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Jura/NewYearsDayTest.php b/tests/Switzerland/Jura/NewYearsDayTest.php index 8a38ff268..017e2a4b2 100644 --- a/tests/Switzerland/Jura/NewYearsDayTest.php +++ b/tests/Switzerland/Jura/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -24,7 +24,7 @@ class NewYearsDayTest extends JuraBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends JuraBaseTestCase implements YasumiTestCaseInterfac * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Jura/PentecostMondayTest.php b/tests/Switzerland/Jura/PentecostMondayTest.php index 339b58910..62fc84892 100644 --- a/tests/Switzerland/Jura/PentecostMondayTest.php +++ b/tests/Switzerland/Jura/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -25,10 +25,12 @@ class PentecostMondayTest extends JuraBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Jura/PlebisciteJurassienTest.php b/tests/Switzerland/Jura/PlebisciteJurassienTest.php index d78307304..bbe904701 100644 --- a/tests/Switzerland/Jura/PlebisciteJurassienTest.php +++ b/tests/Switzerland/Jura/PlebisciteJurassienTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -25,15 +25,17 @@ class PlebisciteJurassienTest extends JuraBaseTestCase implements YasumiTestCase /** * The name of the holiday */ - const HOLIDAY = 'plebisciteJurassien'; + public const HOLIDAY = 'plebisciteJurassien'; /** * The year in which the holiday was established */ - const ESTABLISHMENT_YEAR = 1975; + public const ESTABLISHMENT_YEAR = 1975; /** * Tests Plébiscite jurassien on or after 1975. + * @throws \Exception + * @throws \ReflectionException */ public function testInstaurationRepubliqueOnAfter1975() { @@ -48,6 +50,7 @@ public function testInstaurationRepubliqueOnAfter1975() /** * Tests Plébiscite jurassien before 1975. + * @throws \ReflectionException */ public function testInstaurationRepubliqueBefore1975() { @@ -60,8 +63,9 @@ public function testInstaurationRepubliqueBefore1975() /** * Tests translated name of Plébiscite jurassien. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Switzerland/Jura/WorkersDayTest.php b/tests/Switzerland/Jura/WorkersDayTest.php index 78dbb3007..7a6ed5708 100644 --- a/tests/Switzerland/Jura/WorkersDayTest.php +++ b/tests/Switzerland/Jura/WorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Jura; @@ -25,7 +25,7 @@ class WorkersDayTest extends JuraBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -34,6 +34,9 @@ class WorkersDayTest extends JuraBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -45,8 +48,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -61,8 +65,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +79,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Lucerne/AllSaintsDayTest.php b/tests/Switzerland/Lucerne/AllSaintsDayTest.php index 006c49525..4e1d37d98 100644 --- a/tests/Switzerland/Lucerne/AllSaintsDayTest.php +++ b/tests/Switzerland/Lucerne/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends LucerneBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends LucerneBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAllSaintsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testAllSaintsDay($year, $expected) /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Lucerne/AscensionDayTest.php b/tests/Switzerland/Lucerne/AscensionDayTest.php index e72b5fa65..b1bce4638 100644 --- a/tests/Switzerland/Lucerne/AscensionDayTest.php +++ b/tests/Switzerland/Lucerne/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -25,10 +25,12 @@ class AscensionDayTest extends LucerneBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Lucerne/AssumptionOfMaryTest.php b/tests/Switzerland/Lucerne/AssumptionOfMaryTest.php index d5931679d..bc2adedd1 100644 --- a/tests/Switzerland/Lucerne/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Lucerne/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends LucerneBaseTestCase implements YasumiTestCase /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the day of the Assumption of Mary. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends LucerneBaseTestCase implements YasumiTestCase * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAssumptionOfMary($year, $expected) { @@ -41,8 +43,9 @@ public function testAssumptionOfMary($year, $expected) /** * Tests translated name of the day of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the day of the Assumption of Mary. * * @return array list of test dates for the day of the Assumption of Mary + * @throws \Exception */ - public function AssumptionOfMaryDataProvider() + public function AssumptionOfMaryDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } diff --git a/tests/Switzerland/Lucerne/BerchtoldsTagTest.php b/tests/Switzerland/Lucerne/BerchtoldsTagTest.php index be49cc72b..cfeb8b86c 100644 --- a/tests/Switzerland/Lucerne/BerchtoldsTagTest.php +++ b/tests/Switzerland/Lucerne/BerchtoldsTagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -25,10 +25,13 @@ class BerchtoldsTagTest extends LucerneBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'berchtoldsTag'; + public const HOLIDAY = 'berchtoldsTag'; /** * Tests BerchtoldsTag + * + * @throws \ReflectionException + * @throws \Exception */ public function testBerchtoldsTag() { @@ -41,8 +44,9 @@ public function testBerchtoldsTag() /** * Tests translated name of BerchtoldsTag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +58,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Lucerne/ChristmasDayTest.php b/tests/Switzerland/Lucerne/ChristmasDayTest.php index d28d9e3b3..83681619b 100644 --- a/tests/Switzerland/Lucerne/ChristmasDayTest.php +++ b/tests/Switzerland/Lucerne/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -24,7 +24,7 @@ class ChristmasDayTest extends LucerneBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends LucerneBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Lucerne/CorpusChristiTest.php b/tests/Switzerland/Lucerne/CorpusChristiTest.php index 5a1b92953..dea7e1285 100644 --- a/tests/Switzerland/Lucerne/CorpusChristiTest.php +++ b/tests/Switzerland/Lucerne/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -27,10 +27,13 @@ class CorpusChristiTest extends LucerneBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Lucerne/EasterMondayTest.php b/tests/Switzerland/Lucerne/EasterMondayTest.php index 5a7a5f955..dde3582a2 100644 --- a/tests/Switzerland/Lucerne/EasterMondayTest.php +++ b/tests/Switzerland/Lucerne/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -25,10 +25,12 @@ class EasterMondayTest extends LucerneBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Lucerne/GoodFridayTest.php b/tests/Switzerland/Lucerne/GoodFridayTest.php index 24c56c151..4dd256572 100644 --- a/tests/Switzerland/Lucerne/GoodFridayTest.php +++ b/tests/Switzerland/Lucerne/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -25,10 +25,12 @@ class GoodFridayTest extends LucerneBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Lucerne/ImmaculateConceptionTest.php b/tests/Switzerland/Lucerne/ImmaculateConceptionTest.php index 673fe9e62..0eab721c1 100644 --- a/tests/Switzerland/Lucerne/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Lucerne/ImmaculateConceptionTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -24,7 +24,7 @@ class ImmaculateConceptionTest extends LucerneBaseTestCase implements YasumiTest /** * The name of the holiday to be tested */ - const HOLIDAY = 'immaculateConception'; + public const HOLIDAY = 'immaculateConception'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ImmaculateConceptionTest extends LucerneBaseTestCase implements YasumiTest * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Lucerne/LucerneBaseTestCase.php b/tests/Switzerland/Lucerne/LucerneBaseTestCase.php index a5431dbb4..227ddcbeb 100644 --- a/tests/Switzerland/Lucerne/LucerneBaseTestCase.php +++ b/tests/Switzerland/Lucerne/LucerneBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -25,15 +25,15 @@ abstract class LucerneBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Lucerne'; + public const REGION = 'Switzerland/Lucerne'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Lucerne/LucerneTest.php b/tests/Switzerland/Lucerne/LucerneTest.php index f0baada26..947429551 100644 --- a/tests/Switzerland/Lucerne/LucerneTest.php +++ b/tests/Switzerland/Lucerne/LucerneTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -26,8 +26,9 @@ class LucerneTest extends LucerneBaseTestCase /** * Tests if all official holidays in Lucerne (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Lucerne (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -59,8 +61,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Lucerne (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -72,24 +75,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Lucerne (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Lucerne (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Lucerne (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Lucerne/NewYearsDayTest.php b/tests/Switzerland/Lucerne/NewYearsDayTest.php index f46056816..eee351c8f 100644 --- a/tests/Switzerland/Lucerne/NewYearsDayTest.php +++ b/tests/Switzerland/Lucerne/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -24,7 +24,7 @@ class NewYearsDayTest extends LucerneBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends LucerneBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Lucerne/PentecostMondayTest.php b/tests/Switzerland/Lucerne/PentecostMondayTest.php index e216bc079..990b5f904 100644 --- a/tests/Switzerland/Lucerne/PentecostMondayTest.php +++ b/tests/Switzerland/Lucerne/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -25,10 +25,12 @@ class PentecostMondayTest extends LucerneBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Lucerne/StStephensDayTest.php b/tests/Switzerland/Lucerne/StStephensDayTest.php index 250cec510..3d6dfff95 100644 --- a/tests/Switzerland/Lucerne/StStephensDayTest.php +++ b/tests/Switzerland/Lucerne/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Lucerne; @@ -24,7 +24,7 @@ class StStephensDayTest extends LucerneBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends LucerneBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Neuchatel/AscensionDayTest.php b/tests/Switzerland/Neuchatel/AscensionDayTest.php index 50f0341d3..d68e10e89 100644 --- a/tests/Switzerland/Neuchatel/AscensionDayTest.php +++ b/tests/Switzerland/Neuchatel/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Neuchatel; @@ -25,10 +25,12 @@ class AscensionDayTest extends NeuchatelBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Neuchatel/BerchtoldsTagTest.php b/tests/Switzerland/Neuchatel/BerchtoldsTagTest.php index 1879a90e9..51d1ee60b 100644 --- a/tests/Switzerland/Neuchatel/BerchtoldsTagTest.php +++ b/tests/Switzerland/Neuchatel/BerchtoldsTagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Neuchatel; @@ -25,10 +25,13 @@ class BerchtoldsTagTest extends NeuchatelBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'berchtoldsTag'; + public const HOLIDAY = 'berchtoldsTag'; /** * Tests BerchtoldsTag + * + * @throws \ReflectionException + * @throws \Exception */ public function testBerchtoldsTag() { @@ -41,8 +44,9 @@ public function testBerchtoldsTag() /** * Tests translated name of BerchtoldsTag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +58,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Neuchatel/BettagsMontagTest.php b/tests/Switzerland/Neuchatel/BettagsMontagTest.php index 1d4f565d0..aed0f2650 100644 --- a/tests/Switzerland/Neuchatel/BettagsMontagTest.php +++ b/tests/Switzerland/Neuchatel/BettagsMontagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Neuchatel; @@ -26,10 +26,13 @@ class BettagsMontagTest extends NeuchatelBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'bettagsMontag'; + public const HOLIDAY = 'bettagsMontag'; /** * Tests Bettags Montag on or after 1832 + * + * @throws \ReflectionException + * @throws \Exception */ public function testBettagsMontagOnAfter1832() { @@ -45,6 +48,7 @@ public function testBettagsMontagOnAfter1832() /** * Tests Bettags Montag before 1832 + * @throws \ReflectionException */ public function testBettagsMontagBefore1832() { @@ -54,8 +58,9 @@ public function testBettagsMontagBefore1832() /** * Tests translated name of Bettags Montag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -67,8 +72,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1900), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Neuchatel/ChristmasDayTest.php b/tests/Switzerland/Neuchatel/ChristmasDayTest.php index 88334d42f..0b679cc59 100644 --- a/tests/Switzerland/Neuchatel/ChristmasDayTest.php +++ b/tests/Switzerland/Neuchatel/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Neuchatel; @@ -24,7 +24,7 @@ class ChristmasDayTest extends NeuchatelBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends NeuchatelBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Neuchatel/EasterMondayTest.php b/tests/Switzerland/Neuchatel/EasterMondayTest.php index 974a3a222..9b59bc15e 100644 --- a/tests/Switzerland/Neuchatel/EasterMondayTest.php +++ b/tests/Switzerland/Neuchatel/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Neuchatel; @@ -25,10 +25,12 @@ class EasterMondayTest extends NeuchatelBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Neuchatel/GoodFridayTest.php b/tests/Switzerland/Neuchatel/GoodFridayTest.php index 013507247..86cd6135e 100644 --- a/tests/Switzerland/Neuchatel/GoodFridayTest.php +++ b/tests/Switzerland/Neuchatel/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Neuchatel; @@ -25,10 +25,12 @@ class GoodFridayTest extends NeuchatelBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Neuchatel/InstaurationRepubliqueTest.php b/tests/Switzerland/Neuchatel/InstaurationRepubliqueTest.php index 7008c9815..258385937 100644 --- a/tests/Switzerland/Neuchatel/InstaurationRepubliqueTest.php +++ b/tests/Switzerland/Neuchatel/InstaurationRepubliqueTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Neuchatel; @@ -25,15 +25,17 @@ class InstaurationRepubliqueTest extends NeuchatelBaseTestCase implements Yasumi /** * The name of the holiday */ - const HOLIDAY = 'instaurationRepublique'; + public const HOLIDAY = 'instaurationRepublique'; /** * The year in which the holiday was established */ - const ESTABLISHMENT_YEAR = 1849; + public const ESTABLISHMENT_YEAR = 1849; /** * Tests Instauration de la République on or after 1849. + * @throws \Exception + * @throws \ReflectionException */ public function testInstaurationRepubliqueOnAfter1849() { @@ -48,6 +50,7 @@ public function testInstaurationRepubliqueOnAfter1849() /** * Tests Instauration de la République before 1849. + * @throws \ReflectionException */ public function testInstaurationRepubliqueBefore1849() { @@ -60,8 +63,9 @@ public function testInstaurationRepubliqueBefore1849() /** * Tests translated name of Instauration de la République. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Switzerland/Neuchatel/NeuchatelBaseTestCase.php b/tests/Switzerland/Neuchatel/NeuchatelBaseTestCase.php index 7e201f84a..4507519db 100644 --- a/tests/Switzerland/Neuchatel/NeuchatelBaseTestCase.php +++ b/tests/Switzerland/Neuchatel/NeuchatelBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Neuchatel; @@ -25,15 +25,15 @@ abstract class NeuchatelBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Neuchatel'; + public const REGION = 'Switzerland/Neuchatel'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'fr_CH'; + public const LOCALE = 'fr_CH'; } diff --git a/tests/Switzerland/Neuchatel/NeuchatelTest.php b/tests/Switzerland/Neuchatel/NeuchatelTest.php index 5b8b5db86..46c5f75f5 100644 --- a/tests/Switzerland/Neuchatel/NeuchatelTest.php +++ b/tests/Switzerland/Neuchatel/NeuchatelTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Neuchatel; @@ -26,8 +26,9 @@ class NeuchatelTest extends NeuchatelBaseTestCase /** * Tests if all official holidays in Neuchatel (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Neuchatel (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -57,8 +59,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Neuchatel (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -70,24 +73,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Neuchatel (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Neuchatel (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Neuchatel (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Neuchatel/NewYearsDayTest.php b/tests/Switzerland/Neuchatel/NewYearsDayTest.php index 03467ac7a..efd18d79b 100644 --- a/tests/Switzerland/Neuchatel/NewYearsDayTest.php +++ b/tests/Switzerland/Neuchatel/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Neuchatel; @@ -24,7 +24,7 @@ class NewYearsDayTest extends NeuchatelBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends NeuchatelBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Neuchatel/PentecostMondayTest.php b/tests/Switzerland/Neuchatel/PentecostMondayTest.php index 2b75d49b3..5304750f9 100644 --- a/tests/Switzerland/Neuchatel/PentecostMondayTest.php +++ b/tests/Switzerland/Neuchatel/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Neuchatel; @@ -25,10 +25,12 @@ class PentecostMondayTest extends NeuchatelBaseTestCase implements YasumiTestCas /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Neuchatel/WorkersDayTest.php b/tests/Switzerland/Neuchatel/WorkersDayTest.php index 017b90b33..d1106f94f 100644 --- a/tests/Switzerland/Neuchatel/WorkersDayTest.php +++ b/tests/Switzerland/Neuchatel/WorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Neuchatel; @@ -25,7 +25,7 @@ class WorkersDayTest extends NeuchatelBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -34,6 +34,9 @@ class WorkersDayTest extends NeuchatelBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -45,8 +48,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -61,8 +65,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +79,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Nidwalden/AllSaintsDayTest.php b/tests/Switzerland/Nidwalden/AllSaintsDayTest.php index 802e637da..fb2fb6643 100644 --- a/tests/Switzerland/Nidwalden/AllSaintsDayTest.php +++ b/tests/Switzerland/Nidwalden/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends NidwaldenBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends NidwaldenBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAllSaintsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testAllSaintsDay($year, $expected) /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Nidwalden/AscensionDayTest.php b/tests/Switzerland/Nidwalden/AscensionDayTest.php index cb33b3e45..4dcb85569 100644 --- a/tests/Switzerland/Nidwalden/AscensionDayTest.php +++ b/tests/Switzerland/Nidwalden/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -25,10 +25,12 @@ class AscensionDayTest extends NidwaldenBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Nidwalden/AssumptionOfMaryTest.php b/tests/Switzerland/Nidwalden/AssumptionOfMaryTest.php index c71ff69e8..0b4138cb5 100644 --- a/tests/Switzerland/Nidwalden/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Nidwalden/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends NidwaldenBaseTestCase implements YasumiTestCa /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the day of the Assumption of Mary. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends NidwaldenBaseTestCase implements YasumiTestCa * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAssumptionOfMary($year, $expected) { @@ -41,8 +43,9 @@ public function testAssumptionOfMary($year, $expected) /** * Tests translated name of the day of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the day of the Assumption of Mary. * * @return array list of test dates for the day of the Assumption of Mary + * @throws \Exception */ - public function AssumptionOfMaryDataProvider() + public function AssumptionOfMaryDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } diff --git a/tests/Switzerland/Nidwalden/ChristmasDayTest.php b/tests/Switzerland/Nidwalden/ChristmasDayTest.php index 98ed832e7..025a37302 100644 --- a/tests/Switzerland/Nidwalden/ChristmasDayTest.php +++ b/tests/Switzerland/Nidwalden/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -24,7 +24,7 @@ class ChristmasDayTest extends NidwaldenBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends NidwaldenBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Nidwalden/CorpusChristiTest.php b/tests/Switzerland/Nidwalden/CorpusChristiTest.php index 5e144fbde..a97cda2e6 100644 --- a/tests/Switzerland/Nidwalden/CorpusChristiTest.php +++ b/tests/Switzerland/Nidwalden/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -27,10 +27,13 @@ class CorpusChristiTest extends NidwaldenBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Nidwalden/EasterMondayTest.php b/tests/Switzerland/Nidwalden/EasterMondayTest.php index df5cdae38..ab15cc62c 100644 --- a/tests/Switzerland/Nidwalden/EasterMondayTest.php +++ b/tests/Switzerland/Nidwalden/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -25,10 +25,12 @@ class EasterMondayTest extends NidwaldenBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Nidwalden/GoodFridayTest.php b/tests/Switzerland/Nidwalden/GoodFridayTest.php index d975461bb..8fbbf2880 100644 --- a/tests/Switzerland/Nidwalden/GoodFridayTest.php +++ b/tests/Switzerland/Nidwalden/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -25,10 +25,12 @@ class GoodFridayTest extends NidwaldenBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Nidwalden/ImmaculateConceptionTest.php b/tests/Switzerland/Nidwalden/ImmaculateConceptionTest.php index 467d4df8e..c8af8ea48 100644 --- a/tests/Switzerland/Nidwalden/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Nidwalden/ImmaculateConceptionTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -24,7 +24,7 @@ class ImmaculateConceptionTest extends NidwaldenBaseTestCase implements YasumiTe /** * The name of the holiday to be tested */ - const HOLIDAY = 'immaculateConception'; + public const HOLIDAY = 'immaculateConception'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ImmaculateConceptionTest extends NidwaldenBaseTestCase implements YasumiTe * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Nidwalden/NewYearsDayTest.php b/tests/Switzerland/Nidwalden/NewYearsDayTest.php index 70f2a7c3f..1680220a9 100644 --- a/tests/Switzerland/Nidwalden/NewYearsDayTest.php +++ b/tests/Switzerland/Nidwalden/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -24,7 +24,7 @@ class NewYearsDayTest extends NidwaldenBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends NidwaldenBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Nidwalden/NidwaldenBaseTestCase.php b/tests/Switzerland/Nidwalden/NidwaldenBaseTestCase.php index eb149d7b2..ffe302b75 100644 --- a/tests/Switzerland/Nidwalden/NidwaldenBaseTestCase.php +++ b/tests/Switzerland/Nidwalden/NidwaldenBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -25,15 +25,15 @@ abstract class NidwaldenBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Nidwalden'; + public const REGION = 'Switzerland/Nidwalden'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Nidwalden/NidwaldenTest.php b/tests/Switzerland/Nidwalden/NidwaldenTest.php index bafe39f67..5805ccbbf 100644 --- a/tests/Switzerland/Nidwalden/NidwaldenTest.php +++ b/tests/Switzerland/Nidwalden/NidwaldenTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -26,8 +26,9 @@ class NidwaldenTest extends NidwaldenBaseTestCase /** * Tests if all official holidays in Nidwalden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Nidwalden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'stJosephsDay', @@ -59,8 +61,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Nidwalden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -72,24 +75,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Nidwalden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Nidwalden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Nidwalden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Nidwalden/PentecostMondayTest.php b/tests/Switzerland/Nidwalden/PentecostMondayTest.php index e50bce995..bd2510749 100644 --- a/tests/Switzerland/Nidwalden/PentecostMondayTest.php +++ b/tests/Switzerland/Nidwalden/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -25,10 +25,12 @@ class PentecostMondayTest extends NidwaldenBaseTestCase implements YasumiTestCas /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Nidwalden/StJosephDayTest.php b/tests/Switzerland/Nidwalden/StJosephDayTest.php index da01566a1..7f7827a82 100644 --- a/tests/Switzerland/Nidwalden/StJosephDayTest.php +++ b/tests/Switzerland/Nidwalden/StJosephDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -26,7 +26,7 @@ class StJosephDayTest extends NidwaldenBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'stJosephsDay'; + public const HOLIDAY = 'stJosephsDay'; /** * Tests St. Joseph's Day. @@ -35,6 +35,8 @@ class StJosephDayTest extends NidwaldenBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which St. Joseph's Day needs to be tested * @param \DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testStJosephDay($year, $expected) { @@ -45,16 +47,18 @@ public function testStJosephDay($year, $expected) * Returns a list of random test dates used for assertion of St. Joseph's Day. * * @return array list of test dates for St. Joseph's Day + * @throws \Exception */ - public function StJosephDayDataProvider() + public function StJosephDayDataProvider(): array { return $this->generateRandomDates(3, 19, self::TIMEZONE); } /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -66,8 +70,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Nidwalden/StStephensDayTest.php b/tests/Switzerland/Nidwalden/StStephensDayTest.php index e1ec0e5b4..3442684aa 100644 --- a/tests/Switzerland/Nidwalden/StStephensDayTest.php +++ b/tests/Switzerland/Nidwalden/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Nidwalden; @@ -24,7 +24,7 @@ class StStephensDayTest extends NidwaldenBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends NidwaldenBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Obwalden/AllSaintsDayTest.php b/tests/Switzerland/Obwalden/AllSaintsDayTest.php index f12e29724..439286f8b 100644 --- a/tests/Switzerland/Obwalden/AllSaintsDayTest.php +++ b/tests/Switzerland/Obwalden/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends ObwaldenBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends ObwaldenBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAllSaintsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testAllSaintsDay($year, $expected) /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Obwalden/AscensionDayTest.php b/tests/Switzerland/Obwalden/AscensionDayTest.php index 08637837d..ac021274a 100644 --- a/tests/Switzerland/Obwalden/AscensionDayTest.php +++ b/tests/Switzerland/Obwalden/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -25,10 +25,12 @@ class AscensionDayTest extends ObwaldenBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Obwalden/AssumptionOfMaryTest.php b/tests/Switzerland/Obwalden/AssumptionOfMaryTest.php index b9e0cf112..3e64b2056 100644 --- a/tests/Switzerland/Obwalden/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Obwalden/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends ObwaldenBaseTestCase implements YasumiTestCas /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the day of the Assumption of Mary. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends ObwaldenBaseTestCase implements YasumiTestCas * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAssumptionOfMary($year, $expected) { @@ -41,8 +43,9 @@ public function testAssumptionOfMary($year, $expected) /** * Tests translated name of the day of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the day of the Assumption of Mary. * * @return array list of test dates for the day of the Assumption of Mary + * @throws \Exception */ - public function AssumptionOfMaryDataProvider() + public function AssumptionOfMaryDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } diff --git a/tests/Switzerland/Obwalden/BerchtoldsTagTest.php b/tests/Switzerland/Obwalden/BerchtoldsTagTest.php index db3d08ade..1239edc29 100644 --- a/tests/Switzerland/Obwalden/BerchtoldsTagTest.php +++ b/tests/Switzerland/Obwalden/BerchtoldsTagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -25,10 +25,13 @@ class BerchtoldsTagTest extends ObwaldenBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'berchtoldsTag'; + public const HOLIDAY = 'berchtoldsTag'; /** * Tests BerchtoldsTag + * + * @throws \ReflectionException + * @throws \Exception */ public function testBerchtoldsTag() { @@ -41,8 +44,9 @@ public function testBerchtoldsTag() /** * Tests translated name of BerchtoldsTag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +58,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Obwalden/BruderKlausenFestTest.php b/tests/Switzerland/Obwalden/BruderKlausenFestTest.php index f2c66470f..351f63b6c 100644 --- a/tests/Switzerland/Obwalden/BruderKlausenFestTest.php +++ b/tests/Switzerland/Obwalden/BruderKlausenFestTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -25,10 +25,13 @@ class BruderKlausenFestTest extends ObwaldenBaseTestCase implements YasumiTestCa /** * The name of the holiday */ - const HOLIDAY = 'bruderKlausenFest'; + public const HOLIDAY = 'bruderKlausenFest'; /** * Tests Bruder-Klausen-Fest on or after 1947 + * + * @throws \ReflectionException + * @throws \Exception */ public function testBruderKlausenFestOnAfter1947() { @@ -41,6 +44,9 @@ public function testBruderKlausenFestOnAfter1947() /** * Tests Bruder-Klausen-Fest between 1649 and 1946 + * + * @throws \ReflectionException + * @throws \Exception */ public function testBruderKlausenFestBetween1649And1946() { @@ -53,6 +59,7 @@ public function testBruderKlausenFestBetween1649And1946() /** * Tests Bruder-Klausen-Fest before 1648 + * @throws \ReflectionException */ public function testBruderKlausenFestBefore1648() { @@ -62,8 +69,9 @@ public function testBruderKlausenFestBefore1648() /** * Tests translated name of Bruder-Klausen-Fest. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -75,8 +83,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1947), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Obwalden/ChristmasDayTest.php b/tests/Switzerland/Obwalden/ChristmasDayTest.php index dded78c49..b73fab73b 100644 --- a/tests/Switzerland/Obwalden/ChristmasDayTest.php +++ b/tests/Switzerland/Obwalden/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -24,7 +24,7 @@ class ChristmasDayTest extends ObwaldenBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends ObwaldenBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Obwalden/CorpusChristiTest.php b/tests/Switzerland/Obwalden/CorpusChristiTest.php index 19cf79e9c..6c5372fd0 100644 --- a/tests/Switzerland/Obwalden/CorpusChristiTest.php +++ b/tests/Switzerland/Obwalden/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -27,10 +27,12 @@ class CorpusChristiTest extends ObwaldenBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +47,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +61,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Obwalden/EasterMondayTest.php b/tests/Switzerland/Obwalden/EasterMondayTest.php index 82aeabc43..aa6f5b5f1 100644 --- a/tests/Switzerland/Obwalden/EasterMondayTest.php +++ b/tests/Switzerland/Obwalden/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -25,10 +25,12 @@ class EasterMondayTest extends ObwaldenBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Obwalden/GoodFridayTest.php b/tests/Switzerland/Obwalden/GoodFridayTest.php index 994a41255..2c7c89a28 100644 --- a/tests/Switzerland/Obwalden/GoodFridayTest.php +++ b/tests/Switzerland/Obwalden/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -25,10 +25,12 @@ class GoodFridayTest extends ObwaldenBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Obwalden/ImmaculateConceptionTest.php b/tests/Switzerland/Obwalden/ImmaculateConceptionTest.php index 40e574f11..d5176261a 100644 --- a/tests/Switzerland/Obwalden/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Obwalden/ImmaculateConceptionTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -24,7 +24,7 @@ class ImmaculateConceptionTest extends ObwaldenBaseTestCase implements YasumiTes /** * The name of the holiday to be tested */ - const HOLIDAY = 'immaculateConception'; + public const HOLIDAY = 'immaculateConception'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ImmaculateConceptionTest extends ObwaldenBaseTestCase implements YasumiTes * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Obwalden/NewYearsDayTest.php b/tests/Switzerland/Obwalden/NewYearsDayTest.php index c7906d16b..49688e464 100644 --- a/tests/Switzerland/Obwalden/NewYearsDayTest.php +++ b/tests/Switzerland/Obwalden/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -24,7 +24,7 @@ class NewYearsDayTest extends ObwaldenBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends ObwaldenBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Obwalden/ObwaldenBaseTestCase.php b/tests/Switzerland/Obwalden/ObwaldenBaseTestCase.php index c1be0f967..981d7e74e 100644 --- a/tests/Switzerland/Obwalden/ObwaldenBaseTestCase.php +++ b/tests/Switzerland/Obwalden/ObwaldenBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -25,15 +25,15 @@ abstract class ObwaldenBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Obwalden'; + public const REGION = 'Switzerland/Obwalden'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Obwalden/ObwaldenTest.php b/tests/Switzerland/Obwalden/ObwaldenTest.php index 1516e517e..d33445a5b 100644 --- a/tests/Switzerland/Obwalden/ObwaldenTest.php +++ b/tests/Switzerland/Obwalden/ObwaldenTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -26,8 +26,9 @@ class ObwaldenTest extends ObwaldenBaseTestCase /** * Tests if all official holidays in Obwalden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Obwalden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -60,8 +62,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Obwalden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -73,24 +76,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Obwalden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Obwalden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Obwalden (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Obwalden/PentecostMondayTest.php b/tests/Switzerland/Obwalden/PentecostMondayTest.php index 98be839a6..3ad5c99b1 100644 --- a/tests/Switzerland/Obwalden/PentecostMondayTest.php +++ b/tests/Switzerland/Obwalden/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -25,10 +25,12 @@ class PentecostMondayTest extends ObwaldenBaseTestCase implements YasumiTestCase /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Obwalden/StStephensDayTest.php b/tests/Switzerland/Obwalden/StStephensDayTest.php index b7e549d6e..5d406dd8e 100644 --- a/tests/Switzerland/Obwalden/StStephensDayTest.php +++ b/tests/Switzerland/Obwalden/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Obwalden; @@ -24,7 +24,7 @@ class StStephensDayTest extends ObwaldenBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends ObwaldenBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schaffhausen/AscensionDayTest.php b/tests/Switzerland/Schaffhausen/AscensionDayTest.php index cf6abfafc..71e446d88 100644 --- a/tests/Switzerland/Schaffhausen/AscensionDayTest.php +++ b/tests/Switzerland/Schaffhausen/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schaffhausen; @@ -25,10 +25,12 @@ class AscensionDayTest extends SchaffhausenBaseTestCase implements YasumiTestCas /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schaffhausen/BerchtoldsTagTest.php b/tests/Switzerland/Schaffhausen/BerchtoldsTagTest.php index 032961057..a4f6046b4 100644 --- a/tests/Switzerland/Schaffhausen/BerchtoldsTagTest.php +++ b/tests/Switzerland/Schaffhausen/BerchtoldsTagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schaffhausen; @@ -25,10 +25,13 @@ class BerchtoldsTagTest extends SchaffhausenBaseTestCase implements YasumiTestCa /** * The name of the holiday */ - const HOLIDAY = 'berchtoldsTag'; + public const HOLIDAY = 'berchtoldsTag'; /** * Tests BerchtoldsTag + * + * @throws \ReflectionException + * @throws \Exception */ public function testBerchtoldsTag() { @@ -41,8 +44,9 @@ public function testBerchtoldsTag() /** * Tests translated name of BerchtoldsTag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +58,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schaffhausen/ChristmasDayTest.php b/tests/Switzerland/Schaffhausen/ChristmasDayTest.php index 037deea28..fe3f72334 100644 --- a/tests/Switzerland/Schaffhausen/ChristmasDayTest.php +++ b/tests/Switzerland/Schaffhausen/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schaffhausen; @@ -24,7 +24,7 @@ class ChristmasDayTest extends SchaffhausenBaseTestCase implements YasumiTestCas /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends SchaffhausenBaseTestCase implements YasumiTestCas * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schaffhausen/EasterMondayTest.php b/tests/Switzerland/Schaffhausen/EasterMondayTest.php index aed02ba5c..dbae3e39f 100644 --- a/tests/Switzerland/Schaffhausen/EasterMondayTest.php +++ b/tests/Switzerland/Schaffhausen/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schaffhausen; @@ -25,10 +25,12 @@ class EasterMondayTest extends SchaffhausenBaseTestCase implements YasumiTestCas /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schaffhausen/GoodFridayTest.php b/tests/Switzerland/Schaffhausen/GoodFridayTest.php index f91b4100c..105bf57dc 100644 --- a/tests/Switzerland/Schaffhausen/GoodFridayTest.php +++ b/tests/Switzerland/Schaffhausen/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schaffhausen; @@ -25,10 +25,12 @@ class GoodFridayTest extends SchaffhausenBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schaffhausen/NewYearsDayTest.php b/tests/Switzerland/Schaffhausen/NewYearsDayTest.php index 54b8802e3..53e0e0175 100644 --- a/tests/Switzerland/Schaffhausen/NewYearsDayTest.php +++ b/tests/Switzerland/Schaffhausen/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schaffhausen; @@ -24,7 +24,7 @@ class NewYearsDayTest extends SchaffhausenBaseTestCase implements YasumiTestCase /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends SchaffhausenBaseTestCase implements YasumiTestCase * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Schaffhausen/PentecostMondayTest.php b/tests/Switzerland/Schaffhausen/PentecostMondayTest.php index abe3d56df..afb8d2a81 100644 --- a/tests/Switzerland/Schaffhausen/PentecostMondayTest.php +++ b/tests/Switzerland/Schaffhausen/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schaffhausen; @@ -25,10 +25,12 @@ class PentecostMondayTest extends SchaffhausenBaseTestCase implements YasumiTest /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schaffhausen/SchaffhausenBaseTestCase.php b/tests/Switzerland/Schaffhausen/SchaffhausenBaseTestCase.php index 65cdcc114..926b0f635 100644 --- a/tests/Switzerland/Schaffhausen/SchaffhausenBaseTestCase.php +++ b/tests/Switzerland/Schaffhausen/SchaffhausenBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schaffhausen; @@ -25,15 +25,15 @@ abstract class SchaffhausenBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Schaffhausen'; + public const REGION = 'Switzerland/Schaffhausen'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Schaffhausen/SchaffhausenTest.php b/tests/Switzerland/Schaffhausen/SchaffhausenTest.php index 644d95df7..42a8f7f81 100644 --- a/tests/Switzerland/Schaffhausen/SchaffhausenTest.php +++ b/tests/Switzerland/Schaffhausen/SchaffhausenTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schaffhausen; @@ -26,8 +26,9 @@ class SchaffhausenTest extends SchaffhausenBaseTestCase /** * Tests if all official holidays in Schaffhausen (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Schaffhausen (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -56,8 +58,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Schaffhausen (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -69,24 +72,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Schaffhausen (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Schaffhausen (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Schaffhausen (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schaffhausen/StStephensDayTest.php b/tests/Switzerland/Schaffhausen/StStephensDayTest.php index 01e478850..92154dd17 100644 --- a/tests/Switzerland/Schaffhausen/StStephensDayTest.php +++ b/tests/Switzerland/Schaffhausen/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schaffhausen; @@ -24,7 +24,7 @@ class StStephensDayTest extends SchaffhausenBaseTestCase implements YasumiTestCa /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends SchaffhausenBaseTestCase implements YasumiTestCa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schaffhausen/WorkersDayTest.php b/tests/Switzerland/Schaffhausen/WorkersDayTest.php index 0e863c8fe..7077f3246 100644 --- a/tests/Switzerland/Schaffhausen/WorkersDayTest.php +++ b/tests/Switzerland/Schaffhausen/WorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schaffhausen; @@ -25,7 +25,7 @@ class WorkersDayTest extends SchaffhausenBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -34,6 +34,9 @@ class WorkersDayTest extends SchaffhausenBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -45,8 +48,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -61,8 +65,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +79,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schwyz/AllSaintsDayTest.php b/tests/Switzerland/Schwyz/AllSaintsDayTest.php index 600a80cc3..7a138abf2 100644 --- a/tests/Switzerland/Schwyz/AllSaintsDayTest.php +++ b/tests/Switzerland/Schwyz/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends SchwyzBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends SchwyzBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAllSaintsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testAllSaintsDay($year, $expected) /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Schwyz/AscensionDayTest.php b/tests/Switzerland/Schwyz/AscensionDayTest.php index a51444efa..e8d7e0ddd 100644 --- a/tests/Switzerland/Schwyz/AscensionDayTest.php +++ b/tests/Switzerland/Schwyz/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -25,10 +25,12 @@ class AscensionDayTest extends SchwyzBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schwyz/AssumptionOfMaryTest.php b/tests/Switzerland/Schwyz/AssumptionOfMaryTest.php index e8c5df022..71e59624a 100644 --- a/tests/Switzerland/Schwyz/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Schwyz/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends SchwyzBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the day of the Assumption of Mary. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends SchwyzBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAssumptionOfMary($year, $expected) { @@ -41,8 +43,9 @@ public function testAssumptionOfMary($year, $expected) /** * Tests translated name of the day of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the day of the Assumption of Mary. * * @return array list of test dates for the day of the Assumption of Mary + * @throws \Exception */ - public function AssumptionOfMaryDataProvider() + public function AssumptionOfMaryDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } diff --git a/tests/Switzerland/Schwyz/ChristmasDayTest.php b/tests/Switzerland/Schwyz/ChristmasDayTest.php index a8f11e4e2..ea2376d53 100644 --- a/tests/Switzerland/Schwyz/ChristmasDayTest.php +++ b/tests/Switzerland/Schwyz/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -24,7 +24,7 @@ class ChristmasDayTest extends SchwyzBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends SchwyzBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schwyz/CorpusChristiTest.php b/tests/Switzerland/Schwyz/CorpusChristiTest.php index 550cb771e..fe2c4a605 100644 --- a/tests/Switzerland/Schwyz/CorpusChristiTest.php +++ b/tests/Switzerland/Schwyz/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -27,10 +27,13 @@ class CorpusChristiTest extends SchwyzBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schwyz/EasterMondayTest.php b/tests/Switzerland/Schwyz/EasterMondayTest.php index e65204f22..822d78ed9 100644 --- a/tests/Switzerland/Schwyz/EasterMondayTest.php +++ b/tests/Switzerland/Schwyz/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -25,10 +25,12 @@ class EasterMondayTest extends SchwyzBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schwyz/EpiphanyTest.php b/tests/Switzerland/Schwyz/EpiphanyTest.php index 068fc4c88..2914041a9 100644 --- a/tests/Switzerland/Schwyz/EpiphanyTest.php +++ b/tests/Switzerland/Schwyz/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -24,7 +24,7 @@ class EpiphanyTest extends SchwyzBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** @@ -34,6 +34,8 @@ class EpiphanyTest extends SchwyzBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -44,16 +46,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -65,8 +69,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schwyz/GoodFridayTest.php b/tests/Switzerland/Schwyz/GoodFridayTest.php index 0b2d99d78..811136021 100644 --- a/tests/Switzerland/Schwyz/GoodFridayTest.php +++ b/tests/Switzerland/Schwyz/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -25,10 +25,12 @@ class GoodFridayTest extends SchwyzBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schwyz/ImmaculateConceptionTest.php b/tests/Switzerland/Schwyz/ImmaculateConceptionTest.php index 16d18ea64..cd9e40bfb 100644 --- a/tests/Switzerland/Schwyz/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Schwyz/ImmaculateConceptionTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -24,7 +24,7 @@ class ImmaculateConceptionTest extends SchwyzBaseTestCase implements YasumiTestC /** * The name of the holiday to be tested */ - const HOLIDAY = 'immaculateConception'; + public const HOLIDAY = 'immaculateConception'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ImmaculateConceptionTest extends SchwyzBaseTestCase implements YasumiTestC * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schwyz/NewYearsDayTest.php b/tests/Switzerland/Schwyz/NewYearsDayTest.php index 776d04374..aeb1675c1 100644 --- a/tests/Switzerland/Schwyz/NewYearsDayTest.php +++ b/tests/Switzerland/Schwyz/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -24,7 +24,7 @@ class NewYearsDayTest extends SchwyzBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends SchwyzBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Schwyz/PentecostMondayTest.php b/tests/Switzerland/Schwyz/PentecostMondayTest.php index c108ae535..74fed62cd 100644 --- a/tests/Switzerland/Schwyz/PentecostMondayTest.php +++ b/tests/Switzerland/Schwyz/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -25,10 +25,12 @@ class PentecostMondayTest extends SchwyzBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schwyz/SchwyzBaseTestCase.php b/tests/Switzerland/Schwyz/SchwyzBaseTestCase.php index 4812a7350..40db43417 100644 --- a/tests/Switzerland/Schwyz/SchwyzBaseTestCase.php +++ b/tests/Switzerland/Schwyz/SchwyzBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -25,15 +25,15 @@ abstract class SchwyzBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Schwyz'; + public const REGION = 'Switzerland/Schwyz'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Schwyz/SchwyzTest.php b/tests/Switzerland/Schwyz/SchwyzTest.php index ed0322d7d..5e533ea18 100644 --- a/tests/Switzerland/Schwyz/SchwyzTest.php +++ b/tests/Switzerland/Schwyz/SchwyzTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -26,8 +26,9 @@ class SchwyzTest extends SchwyzBaseTestCase /** * Tests if all official holidays in Schwyz (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Schwyz (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'epiphany', @@ -60,8 +62,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Schwyz (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -73,24 +76,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Schwyz (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Schwyz (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Schwyz (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schwyz/StJosephDayTest.php b/tests/Switzerland/Schwyz/StJosephDayTest.php index 6d4971164..fa70f9eec 100644 --- a/tests/Switzerland/Schwyz/StJosephDayTest.php +++ b/tests/Switzerland/Schwyz/StJosephDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -26,7 +26,7 @@ class StJosephDayTest extends SchwyzBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'stJosephsDay'; + public const HOLIDAY = 'stJosephsDay'; /** * Tests St. Joseph's Day. @@ -35,6 +35,8 @@ class StJosephDayTest extends SchwyzBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which St. Joseph's Day needs to be tested * @param \DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testStJosephDay($year, $expected) { @@ -45,16 +47,18 @@ public function testStJosephDay($year, $expected) * Returns a list of random test dates used for assertion of St. Joseph's Day. * * @return array list of test dates for St. Joseph's Day + * @throws \Exception */ - public function StJosephDayDataProvider() + public function StJosephDayDataProvider(): array { return $this->generateRandomDates(3, 19, self::TIMEZONE); } /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -66,8 +70,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Schwyz/StStephensDayTest.php b/tests/Switzerland/Schwyz/StStephensDayTest.php index 3f21a3683..00d31bf8b 100644 --- a/tests/Switzerland/Schwyz/StStephensDayTest.php +++ b/tests/Switzerland/Schwyz/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Schwyz; @@ -24,7 +24,7 @@ class StStephensDayTest extends SchwyzBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends SchwyzBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Solothurn/AscensionDayTest.php b/tests/Switzerland/Solothurn/AscensionDayTest.php index bab1c37af..c033ee5d2 100644 --- a/tests/Switzerland/Solothurn/AscensionDayTest.php +++ b/tests/Switzerland/Solothurn/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Solothurn; @@ -25,10 +25,12 @@ class AscensionDayTest extends SolothurnBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Solothurn/BerchtoldsTagTest.php b/tests/Switzerland/Solothurn/BerchtoldsTagTest.php index a795653ac..044b53232 100644 --- a/tests/Switzerland/Solothurn/BerchtoldsTagTest.php +++ b/tests/Switzerland/Solothurn/BerchtoldsTagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Solothurn; @@ -25,10 +25,13 @@ class BerchtoldsTagTest extends SolothurnBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'berchtoldsTag'; + public const HOLIDAY = 'berchtoldsTag'; /** * Tests BerchtoldsTag + * + * @throws \ReflectionException + * @throws \Exception */ public function testBerchtoldsTag() { @@ -41,8 +44,9 @@ public function testBerchtoldsTag() /** * Tests translated name of BerchtoldsTag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +58,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Solothurn/ChristmasDayTest.php b/tests/Switzerland/Solothurn/ChristmasDayTest.php index b4b0b4b31..6d74b17c7 100644 --- a/tests/Switzerland/Solothurn/ChristmasDayTest.php +++ b/tests/Switzerland/Solothurn/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Solothurn; @@ -24,7 +24,7 @@ class ChristmasDayTest extends SolothurnBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends SolothurnBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Solothurn/GoodFridayTest.php b/tests/Switzerland/Solothurn/GoodFridayTest.php index f49cb4d7e..7c9888014 100644 --- a/tests/Switzerland/Solothurn/GoodFridayTest.php +++ b/tests/Switzerland/Solothurn/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Solothurn; @@ -25,10 +25,12 @@ class GoodFridayTest extends SolothurnBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Solothurn/NewYearsDayTest.php b/tests/Switzerland/Solothurn/NewYearsDayTest.php index 35d9cf2d3..475ba6535 100644 --- a/tests/Switzerland/Solothurn/NewYearsDayTest.php +++ b/tests/Switzerland/Solothurn/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Solothurn; @@ -24,7 +24,7 @@ class NewYearsDayTest extends SolothurnBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends SolothurnBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Solothurn/SolothurnBaseTestCase.php b/tests/Switzerland/Solothurn/SolothurnBaseTestCase.php index c1b707492..3344ad6d2 100644 --- a/tests/Switzerland/Solothurn/SolothurnBaseTestCase.php +++ b/tests/Switzerland/Solothurn/SolothurnBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Solothurn; @@ -25,15 +25,15 @@ abstract class SolothurnBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Solothurn'; + public const REGION = 'Switzerland/Solothurn'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Solothurn/SolothurnTest.php b/tests/Switzerland/Solothurn/SolothurnTest.php index ae92fb5a4..0cd0d5bdc 100644 --- a/tests/Switzerland/Solothurn/SolothurnTest.php +++ b/tests/Switzerland/Solothurn/SolothurnTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Solothurn; @@ -26,8 +26,9 @@ class SolothurnTest extends SolothurnBaseTestCase /** * Tests if all official holidays in Solothurn (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -39,8 +40,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Solothurn (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -53,8 +55,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Solothurn (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -66,24 +69,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Solothurn (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Solothurn (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Solothurn (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/StGallen/AllSaintsDayTest.php b/tests/Switzerland/StGallen/AllSaintsDayTest.php index bdb0a4fda..c304112f4 100644 --- a/tests/Switzerland/StGallen/AllSaintsDayTest.php +++ b/tests/Switzerland/StGallen/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\StGallen; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends StGallenBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends StGallenBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAllSaintsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testAllSaintsDay($year, $expected) /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/StGallen/AscensionDayTest.php b/tests/Switzerland/StGallen/AscensionDayTest.php index 448bfdf42..f90458006 100644 --- a/tests/Switzerland/StGallen/AscensionDayTest.php +++ b/tests/Switzerland/StGallen/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\StGallen; @@ -25,10 +25,12 @@ class AscensionDayTest extends StGallenBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/StGallen/ChristmasDayTest.php b/tests/Switzerland/StGallen/ChristmasDayTest.php index db34b531e..dcca16403 100644 --- a/tests/Switzerland/StGallen/ChristmasDayTest.php +++ b/tests/Switzerland/StGallen/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\StGallen; @@ -24,7 +24,7 @@ class ChristmasDayTest extends StGallenBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends StGallenBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/StGallen/EasterMondayTest.php b/tests/Switzerland/StGallen/EasterMondayTest.php index ab63f7b5c..2ca19955f 100644 --- a/tests/Switzerland/StGallen/EasterMondayTest.php +++ b/tests/Switzerland/StGallen/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\StGallen; @@ -25,10 +25,12 @@ class EasterMondayTest extends StGallenBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/StGallen/GoodFridayTest.php b/tests/Switzerland/StGallen/GoodFridayTest.php index c7232f868..67c621105 100644 --- a/tests/Switzerland/StGallen/GoodFridayTest.php +++ b/tests/Switzerland/StGallen/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\StGallen; @@ -25,10 +25,12 @@ class GoodFridayTest extends StGallenBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/StGallen/NewYearsDayTest.php b/tests/Switzerland/StGallen/NewYearsDayTest.php index fbbe17a92..fee4f1e5d 100644 --- a/tests/Switzerland/StGallen/NewYearsDayTest.php +++ b/tests/Switzerland/StGallen/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\StGallen; @@ -24,7 +24,7 @@ class NewYearsDayTest extends StGallenBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends StGallenBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/StGallen/PentecostMondayTest.php b/tests/Switzerland/StGallen/PentecostMondayTest.php index a8f40e1fd..54c694c06 100644 --- a/tests/Switzerland/StGallen/PentecostMondayTest.php +++ b/tests/Switzerland/StGallen/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\StGallen; @@ -25,10 +25,12 @@ class PentecostMondayTest extends StGallenBaseTestCase implements YasumiTestCase /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/StGallen/StGallenBaseTestCase.php b/tests/Switzerland/StGallen/StGallenBaseTestCase.php index 452b34cfe..771da1f81 100644 --- a/tests/Switzerland/StGallen/StGallenBaseTestCase.php +++ b/tests/Switzerland/StGallen/StGallenBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\StGallen; @@ -25,15 +25,15 @@ abstract class StGallenBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/StGallen'; + public const REGION = 'Switzerland/StGallen'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/StGallen/StGallenTest.php b/tests/Switzerland/StGallen/StGallenTest.php index 283b0edd9..bd15f6b47 100644 --- a/tests/Switzerland/StGallen/StGallenTest.php +++ b/tests/Switzerland/StGallen/StGallenTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\StGallen; @@ -26,8 +26,9 @@ class StGallenTest extends StGallenBaseTestCase /** * Tests if all official holidays in St. Gallen (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in St. Gallen (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -55,8 +57,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in St. Gallen (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -68,24 +71,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in St. Gallen (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in St. Gallen (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in St. Gallen (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/StGallen/StStephensDayTest.php b/tests/Switzerland/StGallen/StStephensDayTest.php index 55714a0f6..8471ab718 100644 --- a/tests/Switzerland/StGallen/StStephensDayTest.php +++ b/tests/Switzerland/StGallen/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\StGallen; @@ -24,7 +24,7 @@ class StStephensDayTest extends StGallenBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends StGallenBaseTestCase implements YasumiTestCaseIn * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/SwissNationalDayTest.php b/tests/Switzerland/SwissNationalDayTest.php index fc498fdbd..bb7882fdf 100644 --- a/tests/Switzerland/SwissNationalDayTest.php +++ b/tests/Switzerland/SwissNationalDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland; @@ -25,25 +25,27 @@ class SwissNationalDayTest extends SwitzerlandBaseTestCase implements YasumiTest /** * The name of the holiday */ - const HOLIDAY = 'swissNationalDay'; + public const HOLIDAY = 'swissNationalDay'; /** * The year in which the holiday was established as national holiday */ - const NATIONAL_ESTABLISHMENT_YEAR = 1994; + public const NATIONAL_ESTABLISHMENT_YEAR = 1994; /** * The year in which the holiday was first established */ - const FIRST_ESTABLISHMENT_YEAR = 1899; + public const FIRST_ESTABLISHMENT_YEAR = 1899; /** * The year in which the holiday was first observed */ - const FIRST_OBSERVANCE_YEAR = 1891; + public const FIRST_OBSERVANCE_YEAR = 1891; /** * Tests National Day on or after 1994. + * @throws \Exception + * @throws \ReflectionException */ public function testNationalDayOnAfter1994() { @@ -58,6 +60,9 @@ public function testNationalDayOnAfter1994() /** * Tests National Day on or after 1899 and before 1994. + * @throws \ReflectionException + * @throws \Exception + * @throws \ReflectionException */ public function testNationalDayOnAfter1899() { @@ -73,6 +78,9 @@ public function testNationalDayOnAfter1899() /** * Tests National Day on 1891 + * @throws \ReflectionException + * @throws \Exception + * @throws \ReflectionException */ public function testNationalDayOn1891() { @@ -88,6 +96,7 @@ public function testNationalDayOn1891() /** * Tests National Day before 1891. + * @throws \ReflectionException */ public function testNationalDayBefore1891() { @@ -100,6 +109,7 @@ public function testNationalDayBefore1891() /** * Tests National Day between 1891 and 1899. + * @throws \ReflectionException */ public function testNationalDayBetween1891And1899() { @@ -109,21 +119,23 @@ public function testNationalDayBetween1891And1899() /** * Tests translated name of National Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::FIRST_OBSERVANCE_YEAR), + $this->generateRandomYear(self::NATIONAL_ESTABLISHMENT_YEAR), [self::LOCALE => 'Bundesfeiertag'] ); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Switzerland/SwitzerlandBaseTestCase.php b/tests/Switzerland/SwitzerlandBaseTestCase.php index 20af82a40..4745c1476 100644 --- a/tests/Switzerland/SwitzerlandBaseTestCase.php +++ b/tests/Switzerland/SwitzerlandBaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the Switzerland holiday provider. */ -abstract class SwitzerlandBaseTestCase extends PHPUnit_Framework_TestCase +abstract class SwitzerlandBaseTestCase extends TestCase { use YasumiBase; /** * Country (name) to be tested */ - const REGION = 'Switzerland'; + public const REGION = 'Switzerland'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/SwitzerlandTest.php b/tests/Switzerland/SwitzerlandTest.php index 18f1c506a..f0528bd8a 100644 --- a/tests/Switzerland/SwitzerlandTest.php +++ b/tests/Switzerland/SwitzerlandTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland; @@ -26,8 +26,9 @@ class SwitzerlandTest extends SwitzerlandBaseTestCase /** * Tests if all official holidays in Switzerland are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Switzerland are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -51,24 +53,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Switzerland are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Switzerland are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Switzerland are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Thurgau/AscensionDayTest.php b/tests/Switzerland/Thurgau/AscensionDayTest.php index 1c0e257a1..94e86652e 100644 --- a/tests/Switzerland/Thurgau/AscensionDayTest.php +++ b/tests/Switzerland/Thurgau/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Thurgau; @@ -25,10 +25,12 @@ class AscensionDayTest extends ThurgauBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Thurgau/BerchtoldsTagTest.php b/tests/Switzerland/Thurgau/BerchtoldsTagTest.php index eabb11dfe..581961e22 100644 --- a/tests/Switzerland/Thurgau/BerchtoldsTagTest.php +++ b/tests/Switzerland/Thurgau/BerchtoldsTagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Thurgau; @@ -25,10 +25,13 @@ class BerchtoldsTagTest extends ThurgauBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday */ - const HOLIDAY = 'berchtoldsTag'; + public const HOLIDAY = 'berchtoldsTag'; /** * Tests BerchtoldsTag + * + * @throws \ReflectionException + * @throws \Exception */ public function testBerchtoldsTag() { @@ -41,8 +44,9 @@ public function testBerchtoldsTag() /** * Tests translated name of BerchtoldsTag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +58,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Thurgau/ChristmasDayTest.php b/tests/Switzerland/Thurgau/ChristmasDayTest.php index da21bc0d6..b795c814b 100644 --- a/tests/Switzerland/Thurgau/ChristmasDayTest.php +++ b/tests/Switzerland/Thurgau/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Thurgau; @@ -24,7 +24,7 @@ class ChristmasDayTest extends ThurgauBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends ThurgauBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Thurgau/EasterMondayTest.php b/tests/Switzerland/Thurgau/EasterMondayTest.php index b1c6e8956..c058d40f2 100644 --- a/tests/Switzerland/Thurgau/EasterMondayTest.php +++ b/tests/Switzerland/Thurgau/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Thurgau; @@ -25,10 +25,12 @@ class EasterMondayTest extends ThurgauBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Thurgau/GoodFridayTest.php b/tests/Switzerland/Thurgau/GoodFridayTest.php index 73d66f115..2df96c8e3 100644 --- a/tests/Switzerland/Thurgau/GoodFridayTest.php +++ b/tests/Switzerland/Thurgau/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Thurgau; @@ -25,10 +25,12 @@ class GoodFridayTest extends ThurgauBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Thurgau/NewYearsDayTest.php b/tests/Switzerland/Thurgau/NewYearsDayTest.php index 4694db491..aff521353 100644 --- a/tests/Switzerland/Thurgau/NewYearsDayTest.php +++ b/tests/Switzerland/Thurgau/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Thurgau; @@ -24,7 +24,7 @@ class NewYearsDayTest extends ThurgauBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends ThurgauBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Thurgau/PentecostMondayTest.php b/tests/Switzerland/Thurgau/PentecostMondayTest.php index 4c7eefb44..fb3344250 100644 --- a/tests/Switzerland/Thurgau/PentecostMondayTest.php +++ b/tests/Switzerland/Thurgau/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Thurgau; @@ -25,10 +25,12 @@ class PentecostMondayTest extends ThurgauBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Thurgau/StStephensDayTest.php b/tests/Switzerland/Thurgau/StStephensDayTest.php index d4dd82882..d67c193f5 100644 --- a/tests/Switzerland/Thurgau/StStephensDayTest.php +++ b/tests/Switzerland/Thurgau/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Thurgau; @@ -24,7 +24,7 @@ class StStephensDayTest extends ThurgauBaseTestCase implements YasumiTestCaseInt /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends ThurgauBaseTestCase implements YasumiTestCaseInt * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Thurgau/ThurgauBaseTestCase.php b/tests/Switzerland/Thurgau/ThurgauBaseTestCase.php index fe161e646..9cc8805ed 100644 --- a/tests/Switzerland/Thurgau/ThurgauBaseTestCase.php +++ b/tests/Switzerland/Thurgau/ThurgauBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Thurgau; @@ -25,15 +25,15 @@ abstract class ThurgauBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Thurgau'; + public const REGION = 'Switzerland/Thurgau'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Thurgau/ThurgauTest.php b/tests/Switzerland/Thurgau/ThurgauTest.php index 0f64d0e3b..3547ae651 100644 --- a/tests/Switzerland/Thurgau/ThurgauTest.php +++ b/tests/Switzerland/Thurgau/ThurgauTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Thurgau; @@ -26,8 +26,9 @@ class ThurgauTest extends ThurgauBaseTestCase /** * Tests if all official holidays in Thurgau (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Thurgau (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -56,8 +58,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Thurgau (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -69,24 +72,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Thurgau (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Thurgau (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Thurgau (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Thurgau/WorkersDayTest.php b/tests/Switzerland/Thurgau/WorkersDayTest.php index 666f74452..fb9203023 100644 --- a/tests/Switzerland/Thurgau/WorkersDayTest.php +++ b/tests/Switzerland/Thurgau/WorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Thurgau; @@ -25,7 +25,7 @@ class WorkersDayTest extends ThurgauBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -34,6 +34,9 @@ class WorkersDayTest extends ThurgauBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -45,8 +48,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -61,8 +65,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +79,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Ticino/AllSaintsDayTest.php b/tests/Switzerland/Ticino/AllSaintsDayTest.php index e1f9ec35e..4fcb01d7d 100644 --- a/tests/Switzerland/Ticino/AllSaintsDayTest.php +++ b/tests/Switzerland/Ticino/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends TicinoBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends TicinoBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAllSaintsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testAllSaintsDay($year, $expected) /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Ticino/AscensionDayTest.php b/tests/Switzerland/Ticino/AscensionDayTest.php index 46c0dfe94..c0e17b22a 100644 --- a/tests/Switzerland/Ticino/AscensionDayTest.php +++ b/tests/Switzerland/Ticino/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -25,10 +25,12 @@ class AscensionDayTest extends TicinoBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Ticino/AssumptionOfMaryTest.php b/tests/Switzerland/Ticino/AssumptionOfMaryTest.php index 75fd0959c..48d45d636 100644 --- a/tests/Switzerland/Ticino/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Ticino/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends TicinoBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the day of the Assumption of Mary. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends TicinoBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAssumptionOfMary($year, $expected) { @@ -41,8 +43,9 @@ public function testAssumptionOfMary($year, $expected) /** * Tests translated name of the day of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the day of the Assumption of Mary. * * @return array list of test dates for the day of the Assumption of Mary + * @throws \Exception */ - public function AssumptionOfMaryDataProvider() + public function AssumptionOfMaryDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } diff --git a/tests/Switzerland/Ticino/ChristmasDayTest.php b/tests/Switzerland/Ticino/ChristmasDayTest.php index 61890627e..23b1c82c1 100644 --- a/tests/Switzerland/Ticino/ChristmasDayTest.php +++ b/tests/Switzerland/Ticino/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -24,7 +24,7 @@ class ChristmasDayTest extends TicinoBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends TicinoBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Ticino/CorpusChristiTest.php b/tests/Switzerland/Ticino/CorpusChristiTest.php index 937be89e1..afc35e3c9 100644 --- a/tests/Switzerland/Ticino/CorpusChristiTest.php +++ b/tests/Switzerland/Ticino/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -27,10 +27,13 @@ class CorpusChristiTest extends TicinoBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Ticino/EasterMondayTest.php b/tests/Switzerland/Ticino/EasterMondayTest.php index 3443d90a1..fa65844a7 100644 --- a/tests/Switzerland/Ticino/EasterMondayTest.php +++ b/tests/Switzerland/Ticino/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -25,10 +25,12 @@ class EasterMondayTest extends TicinoBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Ticino/EpiphanyTest.php b/tests/Switzerland/Ticino/EpiphanyTest.php index b40b4525e..7e5493c69 100644 --- a/tests/Switzerland/Ticino/EpiphanyTest.php +++ b/tests/Switzerland/Ticino/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -24,7 +24,7 @@ class EpiphanyTest extends TicinoBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** @@ -34,6 +34,8 @@ class EpiphanyTest extends TicinoBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -44,16 +46,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -65,8 +69,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Ticino/ImmaculateConceptionTest.php b/tests/Switzerland/Ticino/ImmaculateConceptionTest.php index 2f1c98c5e..0147e3fac 100644 --- a/tests/Switzerland/Ticino/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Ticino/ImmaculateConceptionTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -24,7 +24,7 @@ class ImmaculateConceptionTest extends TicinoBaseTestCase implements YasumiTestC /** * The name of the holiday to be tested */ - const HOLIDAY = 'immaculateConception'; + public const HOLIDAY = 'immaculateConception'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ImmaculateConceptionTest extends TicinoBaseTestCase implements YasumiTestC * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Ticino/NewYearsDayTest.php b/tests/Switzerland/Ticino/NewYearsDayTest.php index 4878fcf4a..0af7ab9bb 100644 --- a/tests/Switzerland/Ticino/NewYearsDayTest.php +++ b/tests/Switzerland/Ticino/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -24,7 +24,7 @@ class NewYearsDayTest extends TicinoBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends TicinoBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Ticino/PentecostMondayTest.php b/tests/Switzerland/Ticino/PentecostMondayTest.php index 4f914ace1..cce3d2f9b 100644 --- a/tests/Switzerland/Ticino/PentecostMondayTest.php +++ b/tests/Switzerland/Ticino/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -25,10 +25,12 @@ class PentecostMondayTest extends TicinoBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Ticino/StJosephDayTest.php b/tests/Switzerland/Ticino/StJosephDayTest.php index 6df5de9c4..df9c545a5 100644 --- a/tests/Switzerland/Ticino/StJosephDayTest.php +++ b/tests/Switzerland/Ticino/StJosephDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -26,7 +26,7 @@ class StJosephDayTest extends TicinoBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'stJosephsDay'; + public const HOLIDAY = 'stJosephsDay'; /** * Tests St. Joseph's Day. @@ -35,6 +35,8 @@ class StJosephDayTest extends TicinoBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which St. Joseph's Day needs to be tested * @param \DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testStJosephDay($year, $expected) { @@ -45,16 +47,18 @@ public function testStJosephDay($year, $expected) * Returns a list of random test dates used for assertion of St. Joseph's Day. * * @return array list of test dates for St. Joseph's Day + * @throws \Exception */ - public function StJosephDayDataProvider() + public function StJosephDayDataProvider(): array { return $this->generateRandomDates(3, 19, self::TIMEZONE); } /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -66,8 +70,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Ticino/StPeterPaulTest.php b/tests/Switzerland/Ticino/StPeterPaulTest.php index d9d9804c3..0e2c04469 100644 --- a/tests/Switzerland/Ticino/StPeterPaulTest.php +++ b/tests/Switzerland/Ticino/StPeterPaulTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -24,7 +24,7 @@ class StPeterPaulTest extends TicinoBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'stPeterPaul'; + public const HOLIDAY = 'stPeterPaul'; /** * Tests Feast of Saints Peter and Paul. @@ -33,6 +33,8 @@ class StPeterPaulTest extends TicinoBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which Feast of Saints Peter and Paul needs to be tested * @param \DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testStPeterPaul($year, $expected) { @@ -43,16 +45,18 @@ public function testStPeterPaul($year, $expected) * Returns a list of random test dates used for assertion of Feast of Saints Peter and Paul. * * @return array list of test dates for Feast of Saints Peter and Paul + * @throws \Exception */ - public function StPeterPaulDataProvider() + public function StPeterPaulDataProvider(): array { return $this->generateRandomDates(6, 29, self::TIMEZONE); } /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Ticino/StStephensDayTest.php b/tests/Switzerland/Ticino/StStephensDayTest.php index b5b6ffb85..763766d60 100644 --- a/tests/Switzerland/Ticino/StStephensDayTest.php +++ b/tests/Switzerland/Ticino/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -24,7 +24,7 @@ class StStephensDayTest extends TicinoBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends TicinoBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Ticino/TicinoBaseTestCase.php b/tests/Switzerland/Ticino/TicinoBaseTestCase.php index 7a91e0297..8654e6642 100644 --- a/tests/Switzerland/Ticino/TicinoBaseTestCase.php +++ b/tests/Switzerland/Ticino/TicinoBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -25,15 +25,15 @@ abstract class TicinoBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Ticino'; + public const REGION = 'Switzerland/Ticino'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'it_CH'; + public const LOCALE = 'it_CH'; } diff --git a/tests/Switzerland/Ticino/TicinoTest.php b/tests/Switzerland/Ticino/TicinoTest.php index a8031207b..a38db9a5f 100644 --- a/tests/Switzerland/Ticino/TicinoTest.php +++ b/tests/Switzerland/Ticino/TicinoTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -26,8 +26,9 @@ class TicinoTest extends TicinoBaseTestCase /** * Tests if all official holidays in Ticino (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Ticino (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'corpusChristi', @@ -61,8 +63,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Ticino (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -74,24 +77,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Ticino (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Ticino (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Ticino (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Ticino/WorkersDayTest.php b/tests/Switzerland/Ticino/WorkersDayTest.php index 00ff76b8d..ad7b04c10 100644 --- a/tests/Switzerland/Ticino/WorkersDayTest.php +++ b/tests/Switzerland/Ticino/WorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Ticino; @@ -25,7 +25,7 @@ class WorkersDayTest extends TicinoBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -34,6 +34,9 @@ class WorkersDayTest extends TicinoBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -45,8 +48,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -61,8 +65,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +79,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Uri/AllSaintsDayTest.php b/tests/Switzerland/Uri/AllSaintsDayTest.php index 6e5b5ff49..1220e627a 100644 --- a/tests/Switzerland/Uri/AllSaintsDayTest.php +++ b/tests/Switzerland/Uri/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends UriBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends UriBaseTestCase implements YasumiTestCaseInterfac * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAllSaintsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testAllSaintsDay($year, $expected) /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Uri/AscensionDayTest.php b/tests/Switzerland/Uri/AscensionDayTest.php index 90abf33df..689711edc 100644 --- a/tests/Switzerland/Uri/AscensionDayTest.php +++ b/tests/Switzerland/Uri/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -25,10 +25,12 @@ class AscensionDayTest extends UriBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Uri/AssumptionOfMaryTest.php b/tests/Switzerland/Uri/AssumptionOfMaryTest.php index 0a01e4105..3e72fa663 100644 --- a/tests/Switzerland/Uri/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Uri/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends UriBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the day of the Assumption of Mary. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends UriBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAssumptionOfMary($year, $expected) { @@ -41,8 +43,9 @@ public function testAssumptionOfMary($year, $expected) /** * Tests translated name of the day of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the day of the Assumption of Mary. * * @return array list of test dates for the day of the Assumption of Mary + * @throws \Exception */ - public function AssumptionOfMaryDataProvider() + public function AssumptionOfMaryDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } diff --git a/tests/Switzerland/Uri/ChristmasDayTest.php b/tests/Switzerland/Uri/ChristmasDayTest.php index 7b759f437..43d3da16c 100644 --- a/tests/Switzerland/Uri/ChristmasDayTest.php +++ b/tests/Switzerland/Uri/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -24,7 +24,7 @@ class ChristmasDayTest extends UriBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends UriBaseTestCase implements YasumiTestCaseInterfac * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Uri/CorpusChristiTest.php b/tests/Switzerland/Uri/CorpusChristiTest.php index b9fe3335c..30a7f2e13 100644 --- a/tests/Switzerland/Uri/CorpusChristiTest.php +++ b/tests/Switzerland/Uri/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -27,10 +27,13 @@ class CorpusChristiTest extends UriBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Uri/EasterMondayTest.php b/tests/Switzerland/Uri/EasterMondayTest.php index ac3cc463a..d73d5595d 100644 --- a/tests/Switzerland/Uri/EasterMondayTest.php +++ b/tests/Switzerland/Uri/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -25,10 +25,12 @@ class EasterMondayTest extends UriBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Uri/EpiphanyTest.php b/tests/Switzerland/Uri/EpiphanyTest.php index c19a76a2b..3f6e1c4cb 100644 --- a/tests/Switzerland/Uri/EpiphanyTest.php +++ b/tests/Switzerland/Uri/EpiphanyTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -24,7 +24,7 @@ class EpiphanyTest extends UriBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'epiphany'; + public const HOLIDAY = 'epiphany'; /** @@ -34,6 +34,8 @@ class EpiphanyTest extends UriBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -44,16 +46,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 6, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -65,8 +69,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Uri/GoodFridayTest.php b/tests/Switzerland/Uri/GoodFridayTest.php index dd42e765a..482eefa0a 100644 --- a/tests/Switzerland/Uri/GoodFridayTest.php +++ b/tests/Switzerland/Uri/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -25,10 +25,12 @@ class GoodFridayTest extends UriBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Uri/ImmaculateConceptionTest.php b/tests/Switzerland/Uri/ImmaculateConceptionTest.php index 9a6e819a6..1245fe344 100644 --- a/tests/Switzerland/Uri/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Uri/ImmaculateConceptionTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -24,7 +24,7 @@ class ImmaculateConceptionTest extends UriBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'immaculateConception'; + public const HOLIDAY = 'immaculateConception'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ImmaculateConceptionTest extends UriBaseTestCase implements YasumiTestCase * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Uri/NewYearsDayTest.php b/tests/Switzerland/Uri/NewYearsDayTest.php index e0a08f79d..96b3a51b6 100644 --- a/tests/Switzerland/Uri/NewYearsDayTest.php +++ b/tests/Switzerland/Uri/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -24,7 +24,7 @@ class NewYearsDayTest extends UriBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends UriBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Uri/PentecostMondayTest.php b/tests/Switzerland/Uri/PentecostMondayTest.php index 73470d63f..2c6cb4526 100644 --- a/tests/Switzerland/Uri/PentecostMondayTest.php +++ b/tests/Switzerland/Uri/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -25,10 +25,12 @@ class PentecostMondayTest extends UriBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Uri/StJosephDayTest.php b/tests/Switzerland/Uri/StJosephDayTest.php index 9cdf752ed..51b907e06 100644 --- a/tests/Switzerland/Uri/StJosephDayTest.php +++ b/tests/Switzerland/Uri/StJosephDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -26,7 +26,7 @@ class StJosephDayTest extends UriBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'stJosephsDay'; + public const HOLIDAY = 'stJosephsDay'; /** * Tests St. Joseph's Day. @@ -35,6 +35,8 @@ class StJosephDayTest extends UriBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which St. Joseph's Day needs to be tested * @param \DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testStJosephDay($year, $expected) { @@ -45,16 +47,18 @@ public function testStJosephDay($year, $expected) * Returns a list of random test dates used for assertion of St. Joseph's Day. * * @return array list of test dates for St. Joseph's Day + * @throws \Exception */ - public function StJosephDayDataProvider() + public function StJosephDayDataProvider(): array { return $this->generateRandomDates(3, 19, self::TIMEZONE); } /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -66,8 +70,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Uri/StStephensDayTest.php b/tests/Switzerland/Uri/StStephensDayTest.php index fb1439e55..ca9559829 100644 --- a/tests/Switzerland/Uri/StStephensDayTest.php +++ b/tests/Switzerland/Uri/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -24,7 +24,7 @@ class StStephensDayTest extends UriBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends UriBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Uri/UriBaseTestCase.php b/tests/Switzerland/Uri/UriBaseTestCase.php index f9f1ee722..ed3c64434 100644 --- a/tests/Switzerland/Uri/UriBaseTestCase.php +++ b/tests/Switzerland/Uri/UriBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -25,15 +25,15 @@ abstract class UriBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Uri'; + public const REGION = 'Switzerland/Uri'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Uri/UriTest.php b/tests/Switzerland/Uri/UriTest.php index b82c68662..0ac7d594c 100644 --- a/tests/Switzerland/Uri/UriTest.php +++ b/tests/Switzerland/Uri/UriTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Uri; @@ -26,8 +26,9 @@ class UriTest extends UriBaseTestCase /** * Tests if all official holidays in Uri (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Uri (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -60,8 +62,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Uri (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -73,24 +76,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Uri (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Uri (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Uri (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Valais/AllSaintsDayTest.php b/tests/Switzerland/Valais/AllSaintsDayTest.php index 4e9ea129f..c6e869f56 100644 --- a/tests/Switzerland/Valais/AllSaintsDayTest.php +++ b/tests/Switzerland/Valais/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Valais; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends ValaisBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends ValaisBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAllSaintsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testAllSaintsDay($year, $expected) /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Valais/AscensionDayTest.php b/tests/Switzerland/Valais/AscensionDayTest.php index 353eb2949..68f8fdf65 100644 --- a/tests/Switzerland/Valais/AscensionDayTest.php +++ b/tests/Switzerland/Valais/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Valais; @@ -25,10 +25,12 @@ class AscensionDayTest extends ValaisBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Valais/AssumptionOfMaryTest.php b/tests/Switzerland/Valais/AssumptionOfMaryTest.php index da45e52d0..54bca2957 100644 --- a/tests/Switzerland/Valais/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Valais/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Valais; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends ValaisBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the day of the Assumption of Mary. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends ValaisBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAssumptionOfMary($year, $expected) { @@ -41,8 +43,9 @@ public function testAssumptionOfMary($year, $expected) /** * Tests translated name of the day of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the day of the Assumption of Mary. * * @return array list of test dates for the day of the Assumption of Mary + * @throws \Exception */ - public function AssumptionOfMaryDataProvider() + public function AssumptionOfMaryDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } diff --git a/tests/Switzerland/Valais/ChristmasDayTest.php b/tests/Switzerland/Valais/ChristmasDayTest.php index 01aa634ae..72d0a8891 100644 --- a/tests/Switzerland/Valais/ChristmasDayTest.php +++ b/tests/Switzerland/Valais/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Valais; @@ -24,7 +24,7 @@ class ChristmasDayTest extends ValaisBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends ValaisBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Valais/CorpusChristiTest.php b/tests/Switzerland/Valais/CorpusChristiTest.php index fca4287fc..7398c5c2c 100644 --- a/tests/Switzerland/Valais/CorpusChristiTest.php +++ b/tests/Switzerland/Valais/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Valais; @@ -27,10 +27,13 @@ class CorpusChristiTest extends ValaisBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Valais/ImmaculateConceptionTest.php b/tests/Switzerland/Valais/ImmaculateConceptionTest.php index 13f31f38a..924835a1f 100644 --- a/tests/Switzerland/Valais/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Valais/ImmaculateConceptionTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Valais; @@ -24,7 +24,7 @@ class ImmaculateConceptionTest extends ValaisBaseTestCase implements YasumiTestC /** * The name of the holiday to be tested */ - const HOLIDAY = 'immaculateConception'; + public const HOLIDAY = 'immaculateConception'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ImmaculateConceptionTest extends ValaisBaseTestCase implements YasumiTestC * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Valais/NewYearsDayTest.php b/tests/Switzerland/Valais/NewYearsDayTest.php index 87ecb6832..d104b7548 100644 --- a/tests/Switzerland/Valais/NewYearsDayTest.php +++ b/tests/Switzerland/Valais/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Valais; @@ -24,7 +24,7 @@ class NewYearsDayTest extends ValaisBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends ValaisBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Valais/StJosephDayTest.php b/tests/Switzerland/Valais/StJosephDayTest.php index 5d5eaca08..33054209f 100644 --- a/tests/Switzerland/Valais/StJosephDayTest.php +++ b/tests/Switzerland/Valais/StJosephDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Valais; @@ -26,7 +26,7 @@ class StJosephDayTest extends ValaisBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'stJosephsDay'; + public const HOLIDAY = 'stJosephsDay'; /** * Tests St. Joseph's Day. @@ -35,6 +35,8 @@ class StJosephDayTest extends ValaisBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which St. Joseph's Day needs to be tested * @param \DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testStJosephDay($year, $expected) { @@ -45,16 +47,18 @@ public function testStJosephDay($year, $expected) * Returns a list of random test dates used for assertion of St. Joseph's Day. * * @return array list of test dates for St. Joseph's Day + * @throws \Exception */ - public function StJosephDayDataProvider() + public function StJosephDayDataProvider(): array { return $this->generateRandomDates(3, 19, self::TIMEZONE); } /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -66,8 +70,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Valais/ValaisBaseTestCase.php b/tests/Switzerland/Valais/ValaisBaseTestCase.php index da2b7cc9c..311a77a50 100644 --- a/tests/Switzerland/Valais/ValaisBaseTestCase.php +++ b/tests/Switzerland/Valais/ValaisBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Valais; @@ -25,15 +25,15 @@ abstract class ValaisBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Valais'; + public const REGION = 'Switzerland/Valais'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'fr_CH'; + public const LOCALE = 'fr_CH'; } diff --git a/tests/Switzerland/Valais/ValaisTest.php b/tests/Switzerland/Valais/ValaisTest.php index 6c5c62646..f00e96384 100644 --- a/tests/Switzerland/Valais/ValaisTest.php +++ b/tests/Switzerland/Valais/ValaisTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Valais; @@ -26,8 +26,9 @@ class ValaisTest extends ValaisBaseTestCase /** * Tests if all official holidays in Valais (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Valais (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'ascensionDay', @@ -55,8 +57,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Valais (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -68,24 +71,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Valais (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Valais (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Valais (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Vaud/AscensionDayTest.php b/tests/Switzerland/Vaud/AscensionDayTest.php index a6afa672f..fac6c7579 100644 --- a/tests/Switzerland/Vaud/AscensionDayTest.php +++ b/tests/Switzerland/Vaud/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Vaud; @@ -25,10 +25,12 @@ class AscensionDayTest extends VaudBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Vaud/BerchtoldsTagTest.php b/tests/Switzerland/Vaud/BerchtoldsTagTest.php index f35bf7ce6..2829e06fb 100644 --- a/tests/Switzerland/Vaud/BerchtoldsTagTest.php +++ b/tests/Switzerland/Vaud/BerchtoldsTagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Vaud; @@ -25,10 +25,13 @@ class BerchtoldsTagTest extends VaudBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'berchtoldsTag'; + public const HOLIDAY = 'berchtoldsTag'; /** * Tests BerchtoldsTag + * + * @throws \ReflectionException + * @throws \Exception */ public function testBerchtoldsTag() { @@ -41,8 +44,9 @@ public function testBerchtoldsTag() /** * Tests translated name of BerchtoldsTag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +58,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Vaud/BettagsMontagTest.php b/tests/Switzerland/Vaud/BettagsMontagTest.php index 9bc59b2e5..8f2fe56c9 100644 --- a/tests/Switzerland/Vaud/BettagsMontagTest.php +++ b/tests/Switzerland/Vaud/BettagsMontagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Vaud; @@ -26,10 +26,13 @@ class BettagsMontagTest extends VaudBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'bettagsMontag'; + public const HOLIDAY = 'bettagsMontag'; /** * Tests Bettags Montag on or after 1832 + * @throws \ReflectionException + * + * @throws \Exception */ public function testBettagsMontagOnAfter1832() { @@ -45,6 +48,7 @@ public function testBettagsMontagOnAfter1832() /** * Tests Bettags Montag before 1832 + * @throws \ReflectionException */ public function testBettagsMontagBefore1832() { @@ -54,8 +58,9 @@ public function testBettagsMontagBefore1832() /** * Tests translated name of Bettags Montag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -67,8 +72,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1900), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Vaud/ChristmasDayTest.php b/tests/Switzerland/Vaud/ChristmasDayTest.php index 56cb83d6b..10d93f9d5 100644 --- a/tests/Switzerland/Vaud/ChristmasDayTest.php +++ b/tests/Switzerland/Vaud/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Vaud; @@ -24,7 +24,7 @@ class ChristmasDayTest extends VaudBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends VaudBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Vaud/EasterMondayTest.php b/tests/Switzerland/Vaud/EasterMondayTest.php index cde81b4bb..bd1f28727 100644 --- a/tests/Switzerland/Vaud/EasterMondayTest.php +++ b/tests/Switzerland/Vaud/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Vaud; @@ -25,10 +25,12 @@ class EasterMondayTest extends VaudBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Vaud/GoodFridayTest.php b/tests/Switzerland/Vaud/GoodFridayTest.php index 99c23df4a..32ee4122f 100644 --- a/tests/Switzerland/Vaud/GoodFridayTest.php +++ b/tests/Switzerland/Vaud/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Vaud; @@ -25,10 +25,12 @@ class GoodFridayTest extends VaudBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Vaud/NewYearsDayTest.php b/tests/Switzerland/Vaud/NewYearsDayTest.php index 236080223..09c87662a 100644 --- a/tests/Switzerland/Vaud/NewYearsDayTest.php +++ b/tests/Switzerland/Vaud/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Vaud; @@ -24,7 +24,7 @@ class NewYearsDayTest extends VaudBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends VaudBaseTestCase implements YasumiTestCaseInterfac * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Vaud/PentecostMondayTest.php b/tests/Switzerland/Vaud/PentecostMondayTest.php index 4aa10e751..75a62cd47 100644 --- a/tests/Switzerland/Vaud/PentecostMondayTest.php +++ b/tests/Switzerland/Vaud/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Vaud; @@ -25,10 +25,12 @@ class PentecostMondayTest extends VaudBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Vaud/VaudBaseTestCase.php b/tests/Switzerland/Vaud/VaudBaseTestCase.php index 7e4d90014..c592cadae 100644 --- a/tests/Switzerland/Vaud/VaudBaseTestCase.php +++ b/tests/Switzerland/Vaud/VaudBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Vaud; @@ -25,15 +25,15 @@ abstract class VaudBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Vaud'; + public const REGION = 'Switzerland/Vaud'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'fr_CH'; + public const LOCALE = 'fr_CH'; } diff --git a/tests/Switzerland/Vaud/VaudTest.php b/tests/Switzerland/Vaud/VaudTest.php index b21d780c7..107814d94 100644 --- a/tests/Switzerland/Vaud/VaudTest.php +++ b/tests/Switzerland/Vaud/VaudTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Vaud; @@ -26,8 +26,9 @@ class VaudTest extends VaudBaseTestCase /** * Tests if all official holidays in Vaud (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Vaud (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -55,8 +57,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Vaud (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -68,24 +71,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Vaud (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Vaud (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Vaud (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zug/AllSaintsDayTest.php b/tests/Switzerland/Zug/AllSaintsDayTest.php index 9ad5e6213..7a0e23ccc 100644 --- a/tests/Switzerland/Zug/AllSaintsDayTest.php +++ b/tests/Switzerland/Zug/AllSaintsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -24,7 +24,7 @@ class AllSaintsDayTest extends ZugBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'allSaintsDay'; + public const HOLIDAY = 'allSaintsDay'; /** * Tests All Saints' Day. @@ -33,6 +33,8 @@ class AllSaintsDayTest extends ZugBaseTestCase implements YasumiTestCaseInterfac * * @param int $year the year for which All Saints' Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAllSaintsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testAllSaintsDay($year, $expected) /** * Tests translated name of All Saints' Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of All Saints' Day. * * @return array list of test dates for All Saints' Day + * @throws \Exception */ - public function AllSaintsDayDataProvider() + public function AllSaintsDayDataProvider(): array { return $this->generateRandomDates(11, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Zug/AscensionDayTest.php b/tests/Switzerland/Zug/AscensionDayTest.php index 3f371e5af..e96c318a2 100644 --- a/tests/Switzerland/Zug/AscensionDayTest.php +++ b/tests/Switzerland/Zug/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -25,10 +25,12 @@ class AscensionDayTest extends ZugBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zug/AssumptionOfMaryTest.php b/tests/Switzerland/Zug/AssumptionOfMaryTest.php index 2d29fc8a5..695e01bd7 100644 --- a/tests/Switzerland/Zug/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Zug/AssumptionOfMaryTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -24,7 +24,7 @@ class AssumptionOfMaryTest extends ZugBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'assumptionOfMary'; + public const HOLIDAY = 'assumptionOfMary'; /** * Tests the day of the Assumption of Mary. @@ -33,6 +33,8 @@ class AssumptionOfMaryTest extends ZugBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testAssumptionOfMary($year, $expected) { @@ -41,8 +43,9 @@ public function testAssumptionOfMary($year, $expected) /** * Tests translated name of the day of the Assumption of Mary. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of the day of the Assumption of Mary. * * @return array list of test dates for the day of the Assumption of Mary + * @throws \Exception */ - public function AssumptionOfMaryDataProvider() + public function AssumptionOfMaryDataProvider(): array { return $this->generateRandomDates(8, 15, self::TIMEZONE); } diff --git a/tests/Switzerland/Zug/BerchtoldsTagTest.php b/tests/Switzerland/Zug/BerchtoldsTagTest.php index 6cd033218..ca915f1a9 100644 --- a/tests/Switzerland/Zug/BerchtoldsTagTest.php +++ b/tests/Switzerland/Zug/BerchtoldsTagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -25,10 +25,13 @@ class BerchtoldsTagTest extends ZugBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'berchtoldsTag'; + public const HOLIDAY = 'berchtoldsTag'; /** * Tests BerchtoldsTag + * + * @throws \ReflectionException + * @throws \Exception */ public function testBerchtoldsTag() { @@ -41,8 +44,9 @@ public function testBerchtoldsTag() /** * Tests translated name of BerchtoldsTag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +58,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zug/ChristmasDayTest.php b/tests/Switzerland/Zug/ChristmasDayTest.php index 2550d29cb..879ba97c2 100644 --- a/tests/Switzerland/Zug/ChristmasDayTest.php +++ b/tests/Switzerland/Zug/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -24,7 +24,7 @@ class ChristmasDayTest extends ZugBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends ZugBaseTestCase implements YasumiTestCaseInterfac * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zug/CorpusChristiTest.php b/tests/Switzerland/Zug/CorpusChristiTest.php index 79d802b54..17c9b3225 100644 --- a/tests/Switzerland/Zug/CorpusChristiTest.php +++ b/tests/Switzerland/Zug/CorpusChristiTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -27,10 +27,13 @@ class CorpusChristiTest extends ZugBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'corpusChristi'; + public const HOLIDAY = 'corpusChristi'; /** * Tests Corpus Christi. + * + * @throws \Exception + * @throws \ReflectionException */ public function testCorpusChristi() { @@ -45,8 +48,9 @@ public function testCorpusChristi() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -58,8 +62,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zug/EasterMondayTest.php b/tests/Switzerland/Zug/EasterMondayTest.php index 67cffb3d6..2075ddf28 100644 --- a/tests/Switzerland/Zug/EasterMondayTest.php +++ b/tests/Switzerland/Zug/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -25,10 +25,12 @@ class EasterMondayTest extends ZugBaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zug/GoodFridayTest.php b/tests/Switzerland/Zug/GoodFridayTest.php index c32e80482..435a46a3a 100644 --- a/tests/Switzerland/Zug/GoodFridayTest.php +++ b/tests/Switzerland/Zug/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -25,10 +25,12 @@ class GoodFridayTest extends ZugBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zug/ImmaculateConceptionTest.php b/tests/Switzerland/Zug/ImmaculateConceptionTest.php index b637d97a6..2e861114d 100644 --- a/tests/Switzerland/Zug/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Zug/ImmaculateConceptionTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -24,7 +24,7 @@ class ImmaculateConceptionTest extends ZugBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'immaculateConception'; + public const HOLIDAY = 'immaculateConception'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class ImmaculateConceptionTest extends ZugBaseTestCase implements YasumiTestCase * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test. * * @return array list of test dates for the day of the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zug/NewYearsDayTest.php b/tests/Switzerland/Zug/NewYearsDayTest.php index 1d0cc23ee..e248d0a4c 100644 --- a/tests/Switzerland/Zug/NewYearsDayTest.php +++ b/tests/Switzerland/Zug/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -24,7 +24,7 @@ class NewYearsDayTest extends ZugBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends ZugBaseTestCase implements YasumiTestCaseInterface * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Zug/PentecostMondayTest.php b/tests/Switzerland/Zug/PentecostMondayTest.php index 638d72dd6..a3e5051d8 100644 --- a/tests/Switzerland/Zug/PentecostMondayTest.php +++ b/tests/Switzerland/Zug/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -25,10 +25,12 @@ class PentecostMondayTest extends ZugBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zug/StStephensDayTest.php b/tests/Switzerland/Zug/StStephensDayTest.php index dc4c58f16..c6a349bfd 100644 --- a/tests/Switzerland/Zug/StStephensDayTest.php +++ b/tests/Switzerland/Zug/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -24,7 +24,7 @@ class StStephensDayTest extends ZugBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends ZugBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zug/ZugBaseTestCase.php b/tests/Switzerland/Zug/ZugBaseTestCase.php index 6eeb45654..57e56d572 100644 --- a/tests/Switzerland/Zug/ZugBaseTestCase.php +++ b/tests/Switzerland/Zug/ZugBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -25,15 +25,15 @@ abstract class ZugBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Zug'; + public const REGION = 'Switzerland/Zug'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Zug/ZugTest.php b/tests/Switzerland/Zug/ZugTest.php index c5ce2ceba..71888781a 100644 --- a/tests/Switzerland/Zug/ZugTest.php +++ b/tests/Switzerland/Zug/ZugTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zug; @@ -26,8 +26,9 @@ class ZugTest extends ZugBaseTestCase /** * Tests if all official holidays in Zug (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Zug (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -59,8 +61,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Zug (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -72,24 +75,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Zug (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Zug (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Zug (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zurich/AscensionDayTest.php b/tests/Switzerland/Zurich/AscensionDayTest.php index 0ba79b837..2f7de222b 100644 --- a/tests/Switzerland/Zurich/AscensionDayTest.php +++ b/tests/Switzerland/Zurich/AscensionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zurich; @@ -25,10 +25,12 @@ class AscensionDayTest extends ZurichBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'ascensionDay'; + public const HOLIDAY = 'ascensionDay'; /** * Tests Ascension Day. + * @throws \Exception + * @throws \ReflectionException */ public function testAscensionDay() { @@ -43,8 +45,9 @@ public function testAscensionDay() /** * Tests translated name of Ascension Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zurich/BerchtoldsTagTest.php b/tests/Switzerland/Zurich/BerchtoldsTagTest.php index 71fa726ba..bfa4f0986 100644 --- a/tests/Switzerland/Zurich/BerchtoldsTagTest.php +++ b/tests/Switzerland/Zurich/BerchtoldsTagTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zurich; @@ -25,10 +25,13 @@ class BerchtoldsTagTest extends ZurichBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'berchtoldsTag'; + public const HOLIDAY = 'berchtoldsTag'; /** * Tests BerchtoldsTag + * + * @throws \ReflectionException + * @throws \Exception */ public function testBerchtoldsTag() { @@ -41,8 +44,9 @@ public function testBerchtoldsTag() /** * Tests translated name of BerchtoldsTag. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +58,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zurich/ChristmasDayTest.php b/tests/Switzerland/Zurich/ChristmasDayTest.php index 6ff764edf..91d74048b 100644 --- a/tests/Switzerland/Zurich/ChristmasDayTest.php +++ b/tests/Switzerland/Zurich/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zurich; @@ -24,7 +24,7 @@ class ChristmasDayTest extends ZurichBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends ZurichBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of Christmas Day. * * @return array list of test dates for Christmas Day + * @throws \Exception */ - public function ChristmasDayDataProvider() + public function ChristmasDayDataProvider(): array { return $this->generateRandomDates(12, 25, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zurich/EasterMondayTest.php b/tests/Switzerland/Zurich/EasterMondayTest.php index 2a07c2dd7..f4d051047 100644 --- a/tests/Switzerland/Zurich/EasterMondayTest.php +++ b/tests/Switzerland/Zurich/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zurich; @@ -25,10 +25,12 @@ class EasterMondayTest extends ZurichBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testEasterMonday() { @@ -43,8 +45,9 @@ public function testEasterMonday() /** * Tests translated name of Easter Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zurich/GoodFridayTest.php b/tests/Switzerland/Zurich/GoodFridayTest.php index e624af42f..915467187 100644 --- a/tests/Switzerland/Zurich/GoodFridayTest.php +++ b/tests/Switzerland/Zurich/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zurich; @@ -25,10 +25,12 @@ class GoodFridayTest extends ZurichBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zurich/NewYearsDayTest.php b/tests/Switzerland/Zurich/NewYearsDayTest.php index 0f205d3f9..8fa6c83f1 100644 --- a/tests/Switzerland/Zurich/NewYearsDayTest.php +++ b/tests/Switzerland/Zurich/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zurich; @@ -24,7 +24,7 @@ class NewYearsDayTest extends ZurichBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. @@ -33,6 +33,8 @@ class NewYearsDayTest extends ZurichBaseTestCase implements YasumiTestCaseInterf * * @param int $year the year for which New Years Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testNewYearsDay($year, $expected) { @@ -41,8 +43,9 @@ public function testNewYearsDay($year, $expected) /** * Tests translated name of New Years Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of New Years Day. * * @return array list of test dates for New Years Day + * @throws \Exception */ - public function NewYearsDayDataProvider() + public function NewYearsDayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } diff --git a/tests/Switzerland/Zurich/PentecostMondayTest.php b/tests/Switzerland/Zurich/PentecostMondayTest.php index 41a917ca5..8dfbfaded 100644 --- a/tests/Switzerland/Zurich/PentecostMondayTest.php +++ b/tests/Switzerland/Zurich/PentecostMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zurich; @@ -25,10 +25,12 @@ class PentecostMondayTest extends ZurichBaseTestCase implements YasumiTestCaseIn /** * The name of the holiday */ - const HOLIDAY = 'pentecostMonday'; + public const HOLIDAY = 'pentecostMonday'; /** * Tests Pentecost Monday. + * @throws \Exception + * @throws \ReflectionException */ public function testPentecostMonday() { @@ -43,8 +45,9 @@ public function testPentecostMonday() /** * Tests translated name of Pentecost Monday. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zurich/StStephensDayTest.php b/tests/Switzerland/Zurich/StStephensDayTest.php index abd574205..a8806e6d4 100644 --- a/tests/Switzerland/Zurich/StStephensDayTest.php +++ b/tests/Switzerland/Zurich/StStephensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zurich; @@ -24,7 +24,7 @@ class StStephensDayTest extends ZurichBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday to be tested */ - const HOLIDAY = 'stStephensDay'; + public const HOLIDAY = 'stStephensDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class StStephensDayTest extends ZurichBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(12, 26, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zurich/WorkersDayTest.php b/tests/Switzerland/Zurich/WorkersDayTest.php index 218f329d6..716fbcc67 100644 --- a/tests/Switzerland/Zurich/WorkersDayTest.php +++ b/tests/Switzerland/Zurich/WorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zurich; @@ -25,7 +25,7 @@ class WorkersDayTest extends ZurichBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests the holiday defined in this test. @@ -34,6 +34,9 @@ class WorkersDayTest extends ZurichBaseTestCase implements YasumiTestCaseInterfa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -45,8 +48,9 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -61,8 +65,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -74,8 +79,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); } diff --git a/tests/Switzerland/Zurich/ZurichBaseTestCase.php b/tests/Switzerland/Zurich/ZurichBaseTestCase.php index d56f59ed1..4293533bf 100644 --- a/tests/Switzerland/Zurich/ZurichBaseTestCase.php +++ b/tests/Switzerland/Zurich/ZurichBaseTestCase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zurich; @@ -25,15 +25,15 @@ abstract class ZurichBaseTestCase extends SwitzerlandBaseTestCase /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Switzerland/Zurich'; + public const REGION = 'Switzerland/Zurich'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Zurich'; + public const TIMEZONE = 'Europe/Zurich'; /** * Locale that is considered common for this provider */ - const LOCALE = 'de_CH'; + public const LOCALE = 'de_CH'; } diff --git a/tests/Switzerland/Zurich/ZurichTest.php b/tests/Switzerland/Zurich/ZurichTest.php index 5f761cab8..77e890eed 100644 --- a/tests/Switzerland/Zurich/ZurichTest.php +++ b/tests/Switzerland/Zurich/ZurichTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Switzerland\Zurich; @@ -26,8 +26,9 @@ class ZurichTest extends ZurichBaseTestCase /** * Tests if all official holidays in Zurich (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $officialHolidays = []; if ($this->year >= 1994) { @@ -38,8 +39,9 @@ public function testOfficialHolidays() /** * Tests if all regional holidays in Zurich (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testRegionalHolidays() + public function testRegionalHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -56,8 +58,9 @@ public function testRegionalHolidays() /** * Tests if all observed holidays in Zurich (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $observedHolidays = []; if (($this->year >= 1899 && $this->year < 1994) || $this->year = 1891) { @@ -69,24 +72,27 @@ public function testObservedHolidays() /** * Tests if all seasonal holidays in Zurich (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Zurich (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Zurich (Switzerland) are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/USA/ChristmasDayTest.php b/tests/USA/ChristmasDayTest.php index 765acdf0b..b2bb5156e 100644 --- a/tests/USA/ChristmasDayTest.php +++ b/tests/USA/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\USA; @@ -25,10 +25,12 @@ class ChristmasDayTest extends USABaseTestCase implements YasumiTestCaseInterfac /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. Christmas Day is celebrated on December 25th. + * @throws \Exception + * @throws \ReflectionException */ public function testChristmasDay() { @@ -43,6 +45,8 @@ public function testChristmasDay() /** * Tests Christmas Day substituted on Monday (when Christmas Day falls on Sunday). + * @throws \Exception + * @throws \ReflectionException */ public function testChristmasDaySubstitutedMonday() { @@ -58,6 +62,8 @@ public function testChristmasDaySubstitutedMonday() /** * Tests Christmas Day substituted on Monday (when Christmas Day falls on Saturday). + * @throws \Exception + * @throws \ReflectionException */ public function testChristmasDaySubstitutedFriday() { @@ -73,8 +79,9 @@ public function testChristmasDaySubstitutedFriday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -86,8 +93,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/USA/ColumbusDayTest.php b/tests/USA/ColumbusDayTest.php index 15ba3a283..49c1d5cad 100644 --- a/tests/USA/ColumbusDayTest.php +++ b/tests/USA/ColumbusDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\USA; @@ -25,16 +25,18 @@ class ColumbusDayTest extends USABaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'columbusDay'; + public const HOLIDAY = 'columbusDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1937; + public const ESTABLISHMENT_YEAR = 1937; /** * Tests Columbus Day on or after 1970. Columbus Day was established in 1937 on October 12th, but has been fixed to * the second Monday in October since 1970. + * @throws \Exception + * @throws \ReflectionException */ public function testColumbusDayOnAfter1970() { @@ -50,6 +52,8 @@ public function testColumbusDayOnAfter1970() /** * Tests Columbus Day between 1937 and 1969. Columbus Day was established in 1937 on October 12th, but has been * fixed to the second Monday in October since 1970. + * @throws \Exception + * @throws \ReflectionException */ public function testColumbusBetween1937And1969() { @@ -65,6 +69,7 @@ public function testColumbusBetween1937And1969() /** * Tests Columbus Day before 1937. Columbus Day was established in 1937 on October 12th, but has been fixed to * the second Monday in October since 1970. + * @throws \ReflectionException */ public function testColumbusDayBefore1937() { @@ -77,8 +82,9 @@ public function testColumbusDayBefore1937() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -90,8 +96,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/USA/IndependenceDayTest.php b/tests/USA/IndependenceDayTest.php index 253945082..49aad2e0e 100644 --- a/tests/USA/IndependenceDayTest.php +++ b/tests/USA/IndependenceDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\USA; @@ -25,15 +25,17 @@ class IndependenceDayTest extends USABaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'independenceDay'; + public const HOLIDAY = 'independenceDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1776; + public const ESTABLISHMENT_YEAR = 1776; /** * Tests Independence Day on or after 1776. Independence Day is celebrated since 1776 on July 4th. + * @throws \Exception + * @throws \ReflectionException */ public function testIndependenceDayOnAfter1776() { @@ -48,6 +50,8 @@ public function testIndependenceDayOnAfter1776() /** * Tests Independence Day on or after 1776 when substituted on Monday (when Independence Day falls on Sunday) + * @throws \Exception + * @throws \ReflectionException */ public function testIndependenceDayOnAfter1776SubstitutedMonday() { @@ -62,6 +66,8 @@ public function testIndependenceDayOnAfter1776SubstitutedMonday() /** * Tests Independence Day on or after 1776 when substituted on Friday (when Independence Day falls on Saturday) + * @throws \Exception + * @throws \ReflectionException */ public function testIndependenceDayOnAfter1776SubstitutedFriday() { @@ -76,6 +82,7 @@ public function testIndependenceDayOnAfter1776SubstitutedFriday() /** * Tests Independence Day before 1776. Independence Day is celebrated since 1776 on July 4th. + * @throws \ReflectionException */ public function testIndependenceDayBefore1776() { @@ -88,8 +95,9 @@ public function testIndependenceDayBefore1776() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -101,8 +109,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/USA/LabourDayTest.php b/tests/USA/LabourDayTest.php index d6686f939..4d01322d9 100644 --- a/tests/USA/LabourDayTest.php +++ b/tests/USA/LabourDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\USA; @@ -25,15 +25,17 @@ class LabourDayTest extends USABaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'labourDay'; + public const HOLIDAY = 'labourDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1887; + public const ESTABLISHMENT_YEAR = 1887; /** * Tests Labour Day on or after 1887. Labour Day was established since 1887 on the first Monday of September. + * @throws \Exception + * @throws \ReflectionException */ public function testLabourDayOnAfter1887() { @@ -48,6 +50,7 @@ public function testLabourDayOnAfter1887() /** * Tests Labour Day before 1887. Labour Day was established since 1887 on the first Monday of September. + * @throws \ReflectionException */ public function testLabourDayBefore1887() { @@ -60,8 +63,9 @@ public function testLabourDayBefore1887() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/USA/MartinLutherKingDayTest.php b/tests/USA/MartinLutherKingDayTest.php index 370f56f79..6ad829a8c 100644 --- a/tests/USA/MartinLutherKingDayTest.php +++ b/tests/USA/MartinLutherKingDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\USA; @@ -25,16 +25,18 @@ class MartinLutherKingDayTest extends USABaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'martinLutherKingDay'; + public const HOLIDAY = 'martinLutherKingDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1986; + public const ESTABLISHMENT_YEAR = 1986; /** * Tests Dr. Martin Luther King Day on or after 1986. Dr. Martin Luther King Day was established since 1986 on the * third Monday of January. + * @throws \Exception + * @throws \ReflectionException */ public function testMartinLutherKingDayOnAfter1986() { @@ -50,6 +52,7 @@ public function testMartinLutherKingDayOnAfter1986() /** * Tests Dr. Martin Luther King Day before 1986. Dr. Martin Luther King Day was established since 1996 on the third * Monday of January. + * @throws \ReflectionException */ public function testMartinLutherKingDayBefore1986() { @@ -62,8 +65,9 @@ public function testMartinLutherKingDayBefore1986() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -75,8 +79,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/USA/MemorialDayTest.php b/tests/USA/MemorialDayTest.php index 08772ac2d..2a6b4cbe4 100644 --- a/tests/USA/MemorialDayTest.php +++ b/tests/USA/MemorialDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\USA; @@ -25,16 +25,18 @@ class MemorialDayTest extends USABaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'memorialDay'; + public const HOLIDAY = 'memorialDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1865; + public const ESTABLISHMENT_YEAR = 1865; /** * Tests Memorial Day on or after 1968. Memorial Day was established since 1865 on May 30 and was changed in 1968 * to the last Monday in May. + * @throws \Exception + * @throws \ReflectionException */ public function testMemorialDayOnAfter1968() { @@ -50,6 +52,8 @@ public function testMemorialDayOnAfter1968() /** * Tests Memorial Day between 1865 and 1967. Memorial Day was established since 1865 on May 30 and was changed in * 1968 to the last Monday in May. + * @throws \Exception + * @throws \ReflectionException */ public function testMemorialDayBetween1865And1967() { @@ -65,6 +69,7 @@ public function testMemorialDayBetween1865And1967() /** * Tests Memorial Day before 1865. Memorial Day was established since 1865 on May 30 and was changed in 1968 to the * last Monday in May. + * @throws \ReflectionException */ public function testMemorialDayBefore1865() { @@ -77,8 +82,9 @@ public function testMemorialDayBefore1865() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -90,8 +96,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/USA/NewYearsDayTest.php b/tests/USA/NewYearsDayTest.php index 39be47136..f89498420 100644 --- a/tests/USA/NewYearsDayTest.php +++ b/tests/USA/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\USA; @@ -25,10 +25,12 @@ class NewYearsDayTest extends USABaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests New Years Day. + * @throws \Exception + * @throws \ReflectionException */ public function testNewYearsDay() { @@ -43,6 +45,8 @@ public function testNewYearsDay() /** * Tests New Years Day when substituted on Monday (when New Years Day falls on Sunday). + * @throws \Exception + * @throws \ReflectionException */ public function testNewYearsDaySubstitutedMonday() { @@ -57,6 +61,8 @@ public function testNewYearsDaySubstitutedMonday() /** * Tests New Years Day when substituted on Friday (when New Years Day falls on Saturday). + * @throws \Exception + * @throws \ReflectionException */ public function testNewYearsDaySubstitutedFriday() { @@ -72,8 +78,9 @@ public function testNewYearsDaySubstitutedFriday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -85,8 +92,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/USA/ThanksgivingDayTest.php b/tests/USA/ThanksgivingDayTest.php index 1fdf30c28..20a0b34fd 100644 --- a/tests/USA/ThanksgivingDayTest.php +++ b/tests/USA/ThanksgivingDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\USA; @@ -25,16 +25,18 @@ class ThanksgivingDayTest extends USABaseTestCase implements YasumiTestCaseInter /** * The name of the holiday */ - const HOLIDAY = 'thanksgivingDay'; + public const HOLIDAY = 'thanksgivingDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1863; + public const ESTABLISHMENT_YEAR = 1863; /** * Tests Thanksgiving Day on or after 1863. Thanksgiving Day is celebrated since 1863 on the fourth Thursday * of November. + * @throws \Exception + * @throws \ReflectionException */ public function testThanksgivingDayOnAfter1863() { @@ -50,6 +52,7 @@ public function testThanksgivingDayOnAfter1863() /** * Tests Thanksgiving Day before 1863. ThanksgivingDay Day is celebrated since 1863 on the fourth Thursday * of November. + * @throws \ReflectionException */ public function testThanksgivingDayBefore1863() { @@ -62,8 +65,9 @@ public function testThanksgivingDayBefore1863() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -75,8 +79,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/USA/USABaseTestCase.php b/tests/USA/USABaseTestCase.php index d6763af18..16d435e94 100644 --- a/tests/USA/USABaseTestCase.php +++ b/tests/USA/USABaseTestCase.php @@ -2,38 +2,38 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\USA; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Class USABaseTestCase. */ -abstract class USABaseTestCase extends PHPUnit_Framework_TestCase +abstract class USABaseTestCase extends TestCase { use YasumiBase; /** * Country (name) to be tested */ - const REGION = 'USA'; + public const REGION = 'USA'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'America/New_York'; + public const TIMEZONE = 'America/New_York'; /** * Locale that is considered common for this provider */ - const LOCALE = 'en_US'; + public const LOCALE = 'en_US'; } diff --git a/tests/USA/USATest.php b/tests/USA/USATest.php index 9632c0d26..644451df2 100644 --- a/tests/USA/USATest.php +++ b/tests/USA/USATest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\USA; @@ -26,8 +26,9 @@ class USATest extends USABaseTestCase /** * Tests if all official holidays in the USA are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -45,32 +46,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in the USA are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in the USA are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in the USA are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in the USA are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/USA/VeteransDayTest.php b/tests/USA/VeteransDayTest.php index e6ef202d8..0f8dcac34 100644 --- a/tests/USA/VeteransDayTest.php +++ b/tests/USA/VeteransDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\USA; @@ -26,15 +26,17 @@ class VeteransDayTest extends USABaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday */ - const HOLIDAY = 'veteransDay'; + public const HOLIDAY = 'veteransDay'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1919; + public const ESTABLISHMENT_YEAR = 1919; /** * Tests Veterans Day on or after 1919. Veterans Day was established in 1919 on November 11. + * @throws \Exception + * @throws \ReflectionException */ public function testVeteransDayOnAfter1919() { @@ -49,6 +51,7 @@ public function testVeteransDayOnAfter1919() /** * Tests Veterans Day before 1919. Veterans Day was established in 1919 on November 11. + * @throws \ReflectionException */ public function testVeteransDayBefore1919() { @@ -61,6 +64,7 @@ public function testVeteransDayBefore1919() /** * Tests name of Veterans Day before 1954. Veterans Day was named 'Armistice Day' before 1954. + * @throws \ReflectionException */ public function testVeteransDayNameBefore1954() { @@ -73,6 +77,7 @@ public function testVeteransDayNameBefore1954() /** * Tests name of Veterans Day after 1954. Veterans Day was named 'Armistice Day' before 1954. + * @throws \ReflectionException */ public function testVeteransDayNameAfter1954() { @@ -85,8 +90,9 @@ public function testVeteransDayNameAfter1954() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -98,8 +104,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/USA/WashingtonsBirthdayTest.php b/tests/USA/WashingtonsBirthdayTest.php index 5a9036773..5ce977125 100644 --- a/tests/USA/WashingtonsBirthdayTest.php +++ b/tests/USA/WashingtonsBirthdayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\USA; @@ -25,16 +25,18 @@ class WashingtonsBirthdayTest extends USABaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'washingtonsBirthday'; + public const HOLIDAY = 'washingtonsBirthday'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1879; + public const ESTABLISHMENT_YEAR = 1879; /** * Tests Washington's Birthday on or after 1968. Washington's Birthday was established since 1879 on February 22 * and was changed in 1968 to the third Monday in February. + * @throws \Exception + * @throws \ReflectionException */ public function testWashingtonsBirthdayOnAfter1968() { @@ -50,6 +52,8 @@ public function testWashingtonsBirthdayOnAfter1968() /** * Tests Washington's Birthday between 1879 and 1967. Washington's Birthday was established since 1879 on February * 22 and was changed in 1968 to the third Monday in February. + * @throws \Exception + * @throws \ReflectionException */ public function testWashingtonsBirthdayBetween1879And1967() { @@ -65,6 +69,7 @@ public function testWashingtonsBirthdayBetween1879And1967() /** * Tests Washington's Birthday before 1879. Washington's Birthday was established since 1879 on February 22 and was * changed in 1968 to the third Monday in February. + * @throws \ReflectionException */ public function testWashingtonsBirthdayBefore1879() { @@ -77,8 +82,9 @@ public function testWashingtonsBirthdayBefore1879() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -90,8 +96,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/Ukraine/ChristmasDayTest.php b/tests/Ukraine/ChristmasDayTest.php index ec050151c..89bec1935 100644 --- a/tests/Ukraine/ChristmasDayTest.php +++ b/tests/Ukraine/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ukraine; @@ -24,7 +24,7 @@ class ChristmasDayTest extends UkraineBaseTestCase implements YasumiTestCaseInte /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests Christmas Day. @@ -33,6 +33,8 @@ class ChristmasDayTest extends UkraineBaseTestCase implements YasumiTestCaseInte * * @param int $year the year for which Christmas Day needs to be tested * @param DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testChristmasDay($year, $expected) { @@ -43,16 +45,18 @@ public function testChristmasDay($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 7, self::TIMEZONE); } /** * Tests translated name of Christmas Day. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Ukraine/ConstitutionDayTest.php b/tests/Ukraine/ConstitutionDayTest.php index b3d853cb4..abb929beb 100644 --- a/tests/Ukraine/ConstitutionDayTest.php +++ b/tests/Ukraine/ConstitutionDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ukraine; @@ -24,8 +24,12 @@ class ConstitutionDayTest extends UkraineBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'constitutionDay'; + public const HOLIDAY = 'constitutionDay'; + /** + * @throws \ReflectionException + * @throws \Exception + */ public function testHoliday() { $year = 2020; @@ -39,16 +43,18 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, 2020, [self::LOCALE => 'День Конституції']); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, 2020, Holiday::TYPE_OFFICIAL); } diff --git a/tests/Ukraine/DefenderOfUkraineDayTest.php b/tests/Ukraine/DefenderOfUkraineDayTest.php index f7ee36375..dc646e176 100644 --- a/tests/Ukraine/DefenderOfUkraineDayTest.php +++ b/tests/Ukraine/DefenderOfUkraineDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ukraine; @@ -24,8 +24,12 @@ class DefenderOfUkraineDayTest extends UkraineBaseTestCase implements YasumiTest /** * The name of the holiday to be tested */ - const HOLIDAY = 'defenderOfUkraineDay'; + public const HOLIDAY = 'defenderOfUkraineDay'; + /** + * @throws \ReflectionException + * @throws \Exception + */ public function testHoliday() { $year = 2020; @@ -39,8 +43,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -52,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, 2020, Holiday::TYPE_OFFICIAL); } diff --git a/tests/Ukraine/EasterTest.php b/tests/Ukraine/EasterTest.php index a7ad6575f..035011ce7 100644 --- a/tests/Ukraine/EasterTest.php +++ b/tests/Ukraine/EasterTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ukraine; @@ -26,10 +26,12 @@ class EasterTest extends UkraineBaseTestCase implements YasumiTestCaseInterface /** * The name of the holiday to be tested */ - const HOLIDAY = 'easter'; + public const HOLIDAY = 'easter'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -44,8 +46,9 @@ public function testHoliday() /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -57,8 +60,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Ukraine/IndependenceDayTest.php b/tests/Ukraine/IndependenceDayTest.php index e0ef482f3..f220e0773 100644 --- a/tests/Ukraine/IndependenceDayTest.php +++ b/tests/Ukraine/IndependenceDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ukraine; @@ -24,8 +24,12 @@ class IndependenceDayTest extends UkraineBaseTestCase implements YasumiTestCaseI /** * The name of the holiday to be tested */ - const HOLIDAY = 'independenceDay'; + public const HOLIDAY = 'independenceDay'; + /** + * @throws \ReflectionException + * @throws \Exception + */ public function testHoliday() { $year = 2020; @@ -39,16 +43,18 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, 2020, [self::LOCALE => 'День Незалежності']); } /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, 2020, Holiday::TYPE_OFFICIAL); } diff --git a/tests/Ukraine/InternationalWomensDayTest.php b/tests/Ukraine/InternationalWomensDayTest.php index 2aedc6fd1..82a551dc0 100644 --- a/tests/Ukraine/InternationalWomensDayTest.php +++ b/tests/Ukraine/InternationalWomensDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ukraine; @@ -24,13 +24,15 @@ class InternationalWomensDayTest extends UkraineBaseTestCase implements YasumiTe /** * The name of the holiday to be tested */ - const HOLIDAY = 'internationalWomensDay'; + public const HOLIDAY = 'internationalWomensDay'; /** * @dataProvider HolidayDataProvider * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -41,16 +43,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(3, 8, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Ukraine/InternationalWorkersDayTest.php b/tests/Ukraine/InternationalWorkersDayTest.php index 1e4d29a7c..8aa671ecc 100644 --- a/tests/Ukraine/InternationalWorkersDayTest.php +++ b/tests/Ukraine/InternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ukraine; @@ -24,7 +24,7 @@ class InternationalWorkersDayTest extends UkraineBaseTestCase implements YasumiT /** * The name of the holiday */ - const HOLIDAY = 'internationalWorkersDay'; + public const HOLIDAY = 'internationalWorkersDay'; /** * Tests International Workers' Day. @@ -33,6 +33,8 @@ class InternationalWorkersDayTest extends UkraineBaseTestCase implements YasumiT * * @param int $year the year for which International Workers' Day needs to be tested * @param \DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testInternationalWorkersDay($year, $expected) { @@ -41,8 +43,9 @@ public function testInternationalWorkersDay($year, $expected) /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of International Workers' Day. * * @return array list of test dates for International Workers' Day + * @throws \Exception */ - public function InternationalWorkersDayDataProvider() + public function InternationalWorkersDayDataProvider(): array { return $this->generateRandomDates(5, 1, self::TIMEZONE); } diff --git a/tests/Ukraine/NewYearsDayTest.php b/tests/Ukraine/NewYearsDayTest.php index 5c0ace0ce..3854db7b0 100644 --- a/tests/Ukraine/NewYearsDayTest.php +++ b/tests/Ukraine/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ukraine; @@ -24,7 +24,7 @@ class NewYearsDayTest extends UkraineBaseTestCase implements YasumiTestCaseInter /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test. @@ -33,6 +33,8 @@ class NewYearsDayTest extends UkraineBaseTestCase implements YasumiTestCaseInter * * @param int $year the year for which the holiday defined in this test needs to be tested * @param \DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -43,16 +45,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(1, 1, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -64,8 +68,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Ukraine/PentecostTest.php b/tests/Ukraine/PentecostTest.php index e32fdc4f3..790177b98 100644 --- a/tests/Ukraine/PentecostTest.php +++ b/tests/Ukraine/PentecostTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ukraine; @@ -26,10 +26,12 @@ class PentecostTest extends UkraineBaseTestCase implements YasumiTestCaseInterfa /** * The name of the holiday */ - const HOLIDAY = 'pentecost'; + public const HOLIDAY = 'pentecost'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -44,8 +46,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -57,8 +60,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/Ukraine/SecondInternationalWorkersDayTest.php b/tests/Ukraine/SecondInternationalWorkersDayTest.php index ae98ef952..a8ea256a7 100644 --- a/tests/Ukraine/SecondInternationalWorkersDayTest.php +++ b/tests/Ukraine/SecondInternationalWorkersDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ukraine; @@ -24,7 +24,7 @@ class SecondInternationalWorkersDayTest extends UkraineBaseTestCase implements Y /** * The name of the holiday */ - const HOLIDAY = 'secondInternationalWorkersDay'; + public const HOLIDAY = 'secondInternationalWorkersDay'; /** * Tests International Workers' Day. @@ -33,6 +33,8 @@ class SecondInternationalWorkersDayTest extends UkraineBaseTestCase implements Y * * @param int $year the year for which International Workers' Day needs to be tested * @param \DateTime $expected the expected date + * + * @throws \ReflectionException */ public function testSecondInternationalWorkersDay($year, $expected) { @@ -41,8 +43,9 @@ public function testSecondInternationalWorkersDay($year, $expected) /** * Tests translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -54,8 +57,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } @@ -64,8 +68,9 @@ public function testHolidayType() * Returns a list of random test dates used for assertion of International Workers' Day. * * @return array list of test dates for International Workers' Day + * @throws \Exception */ - public function SecondInternationalWorkersDayDataProvider() + public function SecondInternationalWorkersDayDataProvider(): array { return $this->generateRandomDates(5, 2, self::TIMEZONE); } diff --git a/tests/Ukraine/UkraineBaseTestCase.php b/tests/Ukraine/UkraineBaseTestCase.php index 2571ef3d0..88367c280 100644 --- a/tests/Ukraine/UkraineBaseTestCase.php +++ b/tests/Ukraine/UkraineBaseTestCase.php @@ -2,38 +2,39 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ukraine; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Class UkraineBaseTestCase * @package Yasumi\tests\Ukraine */ -class UkraineBaseTestCase extends \PHPUnit_Framework_TestCase +class UkraineBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'Ukraine'; + public const REGION = 'Ukraine'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/Kiev'; + public const TIMEZONE = 'Europe/Kiev'; /** * Locale that is considered common for this provider */ - const LOCALE = 'uk_UA'; + public const LOCALE = 'uk_UA'; } diff --git a/tests/Ukraine/UkraineTest.php b/tests/Ukraine/UkraineTest.php index 4f838f9e3..afc9bde7c 100644 --- a/tests/Ukraine/UkraineTest.php +++ b/tests/Ukraine/UkraineTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ukraine; @@ -27,8 +27,9 @@ class UkraineTest extends UkraineBaseTestCase /** * Tests if all official holidays in Ukraine are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -47,32 +48,36 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in Ukraine are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in Ukraine are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in Ukraine are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); } /** * Tests if all other holidays in Ukraine are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/Ukraine/VictoryDayTest.php b/tests/Ukraine/VictoryDayTest.php index 5a9d596f4..d08286646 100644 --- a/tests/Ukraine/VictoryDayTest.php +++ b/tests/Ukraine/VictoryDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\Ukraine; @@ -24,13 +24,15 @@ class VictoryDayTest extends UkraineBaseTestCase implements YasumiTestCaseInterf /** * The name of the holiday to be tested */ - const HOLIDAY = 'victoryDay'; + public const HOLIDAY = 'victoryDay'; /** * @dataProvider HolidayDataProvider * * @param int $year * @param \DateTime $expected + * + * @throws \ReflectionException */ public function testHoliday($year, $expected) { @@ -41,16 +43,18 @@ public function testHoliday($year, $expected) * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDates(5, 9, self::TIMEZONE); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -62,8 +66,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/UnitedKingdom/BoxingDayTest.php b/tests/UnitedKingdom/BoxingDayTest.php index fbbffdd33..f5b6f1924 100644 --- a/tests/UnitedKingdom/BoxingDayTest.php +++ b/tests/UnitedKingdom/BoxingDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\UnitedKingdom; @@ -26,7 +26,7 @@ class BoxingDayTest extends UnitedKingdomBaseTestCase implements YasumiTestCaseI /** * The name of the holiday */ - const HOLIDAY = 'secondChristmasDay'; + public const HOLIDAY = 'secondChristmasDay'; /** * Tests the holiday defined in this test. @@ -35,13 +35,16 @@ class BoxingDayTest extends UnitedKingdomBaseTestCase implements YasumiTestCaseI * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { $date = new DateTime($expected, new DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); - if (in_array((int)$date->format('w'), [0, 6], true)) { + if (\in_array((int)$date->format('w'), [0, 6], true)) { $date->add(new DateInterval('P2D')); $this->assertHoliday(self::REGION, 'substituteHoliday:' . self::HOLIDAY, $year, $date); $this->assertHolidayType(self::REGION, 'substituteHoliday:' . self::HOLIDAY, $year, Holiday::TYPE_BANK); @@ -52,8 +55,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -69,8 +73,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -82,8 +87,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); } diff --git a/tests/UnitedKingdom/ChristmasDayTest.php b/tests/UnitedKingdom/ChristmasDayTest.php index e344e247a..096cfc9b1 100644 --- a/tests/UnitedKingdom/ChristmasDayTest.php +++ b/tests/UnitedKingdom/ChristmasDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\UnitedKingdom; @@ -26,7 +26,7 @@ class ChristmasDayTest extends UnitedKingdomBaseTestCase implements YasumiTestCa /** * The name of the holiday */ - const HOLIDAY = 'christmasDay'; + public const HOLIDAY = 'christmasDay'; /** * Tests the holiday defined in this test. @@ -35,13 +35,16 @@ class ChristmasDayTest extends UnitedKingdomBaseTestCase implements YasumiTestCa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { $date = new DateTime($expected, new DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); - if (in_array((int)$date->format('w'), [0, 6], true)) { + if (\in_array((int)$date->format('w'), [0, 6], true)) { $date->add(new DateInterval('P2D')); $this->assertHoliday(self::REGION, 'substituteHoliday:' . self::HOLIDAY, $year, $date); $this->assertHolidayType(self::REGION, 'substituteHoliday:' . self::HOLIDAY, $year, Holiday::TYPE_BANK); @@ -52,8 +55,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -69,8 +73,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -82,8 +87,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/UnitedKingdom/EasterMondayTest.php b/tests/UnitedKingdom/EasterMondayTest.php index 9ab9d3e8d..565062311 100644 --- a/tests/UnitedKingdom/EasterMondayTest.php +++ b/tests/UnitedKingdom/EasterMondayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\UnitedKingdom; @@ -26,7 +26,7 @@ class EasterMondayTest extends UnitedKingdomBaseTestCase implements YasumiTestCa /** * The name of the holiday */ - const HOLIDAY = 'easterMonday'; + public const HOLIDAY = 'easterMonday'; /** * Tests Easter Monday @@ -35,6 +35,9 @@ class EasterMondayTest extends UnitedKingdomBaseTestCase implements YasumiTestCa * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHoliday($year, $expected) { @@ -50,8 +53,9 @@ public function testHoliday($year, $expected) * Returns a list of test dates * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { $data = []; @@ -68,8 +72,9 @@ public function HolidayDataProvider() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -81,8 +86,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); } diff --git a/tests/UnitedKingdom/GoodFridayTest.php b/tests/UnitedKingdom/GoodFridayTest.php index 01a347ac2..4f573581a 100644 --- a/tests/UnitedKingdom/GoodFridayTest.php +++ b/tests/UnitedKingdom/GoodFridayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\UnitedKingdom; @@ -25,10 +25,12 @@ class GoodFridayTest extends UnitedKingdomBaseTestCase implements YasumiTestCase /** * The name of the holiday to be tested */ - const HOLIDAY = 'goodFriday'; + public const HOLIDAY = 'goodFriday'; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -43,8 +45,9 @@ public function testHoliday() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -56,8 +59,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); } diff --git a/tests/UnitedKingdom/MayDayBankHolidayTest.php b/tests/UnitedKingdom/MayDayBankHolidayTest.php index d4fc7e9e4..757f1e713 100644 --- a/tests/UnitedKingdom/MayDayBankHolidayTest.php +++ b/tests/UnitedKingdom/MayDayBankHolidayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\UnitedKingdom; @@ -25,15 +25,17 @@ class MayDayBankHolidayTest extends UnitedKingdomBaseTestCase implements YasumiT /** * The name of the holiday */ - const HOLIDAY = 'mayDayBankHoliday'; + public const HOLIDAY = 'mayDayBankHoliday'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1978; + public const ESTABLISHMENT_YEAR = 1978; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -48,6 +50,7 @@ public function testHoliday() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/UnitedKingdom/NewYearsDayTest.php b/tests/UnitedKingdom/NewYearsDayTest.php index f476ca9be..725172893 100644 --- a/tests/UnitedKingdom/NewYearsDayTest.php +++ b/tests/UnitedKingdom/NewYearsDayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\UnitedKingdom; @@ -25,17 +25,17 @@ class NewYearsDayTest extends UnitedKingdomBaseTestCase implements YasumiTestCas /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1871; + public const ESTABLISHMENT_YEAR = 1871; /** * The year in which the holiday was adjusted */ - const ADJUSTMENT_YEAR = 1974; + public const ADJUSTMENT_YEAR = 1974; /** * The name of the holiday to be tested */ - const HOLIDAY = 'newYearsDay'; + public const HOLIDAY = 'newYearsDay'; /** * Tests the holiday defined in this test on or after establishment. @@ -44,6 +44,9 @@ class NewYearsDayTest extends UnitedKingdomBaseTestCase implements YasumiTestCas * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date + * + * @throws \ReflectionException + * @throws \Exception */ public function testHolidayOnAfterEstablishment($year, $expected) { @@ -57,6 +60,7 @@ public function testHolidayOnAfterEstablishment($year, $expected) /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -69,6 +73,7 @@ public function testHolidayBeforeEstablishment() /** * Tests that the holiday defined in this test is of the type 'observance' before the year it was changed. + * @throws \ReflectionException */ public function testHolidayIsObservedTypeBeforeChange() { @@ -84,16 +89,18 @@ public function testHolidayIsObservedTypeBeforeChange() * Returns a list of random test dates used for assertion of the holiday defined in this test * * @return array list of test dates for the holiday defined in this test + * @throws \Exception */ - public function HolidayDataProvider() + public function HolidayDataProvider(): array { return $this->generateRandomDatesWithHolidayMovedToMonday(01, 01, self::TIMEZONE, 10, self::ESTABLISHMENT_YEAR); } /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -105,8 +112,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/UnitedKingdom/SpringBankHolidayTest.php b/tests/UnitedKingdom/SpringBankHolidayTest.php index 6fa11cfaf..79c390e20 100644 --- a/tests/UnitedKingdom/SpringBankHolidayTest.php +++ b/tests/UnitedKingdom/SpringBankHolidayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\UnitedKingdom; @@ -25,15 +25,17 @@ class SpringBankHolidayTest extends UnitedKingdomBaseTestCase implements YasumiT /** * The name of the holiday */ - const HOLIDAY = 'springBankHoliday'; + public const HOLIDAY = 'springBankHoliday'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1965; + public const ESTABLISHMENT_YEAR = 1965; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -48,6 +50,7 @@ public function testHoliday() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/UnitedKingdom/SummerBankHolidayTest.php b/tests/UnitedKingdom/SummerBankHolidayTest.php index 9aecac8b5..ad0ee64f9 100644 --- a/tests/UnitedKingdom/SummerBankHolidayTest.php +++ b/tests/UnitedKingdom/SummerBankHolidayTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\UnitedKingdom; @@ -25,15 +25,17 @@ class SummerBankHolidayTest extends UnitedKingdomBaseTestCase implements YasumiT /** * The name of the holiday */ - const HOLIDAY = 'summerBankHoliday'; + public const HOLIDAY = 'summerBankHoliday'; /** * The year in which the holiday was first established */ - const ESTABLISHMENT_YEAR = 1965; + public const ESTABLISHMENT_YEAR = 1965; /** * Tests the holiday defined in this test. + * @throws \Exception + * @throws \ReflectionException */ public function testHoliday() { @@ -48,6 +50,7 @@ public function testHoliday() /** * Tests the holiday defined in this test before establishment. + * @throws \ReflectionException */ public function testHolidayBeforeEstablishment() { @@ -60,8 +63,9 @@ public function testHolidayBeforeEstablishment() /** * Tests the translated name of the holiday defined in this test. + * @throws \ReflectionException */ - public function testTranslation() + public function testTranslation(): void { $this->assertTranslatedHolidayName( self::REGION, @@ -73,8 +77,9 @@ public function testTranslation() /** * Tests type of the holiday defined in this test. + * @throws \ReflectionException */ - public function testHolidayType() + public function testHolidayType(): void { $this->assertHolidayType( self::REGION, diff --git a/tests/UnitedKingdom/UnitedKingdomBaseTestCase.php b/tests/UnitedKingdom/UnitedKingdomBaseTestCase.php index 4575a0235..4a8bdb472 100644 --- a/tests/UnitedKingdom/UnitedKingdomBaseTestCase.php +++ b/tests/UnitedKingdom/UnitedKingdomBaseTestCase.php @@ -2,43 +2,43 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\UnitedKingdom; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Yasumi\tests\YasumiBase; /** * Base class for test cases of the United Kingdom holiday provider. */ -abstract class UnitedKingdomBaseTestCase extends PHPUnit_Framework_TestCase +abstract class UnitedKingdomBaseTestCase extends TestCase { use YasumiBase; /** * Name of the region (e.g. country / state) to be tested */ - const REGION = 'UnitedKingdom'; + public const REGION = 'UnitedKingdom'; /** * Timezone in which this provider has holidays defined */ - const TIMEZONE = 'Europe/London'; + public const TIMEZONE = 'Europe/London'; /** * Locale that is considered common for this provider */ - const LOCALE = 'en_GB'; + public const LOCALE = 'en_GB'; /** * Number of iterations to be used for the various unit tests of this provider */ - const TEST_ITERATIONS = 50; + public const TEST_ITERATIONS = 50; } diff --git a/tests/UnitedKingdom/UnitedKingdomTest.php b/tests/UnitedKingdom/UnitedKingdomTest.php index 70adf0f71..67834127b 100644 --- a/tests/UnitedKingdom/UnitedKingdomTest.php +++ b/tests/UnitedKingdom/UnitedKingdomTest.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests\UnitedKingdom; @@ -26,8 +26,9 @@ class UnitedKingdomTest extends UnitedKingdomBaseTestCase /** * Tests if all official holidays in the United Kingdom are defined by the provider class + * @throws \ReflectionException */ - public function testOfficialHolidays() + public function testOfficialHolidays(): void { $this->assertDefinedHolidays([ 'goodFriday', @@ -37,24 +38,27 @@ public function testOfficialHolidays() /** * Tests if all observed holidays in the United Kingdom are defined by the provider class + * @throws \ReflectionException */ - public function testObservedHolidays() + public function testObservedHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); } /** * Tests if all seasonal holidays in the United Kingdom are defined by the provider class + * @throws \ReflectionException */ - public function testSeasonalHolidays() + public function testSeasonalHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); } /** * Tests if all bank holidays in the United Kingdom are defined by the provider class + * @throws \ReflectionException */ - public function testBankHolidays() + public function testBankHolidays(): void { $this->assertDefinedHolidays([ 'newYearsDay', @@ -67,8 +71,9 @@ public function testBankHolidays() /** * Tests if all other holidays in the United Kingdom are defined by the provider class + * @throws \ReflectionException */ - public function testOtherHolidays() + public function testOtherHolidays(): void { $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); } diff --git a/tests/YasumiBase.php b/tests/YasumiBase.php index ae721aedc..b7b16756b 100644 --- a/tests/YasumiBase.php +++ b/tests/YasumiBase.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests; @@ -16,7 +16,6 @@ use DateTime; use DateTimeZone; use Faker\Factory as Faker; -use Yasumi\Exception\InvalidDateException; use Yasumi\Filters\BankHolidaysFilter; use Yasumi\Filters\ObservedHolidaysFilter; use Yasumi\Filters\OfficialHolidaysFilter; @@ -45,8 +44,9 @@ trait YasumiBase * @throws \InvalidArgumentException * @throws \RuntimeException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \ReflectionException */ - public function assertDefinedHolidays($expectedHolidays, $provider, $year, $type) + public function assertDefinedHolidays($expectedHolidays, $provider, $year, $type): void { $holidays = Yasumi::create($provider, $year); @@ -70,7 +70,7 @@ public function assertDefinedHolidays($expectedHolidays, $provider, $year, $type // Loop through all known holidays and assert they are defined by the provider class foreach ($expectedHolidays as $holiday) { - $this->assertArrayHasKey($holiday, iterator_to_array($holidays)); + $this->assertArrayHasKey($holiday, \iterator_to_array($holidays)); } unset($holidays); @@ -88,15 +88,15 @@ public function assertDefinedHolidays($expectedHolidays, $provider, $year, $type * @throws \Yasumi\Exception\InvalidDateException * @throws \InvalidArgumentException * @throws \RuntimeException - * @throws \PHPUnit_Framework_AssertionFailedError + * @throws \PHPUnit\Framework\AssertionFailedError * @throws \ReflectionException */ - public function assertHoliday($provider, $shortName, $year, $expected) + public function assertHoliday($provider, $shortName, $year, $expected): void { $holidays = Yasumi::create($provider, $year); $holiday = $holidays->getHoliday($shortName); - $this->assertInstanceOf('Yasumi\Provider\\' . str_replace('/', '\\', $provider), $holidays); + $this->assertInstanceOf('Yasumi\Provider\\' . \str_replace('/', '\\', $provider), $holidays); $this->assertInstanceOf(Holiday::class, $holiday); $this->assertNotNull($holiday); $this->assertEquals($expected, $holiday); @@ -116,19 +116,16 @@ public function assertHoliday($provider, $shortName, $year, $expected) * @throws \RuntimeException * @throws \Yasumi\Exception\UnknownLocaleException * @throws \Yasumi\Exception\InvalidDateException - * @throws \PHPUnit_Framework_AssertionFailedError + * @throws \PHPUnit\Framework\AssertionFailedError * @throws \ReflectionException */ - public function assertNotHoliday($provider, $shortName, $year) + public function assertNotHoliday($provider, $shortName, $year): void { - $this->expectException(InvalidDateException::class); - $holidays = Yasumi::create($provider, $year); $holiday = $holidays->getHoliday($shortName); - $this->assertInstanceOf('Yasumi\Provider\\' . str_replace('/', '\\', $provider), $holidays); + $this->assertInstanceOf('Yasumi\Provider\\' . \str_replace('/', '\\', $provider), $holidays); $this->assertNull($holiday); - $this->assertFalse($holidays->isHoliday($holiday)); unset($holiday, $holidays); } @@ -144,19 +141,20 @@ public function assertNotHoliday($provider, $shortName, $year) * @throws \InvalidArgumentException * @throws \RuntimeException * @throws \Yasumi\Exception\UnknownLocaleException - * @throws \PHPUnit_Framework_AssertionFailedError + * @throws \PHPUnit\Framework\AssertionFailedError + * @throws \ReflectionException */ - public function assertTranslatedHolidayName($provider, $shortName, $year, $translations) + public function assertTranslatedHolidayName($provider, $shortName, $year, $translations): void { $holidays = Yasumi::create($provider, $year); $holiday = $holidays->getHoliday($shortName); - $this->assertInstanceOf('Yasumi\Provider\\' . str_replace('/', '\\', $provider), $holidays); + $this->assertInstanceOf('Yasumi\Provider\\' . \str_replace('/', '\\', $provider), $holidays); $this->assertInstanceOf(Holiday::class, $holiday); $this->assertNotNull($holiday); $this->assertTrue($holidays->isHoliday($holiday)); - if (is_array($translations) && ! empty($translations)) { + if (\is_array($translations) && ! empty($translations)) { foreach ($translations as $locale => $name) { $translationExists = isset($holiday->translations[$locale]) ? true : false; @@ -178,15 +176,16 @@ public function assertTranslatedHolidayName($provider, $shortName, $year, $trans * * @throws \InvalidArgumentException * @throws \RuntimeException - * @throws \PHPUnit_Framework_AssertionFailedError + * @throws \PHPUnit\Framework\AssertionFailedError * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \ReflectionException */ - public function assertHolidayType($provider, $shortName, $year, $type) + public function assertHolidayType($provider, $shortName, $year, $type): void { $holidays = Yasumi::create($provider, $year); $holiday = $holidays->getHoliday($shortName); - $this->assertInstanceOf('Yasumi\Provider\\' . str_replace('/', '\\', $provider), $holidays); + $this->assertInstanceOf('Yasumi\Provider\\' . \str_replace('/', '\\', $provider), $holidays); $this->assertInstanceOf(Holiday::class, $holiday); $this->assertNotNull($holiday); $this->assertEquals($type, $holiday->getType()); @@ -203,17 +202,18 @@ public function assertHolidayType($provider, $shortName, $year, $type) * @param int $year holiday calendar year * @param string $expectedDayOfWeek the expected week day (i.e. "Saturday", "Sunday", etc.) * - * @throws \PHPUnit_Framework_AssertionFailedError + * @throws \PHPUnit\Framework\AssertionFailedError * @throws \InvalidArgumentException * @throws \RuntimeException * @throws \Yasumi\Exception\UnknownLocaleException + * @throws \ReflectionException */ - public function assertDayOfWeek($provider, $shortName, $year, $expectedDayOfWeek) + public function assertDayOfWeek($provider, $shortName, $year, $expectedDayOfWeek): void { $holidays = Yasumi::create($provider, $year); $holiday = $holidays->getHoliday($shortName); - $this->assertInstanceOf('Yasumi\Provider\\' . str_replace('/', '\\', $provider), $holidays); + $this->assertInstanceOf('Yasumi\Provider\\' . \str_replace('/', '\\', $provider), $holidays); $this->assertInstanceOf(Holiday::class, $holiday); $this->assertNotNull($holiday); $this->assertTrue($holidays->isHoliday($holiday)); @@ -232,8 +232,9 @@ public function assertDayOfWeek($provider, $shortName, $year, $expectedDayOfWeek * @param int $range year range from which dates will be generated (default: 1000) * * @return array list of random test dates used for assertion of holidays. + * @throws \Exception */ - public function generateRandomDates($month, $day, $timezone = 'UTC', $iterations = 10, $range = 1000) + public function generateRandomDates($month, $day, $timezone = 'UTC', $iterations = 10, $range = 1000): array { $data = []; for ($y = 1; $y <= $iterations; $y++) { @@ -252,8 +253,9 @@ public function generateRandomDates($month, $day, $timezone = 'UTC', $iterations * @param int $range year range from which dates will be generated (default: 1000) * * @return array list of random easter test dates used for assertion of holidays. + * @throws \Exception */ - public function generateRandomEasterDates($timezone = 'UTC', $iterations = 10, $range = 1000) + public function generateRandomEasterDates($timezone = 'UTC', $iterations = 10, $range = 1000): array { $data = []; @@ -289,10 +291,11 @@ public function generateRandomEasterDates($timezone = 'UTC', $iterations = 10, $ * @param string $timezone the timezone in which Easter is celebrated * * @return \DateTime date of Easter + * @throws \Exception */ - protected function calculateEaster($year, $timezone) + protected function calculateEaster(int $year, string $timezone): DateTime { - if (extension_loaded('calendar')) { + if (\extension_loaded('calendar')) { $easter_days = \easter_days($year); } else { $golden = (($year % 19) + 1); // The Golden Number @@ -356,7 +359,7 @@ protected function calculateEaster($year, $timezone) * * @throws \Exception */ - public function generateRandomEasterMondayDates($timezone = 'UTC', $iterations = 10, $range = 1000) + public function generateRandomEasterMondayDates($timezone = 'UTC', $iterations = 10, $range = 1000): array { return $this->generateRandomModifiedEasterDates(function (DateTime $date) { $date->add(new DateInterval('P1D')); @@ -372,9 +375,14 @@ public function generateRandomEasterMondayDates($timezone = 'UTC', $iterations = * @param int $range year range from which dates will be generated (default: 1000) * * @return array list of random modified Easter day test dates for assertion of holidays. + * @throws \Exception */ - public function generateRandomModifiedEasterDates(callable $cb, $timezone = 'UTC', $iterations = 10, $range = 1000) - { + public function generateRandomModifiedEasterDates( + callable $cb, + $timezone = 'UTC', + $iterations = 10, + $range = 1000 + ): array { $data = []; for ($i = 1; $i <= $iterations; ++$i) { @@ -400,7 +408,7 @@ public function generateRandomModifiedEasterDates(callable $cb, $timezone = 'UTC * * @throws \Exception */ - public function generateRandomGoodFridayDates($timezone = 'UTC', $iterations = 10, $range = 1000) + public function generateRandomGoodFridayDates($timezone = 'UTC', $iterations = 10, $range = 1000): array { return $this->generateRandomModifiedEasterDates(function (DateTime $date) { $date->sub(new DateInterval('P2D')); @@ -418,7 +426,7 @@ public function generateRandomGoodFridayDates($timezone = 'UTC', $iterations = 1 * * @throws \Exception */ - public function generateRandomPentecostDates($timezone = 'UTC', $iterations = 10, $range = 1000) + public function generateRandomPentecostDates($timezone = 'UTC', $iterations = 10, $range = 1000): array { return $this->generateRandomModifiedEasterDates(function (DateTime $date) { $date->add(new DateInterval('P49D')); @@ -436,6 +444,7 @@ public function generateRandomPentecostDates($timezone = 'UTC', $iterations = 10 * @param int $range year range from which dates will be generated (default: 1000) * * @return array list of random test dates used for assertion of holidays. + * @throws \Exception */ public function generateRandomDatesWithHolidayMovedToMonday( $month, @@ -443,7 +452,7 @@ public function generateRandomDatesWithHolidayMovedToMonday( $timezone = 'UTC', $iterations = 10, $range = 1000 - ) { + ): array { return $this->generateRandomDatesWithModifier($month, $day, function ($year, \DateTime $date) { if ($this->isWeekend($date)) { $date->modify('next monday'); @@ -462,6 +471,7 @@ public function generateRandomDatesWithHolidayMovedToMonday( * @param int $range year range from which dates will be generated (default: 1000) * * @return array list of random test dates used for assertion of holidays with applied callback. + * @throws \Exception */ public function generateRandomDatesWithModifier( $month, @@ -470,7 +480,7 @@ public function generateRandomDatesWithModifier( $timezone = 'UTC', $iterations, $range - ) { + ): array { $data = []; for ($i = 1; $i <= $iterations; ++$i) { @@ -493,7 +503,7 @@ public function generateRandomDatesWithModifier( * * @return int a year number */ - public function generateRandomYear($lowerLimit = 1000, $upperLimit = 9999) + public function generateRandomYear($lowerLimit = 1000, $upperLimit = 9999): int { return (int)Faker::create()->numberBetween($lowerLimit, $upperLimit); } @@ -506,8 +516,8 @@ public function generateRandomYear($lowerLimit = 1000, $upperLimit = 9999) * * @return bool true if $dateTime is a weekend, false otherwise */ - public function isWeekend(\DateTimeInterface $dateTime, array $weekendDays = [0, 6]) + public function isWeekend(\DateTimeInterface $dateTime, array $weekendDays = [0, 6]): bool { - return in_array((int)$dateTime->format('w'), $weekendDays, true); + return \in_array((int)$dateTime->format('w'), $weekendDays, true); } } diff --git a/tests/YasumiTestCaseInterface.php b/tests/YasumiTestCaseInterface.php index 8f546fa03..e98bb8835 100644 --- a/tests/YasumiTestCaseInterface.php +++ b/tests/YasumiTestCaseInterface.php @@ -2,12 +2,12 @@ /** * This file is part of the Yasumi package. * - * Copyright (c) 2015 - 2018 AzuyaLabs + * Copyright (c) 2015 - 2019 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @author Sacha Telgenhof + * @author Sacha Telgenhof */ namespace Yasumi\tests;